query_id stringlengths 4 64 | query_authorID stringlengths 6 40 | query_text stringlengths 66 72.1k | candidate_id stringlengths 5 64 | candidate_authorID stringlengths 6 40 | candidate_text stringlengths 9 101k |
|---|---|---|---|---|---|
f75166e33124296aeeb0211944ee6a7123f890b7c490c3529949b8a49ff73110 | ['4fade2b670e54e2e9f3527185e9f0656'] | I have :
\begin{align}
\langle\lvert\mathcal{M}_{fi}\rvert^2\rangle&=\dfrac{16e^4}{4q^4}&&\left[p_2^\mu p_1^\nu-g^{\mu\nu}(p_1\cdot p_2)+p_2^\nu p_1^\mu +m^2g^{\mu\nu}\right]\times\left[p_\
{3\mu} p_{4\nu}-g_{\mu\nu}(p_3\cdot p_4)+p_{4\nu} p_{4\mu} +M^2g_{\mu\nu}\right]\\
&=\dfrac{4e^4}{q^4}&&\left[(p_2\cdot p_3)(p_1\cdot p_4)-(p_1\cdot p_4)(p_3\cdot p_4)+(p_2\cdot p_4)(p_1\cdot p_3)-M^2(p_1\cdot p_2)\right.\\
& &&-(p_1\cdot p_2)(p_3\cdot p_4)+4(p_1\cdot p_2)(p_3\cdot p_4)-(p_1\cdot p_2)(p_3\cdot p_4)+4M^2(p_1\cdot p_2)\\
& &&+(p_1\cdot p_3)(p_2\cdot p_4)-(p_1\cdot p_2)(p_3\cdot p_4)+(p_1\cdot p_4)(p_2\cdot p_3)-M^2(p_1\cdot p_2)\\
& &&-\left. m^2(p_3\cdot p_4)+4m^2(p_3\cdot p_4)-m^2(p_3\cdot p_4)+4m^2M^2\right]\\
&=\dfrac{4e^4}{q^4}&&\left[2M^2(p_1\cdot p_2)+2m^2(p_3\cdot p_4)+4m^2M^2+2(p_1\cdot p_4)(p_2\cdot p_3)+2(p_1\cdot p_3)(p_2\cdot p_4)\right].
\end{align}
which produces the following output :
How can I improve the code so that :
the blank space between the fractions and the left square bracket is removed?
(optional) the plus and minus signs are lined up with the left square brackets?
| 178d763c1e00fd27c34de1bc17cfc06a7df1338363a77294233431459f076542 | ['4fade2b670e54e2e9f3527185e9f0656'] | Thanks <PERSON>, +1 for the -r option and info about userid numbering. I wonder what happens to the IDs when you get more than 900 system accounts? I'm still super new to linux, I'm from windows where I'm used to corporate Active Directory listings having hundreds or thousands of domain service accounts, so naming conventions are essential. I'm not even sure what the equivalent of Active Directory is. So maybe I'm missing something! PS will wait a day for any other answers before accepting |
e6cbc2492203b313e7f7ed197b82aa001b6d54a548de36f8ba3b72dd7a170907 | ['4fbe84f90ada460794658d2a57369995'] | Solved for my own. Sorry for not well-commented script, hope help to somebody
Creates users according to backed up user directory (process exceptions like Default User, Administrator etc), create home directories for them, migrate backed up user directories.
Const WAIT_ON_RETURN = True
Const HIDE_WINDOW = 0
Const USER_ROOT_UNC = "C:\Users" 'Set Home Folder Location Here
On Error Resume Next
Function CreateUser(strUser, strPass)
Set objShell = CreateObject("Wscript.Shell")
Set objEnv = objShell.Environment("Process")
strComputer = objEnv("COMPUTERNAME")
Set colAccounts = GetObject("WinNT://" & strComputer & ",computer")
Set objUser = colAccounts.Create("user", strUser)
objPasswordNoChangeFlag = objUser.UserFlags XOR ADS_UF_PASSWD_CANT_CHANGE
objUser.Put "userFlags", objPasswordNoChangeFlag
objUser.SetInfo
End Function
Function CreateCatalog(strUser)
Dim WshShell, WshNetwork, objFS, objServer, objShare
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objFS = CreateObject("Scripting.FileSystemObject")
Call objFS.CreateFolder(USER_ROOT_UNC & "\" & strUser)
Call WshShell.Run("cacls " & USER_ROOT_UNC & "\" & strUser & " /e /g Administrators:F", HIDE_WINDOW, WAIT_ON_RETURN)
Call WshShell.Run("cacls " & USER_ROOT_UNC & "\" & strUser & " /e /g " & strUser & ":C", HIDE_WINDOW, WAIT_ON_RETURN)
End Function
Function CopyDirs(userName)
arrCopyDirs = Array("Desktop", "Documents", "Downloads", "Links", "Pictures", "Videos", "Music")
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each dirName in arrCopyDirs
currentDirectory = objFSO.GetAbsolutePathName(".")
copiedDirectory = currentDirectory & "\" & userName & "\" & dirName
destDirectory = USER_ROOT_UNC & "\" & userName & "\" & dirName
objFSO.CopyFolder copiedDirectory, destDirectory
Next
End Function
Function EnumerateCatalog()
Dim objFSO, objFolder
Dim arrNotUsers, arrCopyDirs
arrNotUsers = Array("Default User","MediaAdmin$","Administrator","MSSQL$MICROSOFT##WID","All Users","Plesk Administrator","Default","Public","ServerAdmin$")
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each objFolder In objFSO.GetFolder(".").SubFolders
If Not Ubound(Filter(arrNotUsers, objFolder.Name)) > -1 Then
Call CreateUser(objFolder.Name, "12345qweasdzxc")
Call CreateCatalog(objFolder.Name)
Call CopyDirs(objFolder.Name)
End If
Next
End Function
Call EnumerateCatalog()
| db8c1bc6ac3e7ecc7669aac00b54d48a94509e3d6030c00448029d07cba614b1 | ['4fbe84f90ada460794658d2a57369995'] | I am setting up a logistic regression using the following (simplified) form:
Logit(Y) = Constant + Ax + Bz
The real-life scenario is that I am trying to understand the probability of a sales prospect converting from a phone call and x = time_from_prospect_upload_to_call and z = channel of prospect (dummy).
I include x in the model because I want to hold the time_to_call constant for calculating the other coefficients, but if I want to get the predicted Y for new prospects, is it OK to not include x in the linear equation?
|
039450291b2701204839ecc6354c9be2fd0fe3c70244c16f226a5d1dfed7b988 | ['4fc1e4b0b4ea44d5ae697db2b11f0cdc'] | I'm new to tensorflow and trying to classify a game objects / monsters / characters , so I tried to classify this kind of robot (attached pictures) and created like 30 pictures
I trained it to 0.9% loss ( about 300 steps) but for some reason It classifies it wrong .
also I followed this tutorial (sentdex) pythonprogramming.net/testing-custom-object-detector-tensorflow-object-detection-api-tutorial/?completed=/training-custom-objects-tensorflow-object-detection-api-tutorial/
Someone can help me recognize the problem ?
results
| e27e142d2323618b7bc9fd0f0c1d3944c7b3a100b43a192f59449ccf5a4d15f3 | ['4fc1e4b0b4ea44d5ae697db2b11f0cdc'] | I just found out about Openbr and started to install required libraries like OpenCV and QT. I followed these instructions for windows(win10 64bit):
http://openbiometrics.org/docs/install/#windows
but unfortionatly got stuck when executing the following command:
cmake -G "NMake Makefiles" -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_FFMPEG=OFF -DCMAKE_BUILD_TYPE=Debug ..
with this output:
CMake Error at C:/opencv-2.4.11/build-msvc2013/win-install/OpenCVConfig.cmake:71 (include):
include could not find load file:
C:/opencv-2.4.11/build-msvc2013/win-install/OpenCVModules.cmake
Call Stack (most recent call first):
CMakeLists.txt:87 (find_package)
-- adding C:/openbr/openbr/plugins/classification
-- adding C:/openbr/openbr/plugins/cluster
-- adding C:/openbr/openbr/plugins/cmake
-- adding C:/openbr/openbr/plugins/core
-- importing C:/openbr/openbr/plugins/cuda/module.cmake
-- adding C:/openbr/openbr/plugins/distance
-- adding C:/openbr/openbr/plugins/format
-- adding C:/openbr/openbr/plugins/gallery
-- adding C:/openbr/openbr/plugins/gui
-- adding C:/openbr/openbr/plugins/imgproc
-- adding C:/openbr/openbr/plugins/io
-- adding C:/openbr/openbr/plugins/metadata
-- adding C:/openbr/openbr/plugins/output
-- adding C:/openbr/openbr/plugins/representation
-- adding C:/openbr/openbr/plugins/video
CMake Error at openbr/CMakeLists.txt:52 (add_subdirectory):
The source directory
C:/openbr/openbr/janus
does not contain a CMakeLists.txt file.
CMake Warning at C:/Program Files/CMake/share/cmake-3.6/Modules /InstallRequiredSystemLibraries.cmake:463 (message):
system runtime library file does not exist:
'MSVC12_REDIST_DIR-NOTFOUND/x64/Microsoft.VC120.CRT/msvcp120.dll'
Call Stack (most recent call first):
share/openbr/cmake/InstallDependencies.cmake:135 (include)
openbr/CMakeLists.txt:67 (install_compiler_libraries)
CMake Warning at C:/Program Files/CMake/share/cmake-3.6/Modules/InstallRequiredSystemLibraries.cmake:463 (message):
system runtime library file does not exist:
'MSVC12_REDIST_DIR-NOTFOUND/x64/Microsoft.VC120.CRT/msvcr120.dll'
Call Stack (most recent call first):
share/openbr/cmake/InstallDependencies.cmake:135 (include)
openbr/CMakeLists.txt:67 (install_compiler_libraries)
-- Configuring incomplete, errors occurred!
See also "C:/openbr/build-msvc2013/CMakeFiles/CMakeOutput.log".
|
0528da5504461bc614b3d34bf51fe73623e92da9a4b338babab7d670b5beeaa0 | ['4ffc050d6fe64ee189bea9e24ef37cfc'] | I've been trying this, but nothing is being rendered in the DOM. What is the trick here?
recurse(i, arr) {
if (!i) {
i = 0;
arr = [];
}
if (i >= 4) {
return arr;
}
arr.push(<div key={i}>hello world</div>);
this.recurse(i + 1, arr);
}
render() {
let styles = { height: '100vh', overflow: 'hidden' };
return <div style={styles}>{this.recurse()}</div>;
}
| 0b9fc2188063975af6b8a07a6a5f58f566b98eee9a11ffe2ac54e5e21e86db0c | ['4ffc050d6fe64ee189bea9e24ef37cfc'] | I'm having trouble accessing resolved promise object properties.
Using fetch, I have a .then doing this:
.then((response) => console.log(response.json()))
I'm trying to access the user property of the response object by doing this:
.then((response) => console.log(response.json().user))
and it's returning undefined
What is the correct way to do this?
|
47ef9d5626747733e27463c4c7e55446da6b110a47e416af86127a1c29659465 | ['500920f6b8174279a8b00024ddb20d90'] | When you installed Drupal you should have had to setup a main account:
That is the login you should be using, if you don't know that password go to /user and click Forgot Password and you can retrieve your login if you remember username or email you used. Since you got (Pending Admin Approval) it should be that email that is registered as main account.
(Pending Admin Approval) emails are sent when someone else tries to register an account on your site.
| 5f996dfc92bc7ec9c7766787d4922610ffe6f024021aa87e91308bafe5292325 | ['500920f6b8174279a8b00024ddb20d90'] | Estoy haciendo un formulario en el cual ya puede guardar perfectamente en la base de datos mysqli, y ya obtengo los datos en un html. Ahora lo que quiero es borrar mediante un botón.
La cosa es que borra, pero siempre el último registro, y no el cual yo selecciono de la lista independientemente. Si selecciono el primero o el segundo, siempre me borra el último, y quiero ver qué esta mal.
Aquí les dejo el código de donde obtengo la lista, y también tiene el botón de borrar.
<?php
$consultabla = mysqli_query($conexion, "SELECT * from 001_agendacentral") or die("Error al leer Agenda");
while ($extraido = mysqli_fetch_assoc($consultabla)) {
echo '<tr>
<td>'.$extraido['nombre'].'</td>
<td>'.$extraido['departamento'].'</td>
<td>'.$extraido['puesto'].'</td>
<td>'.$extraido['correo'].'</td>
<td>'.$extraido['telefono'].'</td>
<td>
<form action="admdelete.php?id='.$extraido['id'].'" method="POST">
<input name="id" type="hidden" value="' . $extraido['id'].'"/>
<input type="submit" class="btn btn-warning" value="Borrar"/></td>
</tr>';
}
mysqli_close($conexion);
?>
Aquí el archivo que realiza el procedimiento de borrado.
<?php
require_once('../connect.php');
$conexion = mysqli_connect($host,$user,$pass,$db) or die ("Error al conectar");
$conexion->set_charset("utf8");
$id = $_REQUEST['id'];
echo $id;
//Borrado de tabla con el Campo Nombre
$borrar = "DELETE from 001_agendacentral where nombre='$id'" or die("Error al Borrar");
$resultado = mysqli_query($conexion, $borrar) or die ("Error al Borrar");
if ($resultado) {
mysqli_close($conexion);
echo "Borrado Correctamente";
# code...
}
?>
Ya la columna id existe en la base de datos. Por si se preguntan por qué no la muestro, es que no es necesario.
|
42136266ed0c419d9e84ade7dd27a6ba12596cdfaab9bfc7b79ee24729f2adfb | ['501588b02b934ab9aa26a42de00f7be7'] | First we need to make sure that you installed XAMPP in proper way. Follow this video about how to prepare PHP environment using XAMPP.
If you followed the steps correctly make sure that both MySQL and Apache servers are running.
Then in XAMPP control panel click on MYSQL Admin. It will open phpMyAdmin and it will show a successful connection to MySQL server. If you noticed any error this means you have problem in your MySQL server.
Also it will be a good help to tell us from there your server type and version and your MySQL workbench version.
| 1452e26f857104b66da265af8ffb444256fbb267e909170dc39363d1970c1327 | ['501588b02b934ab9aa26a42de00f7be7'] | The standard settings activity from google android studio is now showing the first header "General". So i modified the code but i get java.lang.NullPointerException at first occurrence of getPreferenceScreen().addPreference(fakeHeader);
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
PreferenceCategory fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_notifications);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_general);
fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_notifications);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_notification);
bindPreferenceSummaryToValue(findPreference("username"));
bindPreferenceSummaryToValue(findPreference("password"));
bindPreferenceSummaryToValue(findPreference("server"));
}
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onBuildHeaders(List<Header> target) {
if (!isSimplePreferences(this)) {
loadHeadersFromResource(R.xml.pref_headers, target);
}
}
<header
android:fragment="com.example.eslam.rottapharm.SettingsActivity$GeneralPreferenceFragment"
android:title="@string/pref_header_general" />
</preference-headers>
|
287e7237952aedf190f9033f46562b7cfa4d1717aed42f91671344ad121e24d3 | ['5016af82b78644448fdd5eee102b5689'] | <PERSON> here again with a little issue I'm having that I hope you guys can help me with.
I'm reviewing for midterms and going over an old file I found on here and I wanted to get it working. I can't find it on here anymore but I still have the source code so I'll make another question on it.
So here was his assignment:
Write a perl script that will compare two directories for differences in regular files. All regular files with the same names should be tested with the unix function /usr/bin/diff -q which will determine whether they are identical. A file in dir1 which does not have a similarly named file in dir2 will have it's name printed after the string <<< while a file in dir2 without a corresponding dir1 entry will be prefixed with the string >>>. If two files have the same name but are different then the file name will be surrounded by > <.
Here is the script:
#!/usr/bin/perl -w
use File<IP_ADDRESS>Basename;
@files1 = `/usr/bin/find $ARGV[0] -print`;
chop @files1;
@files2 = `/usr/bin/find $ARGV[1] -print`;
chop @files2;
statement:
for ($i=1; @files1 >= $i; $i++) {
for ($x=1; @files2 >= $x; $x++) {
$file1 = basename($files1[$i]);
$file2 = basename($files2[$x]);
if ($file1 eq $file2) {
shift @files1;
shift @files2;
$result = `/usr/bin/diff -q $files1[$i] $files2[$x]`;
chop $result;
if ($result eq "Files $files1[$i] and $files2[$x] differ") {
print "< $file1 >\n";
next statement;
} else {
print "> $file1 <\n";
}
} else {
if ( !-e "$files1[$i]/$file2") { print ">>> $file2\n";}
unless ( -e "$files2[$x]/$file1") { print "<<< $file1\n";}
}
}
}
This is the output:
> file2 <
>>> file5
<<< file1
The output should be:
> file1 <
> file2 <
<<< file4
>>> file5
I already checked the files to make sure that they all match and such but still having problems. If anyone can help me out I would greatly appreciate it!
| d2674cdaa8e4d5fe7d95a77c2bbce95d335d6da9db8b0ef4dfbe7fe7a7862550 | ['5016af82b78644448fdd5eee102b5689'] | My assignment is a little more in depth than the title but in the title is my main question. Here is the assignment:
Write a perl script that will grep for all occurrences of the regular expression in all regular files in the file/directory list as well as all regular files under the directories in the file/directory list. If a file is not a TEXT file then the file should first be operated on by the unix command strings (no switches) and the resulting lines searched. If the -l switch is given only the file name of the files containing the regular expression should be printed, one per line. A file name should occur a maximum of one time in this case. If the -l switch is not given then all matching lines should be printed, each proceeded on the same line by the file name and a colon. An example invocation from the command line:
plgrep 'ba+d' file1 dir1 dir2 file2 file3 dir3
Here is my code:
#!/usr/bin/perl -w
use Getopt<IP_ADDRESS>Long;
my $fname = 0;
GetOptions ('l' => \$fname);
$pat = shift @ARGV;
while (<>) {
if (/$pat/) {
$fname ? print "$ARGV\n" : print "$ARGV:$_";
}
}
So far that code does everything it's supposed to except for reading non-text files and printing out duplicates of file names when using the -l switch. Here is an example of my output after entering the following on the command line: plgrep 'ba+d' file1 file2
file1:My dog is bad.
file1:My dog is very baaaaaad.
file2:I am bad at the guitar.
file2:Even though I am bad at the guitar, it is still fun to play!
Which is PERFECT!
But when I use the -l switch to print out only the file names this is what I get after entering the following on the command line: plgrep -l 'ba+d' file1 file2
file1
file1
file2
file2
How do I get rid of those duplicates so it only prints:
file1
file2
I have tried:
$pat = shift @ARGV;
while (<>) {
if (/$pat/) {
$seen{$ARGV}++;
$fname ? print "$ARGV\n" unless ($seen{$ARGV} > 1); : print "$ARGV:$_";
}
}
But when I try to run it without the -l switch I only get:
file1:My dog is bad.
file2:I am bad at the guitar.
I also tried:
$fname ? print "$ARGV\n" unless ($ARGV > 1) : print "$ARGV:$_";
But I keep getting syntax error at plgrep line 17, near ""$ARGV\n" unless"
If someone could help me out with my duplicates issue as well as the italicized part of the assignment I would truly appreciate it. I don't even know where to start on that italicized part.
|
80fa64a1ea08fca2b60d528a22288a22ac99a27f6343074f0b18cd1d9549ed09 | ['5016d285c0f641f2adcd76b71e9352d9'] | I guess you don't need to be very confident, you can just test the two approaches using cross validation and see which gives better results :-).
Another approach which I still think is much better than ordered lasso is to choose a penalty form, e.g. have a different prefactor on each lasso penalty term that is exponentially decaying. Than cross validate to find the best exponential constant. | 2a1409a2f3198b2f2386f9e3c5c6f083d0b6681fc97602e62c761a60a4093e35 | ['5016d285c0f641f2adcd76b71e9352d9'] | How would I set up a NN to classify a cryptographic key for asymmetric cryptography, or generally a VERY large number/bit string?
I could split this bit string into bytes/16bit/32bit/64bit numbers to use as NN inputs, but that does not seem like a good idea, since I am not looking for relationships and patterns between the bytes or blocks. I am looking for structure in the whole key.
In this exact case I want to classify an almost 20000-bit string into 2 classes.
What would be the correct approach?
|
0305246e3102bd4e2926ba86747c0113f934cc71e44db520040a8263674dc345 | ['502b6c3a96bc447bbd5d57e7f333da79'] | If I try to use order_by on a text field I get: "no field configured with name title".
Works fine on fields of type "string". So I end up using a workaround like:
searchable do
text :title
string :title_sortable do
title
end
end
Is there any reason why we cannot order_by on text fields?
| 44de9a03c261c2eb20c5456a95a1ec71ef63071a923eab584c45602bc97c55a1 | ['502b6c3a96bc447bbd5d57e7f333da79'] | When I select an item via keyboard arrows, the selection in the input field changes as expected. However if I then move the mouse out of the item, the input field reverts to whatever the user had typed, losing the selection previously made via the keyboard.
<PERSON> example
The documentation claims that what I'm trying to accomplish is in fact the default behavior, but it seems to not be working.
Another reference mentioning that the behavior seems to have changed: http://forum.jquery.com/topic/autocomplete-s-menu-items-mouseover-behavior#14737000002991273
I'm currently using jquery-rails 2.0.2, which pulls in jQuery-1.7.2.
|
bc24e0334c0eca1da7bd74b1e16412bfeca2ad4507ac503918ec245a455f0c9d | ['502fc893ea494c6f86ce538fa6c17ff2'] | I am doing a project which need real time changes to be reflected on apollo server from hasura using graphql subscription. Apollo server have PubSub which only get published on trigerring a mutation or query which is on apollo. But I want that from hasura. how can i achieve that?
| 1502d581b47490d0c885c8a886c1e1bf5aef2d6299da94752117903879d900a9 | ['502fc893ea494c6f86ce538fa6c17ff2'] | It was asked in an interview that what are nested objects ? give a real life example also.
I end up saying that if we create an object of class B in class A and when the object of class A will be created then Class A object will already be having Class B object and that's called nested object.
|
856f12304108beb48ac482e6b0496ec62a120e0396021fe9eaaf54039d518fe7 | ['50311a70ecc0441ca2e335849a1435b3'] | У вас декоратор @client.message_handler(content_types = ['text'])не оборачивает функцию usename_info(message), а находится непонятно где
Должно быть так:
@client.message_handler(content_types = ['text'])
def usename_info(message):
if message.text == "МОЙ ID":
client.send_message(message.chat.id, f'Ваш ID : {message.from_user.id}')
elif message.text == "МОЙ НИК":
client.send_message(message.chat.id, f'Ваш ник : {message.from_user.first_name} {message.from_user.last_name}')
client.polling(none_stop = True, interval = 0)
| bddff5374eb0cadb82f149f8c36e1775deac0bae06712801cc0ba0ac56f13075 | ['50311a70ecc0441ca2e335849a1435b3'] | Проверяйте теперь примерно так:
def check(date: str, time: str):
mycursor.execute("SELECT * FROM users WHERE data=date AND time=time")
return myresult = mycursor.fetchone()
@run_async
@log_func(log)
def on_time_12(update: Update, context: CallbackContext):
global text_time
user_data = context.user_data
text_time = '12:00'
user_data['Время'] = text_time
if check(user_data['Дата'], user_data['Время']):
query.answer_callback_query(text='Извините, это время занято, выберите другое!', show_alert=True)
print('Найдено в бд')
else:
query.edit_message_text('''Введите своё *Имя и Фамилию*''', parse_mode='Markdown')
|
1231cf2e7729366b8d28c2f70687a5c887e6f57c117944dd255b9af4fa5a54b8 | ['5033568e55f44add8f5ed22b0a51811b'] | To solve this issue i changed the data base password and removed the special characters, MySqli is an improved version on MySql driver so it is not recommended to change this value on the configuration, also changing to MyIsam removes the integrity of the relations and transactions, so this is also a point of considering. So if your server supports MySqli you should use this option with the default InnoDB engine.
| a10d369c49f7c21cd2ce38ec95380874c1f4c8b1a054ee003d3ca7c914eb8b66 | ['5033568e55f44add8f5ed22b0a51811b'] | I think this is a better approach as matches only valid directory, file names and extension. and also groups the path, filename and file extension. And also works with empty paths only filename.
^([\w\/]*?)([\w\.]*)\.(\w)$
Test cases
the/p0090Aath/fav.min.icon.png
the/p0090Aath/fav.min.icon.html
the/p009_0Aath/fav.m45in.icon.css
fav.m45in.icon.css
favicon.ico
Output
[the/p0090Aath/][fav.min.icon][png]
[the/p0090Aath/][fav.min.icon][html]
[the/p009_0Aath/][fav.m45in.icon][css]
[][fav.m45in.icon][css]
[][favicon][ico]
|
254e4ce9f8b7a3aac3507f0d77217c9aa23261d6e935cce1ae1a7de53983e5e5 | ['5042d8292842401a838ee75d55e3b611'] | I am trying to create a new object of type Invoice. I pass in the necessary parameters in the correct order.
However, it is telling me that I have included invalid arguments. I might be overlooking something very simple here, but maybe someone can point it out.
I am working on homework, however the Invoice.cs file was included for use with the project.
The only solution I am seeking is why my object will not accept the values. I have never had an issue with objects before.
Here is the code I have:
static void Main(string[] args)
{
Invoice myInvoice = new Invoice(83, "Electric sander", 7, 57.98);
}
And here is the actual Invoice.cs file:
// Exercise 9.3 Solution: Invoice.cs
// Invoice class.
public class Invoice
{
// declare variables for Invoice object
private int quantityValue;
private decimal priceValue;
// auto-implemented property PartNumber
public int PartNumber { get; set; }
// auto-implemented property PartDescription
public string PartDescription { get; set; }
// four-argument constructor
public Invoice( int part, string description,
int count, decimal pricePerItem )
{
PartNumber = part;
PartDescription = description;
Quantity = count;
Price = pricePerItem;
} // end constructor
// property for quantityValue; ensures value is positive
public int Quantity
{
get
{
return quantityValue;
} // end get
set
{
if ( value > 0 ) // determine whether quantity is positive
quantityValue = value; // valid quantity assigned
} // end set
} // end property Quantity
// property for pricePerItemValue; ensures value is positive
public decimal Price
{
get
{
return priceValue;
} // end get
set
{
if ( value >= 0M ) // determine whether price is non-negative
priceValue = value; // valid price assigned
} // end set
} // end property Price
// return string containing the fields in the Invoice in a nice format
public override string ToString()
{
// left justify each field, and give large enough spaces so
// all the columns line up
return string.Format( "{0,-5} {1,-20} {2,-5} {3,6:C}",
PartNumber, PartDescription, Quantity, Price );
} // end method ToString
} // end class Invoice
| 8ef32b5e365a21ed4a352ed5e5b2d1a5c361ec3b570458ee540a4deba7e0af28 | ['5042d8292842401a838ee75d55e3b611'] | The problem I am facing seems simple to me, but I cannot push past this mental block.
To explain my situation a little better: I am reading in values from an mdf database (Northwind) and passing the ContactName column into a class method that splits the value into first and last names. It then passes these back and I attempt to add them to my DataGridView under the proper columns I created.
My problem is, is that with this current code, it is adding rows for each column, but they are all blank aside from the last one, which shows the last first and last name in the tables column.
I feel that for some reason, the rows that are showing blank might be being overwritten, but I'm not sure. Am I on the right track?
Here is my code:
conn.Open();
SqlDataReader reader = command.ExecuteReader();
searchDataGridView.AllowUserToAddRows = true;
Customer cust = new Customer();
searchDataGridView.ColumnCount = 2;
searchDataGridView.Columns[0].Name = "First Name";
searchDataGridView.Columns[1].Name = "Last Name";
int index = this.searchDataGridView.Rows.Count;
while (reader.Read())
{
string customerid = reader.GetString(0);
string contactname = reader.GetString(2);
cust.NameSplit(contactname);
this.searchDataGridView.Rows.Add();
DataGridViewRow r = searchDataGridView.Rows[rowIndex];
r.Cells["First Name"].Value = cust.FirstName;
r.Cells["Last Name"].Value = cust.LastName;
}
While that seems like a mouthful to me, I hope I explained it clearly enough. If you need more information, please let me know and I would be more than happy to provide it. Thank you :)
|
1eb03c77440c954038c4cb98d5d22fe02c84158e2f17cff8824137a1e754adec | ['5044973a2cfb466e9d2196c9fe3804d3'] | Let $\sum_j\chi_j(x)^2=1$ be a partition of unity with respect to the variable $x\in \mathbb{R}^{2d}$.
Please help me to simplify as possible
$$\sum_j\langle \chi_ju,-\Delta(\chi_ju)\rangle-\langle u,-\Delta u\rangle$$
for all $u\in\mathcal{C}_0^{\infty}(\mathbb{R}^{2d})$
Thanks in advance
| 65c3f26e3951e908a9b62ae8f70e91bfcac38b15bffb2abf3209bcc5f25726e1 | ['5044973a2cfb466e9d2196c9fe3804d3'] | this is what i wrote but i don't know if it is true and if so how to continu: $$\sum_j\langle \chi_ju,-\Delta(\chi_ju)\rangle-\langle u,-\Delta u\rangle=\sum_j\langle \nabla(\chi_ju),\nabla(\chi_ju)\rangle-\langle u,-\Delta u\rangle=\sum_j\langle \nabla(\chi_j)u+\nabla(u)\chi_j, \nabla(\chi_j)u+\nabla(u)\chi_j\rangle-\langle u,-\Delta u\rangle=\sum_j\langle \nabla(\chi_j)u, \nabla(\chi_j)u\rangle+\sum_j\langle \nabla(u)\chi_j,\nabla(u)\chi_j\rangle+\sum_j\langle \nabla(\chi_j)u, \nabla(u)\chi_j\rangle+\sum_j\langle \nabla(u)\chi_j, \nabla(\chi_j)u\rangle-\langle u,-\Delta u\rangle$$ |
a5aee8ce48c9efe3ae054c135cb58eeb29753f47d6b6abebbfd74f586f2fb839 | ['5055a6a80c7444c7a5e0ad0acb9c9eb1'] | Your matrix is in augmented form, i.e. $[A|b]$. The matrix $A$ is in upper triangle form and so the determinant is given by the product of its diagonal elements
$\det(A) = a(a-3)(a-5)$
The system has exactly one solution if $\det(A) \ne 0$.
To check, when it has no or infinitely many solution, look back at the augmented matrix.
Looking at the last row:
$(a-5)x_3 = 0$.
If we want to be able to choose $x_3$ freely (to get more than one unique solution) we need $a=5$.
Finally assume that $a \ne5$ and therefore $x_3 = 0$ and look at the second row. With the assumptions taken, this tells us:
$(a-3)x_2 = 1$.
This only has a solution if $a \ne 3$. Therefore $a=3$ gives the case with no solutions. By using the same argument for the first line you also find that $a=0$ yields no solution.
| 16c37a52ce6d3fbf825ee5abaf6d0ff71e41714206050bb0029d80e0888ebf94 | ['5055a6a80c7444c7a5e0ad0acb9c9eb1'] | Hi folks can any one please let me know , How to develop Iphone Applications on Windows Platform(Xp, Vista).if so
i have Windows System with XP OS
How to install the software
'what is the software name and
please let me know the Blogs and Free Downloads for Trail Versions
Thank in advance
<PERSON>
|
888d838c04b366ca4e15ea1c58a669974ba6de724e330a85fa74c266d935c291 | ['5057656e2bf14b4da6742941643810f4'] | When I Change Font.Color of a TNewStaticText to any color, the TNewStaticText stays black.
But When I Change Font.Color of a TLabel everything works fine.
But when I use TLabel I get wierd results on windows xp.
Why does TNewStaticText always display the black color?
What stable text in inno setup can I use that won't change color or any other properties on different computers?
| 95ab8e78f53421007e5d816a5bb931fd14c8131dd9bd489ed8dc170adf0f1016 | ['5057656e2bf14b4da6742941643810f4'] | I have a php script that scrapes the web and inserts the scraped data into a database.
The php script uses Phantomjs as a tool to scrape web pages.
The php script scrapes web pages on a specific domain.
for example:
www.example.com/firstFolder
www.example.com/secondFolder
and so on
My problem is that phantomjs doesn't keep cache of previous web pages that it has already requested during the script, and instead it just re-downloads them over again.
My guess is that phantomjs doesn't cache previous web pages that it loaded, because i call phantomjs from the php script as an external program each time i need to scrape a certain web page.
$response = shell_exec('phantomjs getWebPage.js');
And since i recall phantomjs as an external program each time, it probably doesn't have any memory of its previously scraped web pages.
I understand that if i were to run phantomjs in one instance, i could keep Phantomjs caching.
But i don't know how to do that without relinquishing entirely on php from my program.
So my question is this.
How can i keep phantomjs caching while still running my program in php?
|
85a429ff399f34757bd81c47dad49228771dcf342ed3f05fc977bbcf8ecce7d5 | ['50586128bbb749ff895f1357ab9a21c1'] | View navHeader=navigationView.getHeaderView(0);[![enter image description here][1]][1]
navMenu=navigationView.getMenu();
List item
//work for login and logout menu
if (MyPreferences.getBoolean(BaseActivity.this,ConstantValues.KEY_IS_LOGIN)){
navMenu.getItem(0).setVisible(false);
navMenu.getItem(9).setVisible(true);
}else {
navMenu.getItem(0).setVisible(true);
navMenu.getItem(9).setVisible(false);
}
| 4861508e869fb3d86d340554cd94f7b371327568a248b2fe3b810cf8d8f7e468 | ['50586128bbb749ff895f1357ab9a21c1'] |
<item
android:id="@+id/search"
android:icon="@drawable/ic_search"
android:title="Search"
app:actionViewClass="androidx.appcompat.widget.SearchView"
app:showAsAction="always"/>
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.search_menu, menu);
// Associate searchable configuration with the SearchView
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchView = (SearchView) menu.findItem(R.id.search).getActionView();
searchView.setQueryHint("Search the customer...");
searchView.setSearchableInfo(Objects.requireNonNull(searchManager).getSearchableInfo(getComponentName()));
searchView.setMaxWidth(Integer.MAX_VALUE);
searchView.setIconifiedByDefault(false);
searchView.requestFocus();
}
<pre>
<item
android:id="@+id/search"
android:icon="@drawable/ic_search"
android:title="Search"
app:actionViewClass="androidx.appcompat.widget.SearchView"
app:showAsAction="always"/>
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.search_menu, menu);
// Associate searchable configuration with the SearchView
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchView = (SearchView) menu.findItem(R.id.search).getActionView();
searchView.setQueryHint("Search the customer...");
searchView.setSearchableInfo(Objects.requireNonNull(searchManager).getSearchableInfo(getComponentName()));
searchView.setMaxWidth(Integer.MAX_VALUE);
searchView.setIconifiedByDefault(false);
searchView.requestFocus();
}
</pre>
|
06a2d4f57f34ee950eeab30f7383e1d49d1fff7ecac91415a81c16a02b029450 | ['50719373d2974b9d842f2a43f8d84f71'] | I am trying to count the number of unique values in a table column. I have set the range as the relevant column in the table. In defining the number of unique values to count I am getting the following error:
Required_Rows = WorksheetFunction.SumProduct(1 / WorksheetFunction.CountIf(Range(Rng), Range(Rng)))
| a49fdb8ec13bd27c9a1a8565977fd02e03a41203427c73abe820e266c2cfdd29 | ['50719373d2974b9d842f2a43f8d84f71'] | I am trying to edit a table in a slide, and I am using this code. Can someone please tell me why it isn't working? If instead of s.Shapes.Table I have s.Shapes.Range for example it works fine.
Sub format()
Dim s As Slide
For Each s In ActivePresentation.Slides
With s.Shapes.Table
.TextFrame.TextRange.Font.Name = "Arial"
.TextFrame.TextRange.Font.Size = 30
End With
Next s
End Sub
|
d19131e26f38c7c72f8a820c5ec7f61d6f2af71739d5f12e89006b11e51fb3c6 | ['50780f436a6744f48cd8acfe5ca5c1b7'] | You need to set clipsToBounds to NO for the shadow, but the downside is that if your text is longer than the visible area of the view and you need to scroll it, then it will no longer be clipped to the view's visible boundaries. I'm looking for a clean way around this.
| d88261575d22d9076f249dfb4985b946ace9826dac31d6b29814e9440bc6fb74 | ['50780f436a6744f48cd8acfe5ca5c1b7'] | Another possible reason is a bug that was apparently still lurking in iOS 7.0.x, but fixed in 7.1, described here :
https://devforums.apple.com/message/858259#858259 (Apple dev forums link - dev membership required)
It can happen if you've added the UISearchBar to the TableView's tableHeaderView (as it is shown in Apple's 'Table Search' sample), in which case a workaround is to remove it from there and tell the UISearchDisplayController to display the search bar in the status bar :
[self.searchDisplayController.searchBar removeFromSuperview];
self.searchDisplayController.displaysSearchBarInNavigationBar = YES;
the only drawback is that this hides the table's title, but at least it doesn't crash. Upgrading to 7.1 fixed the problem for me.
|
e2ac8f727318660176b4ab789fc825e7a9748b7fbdf713deb6496419b6f5d504 | ['5091f34343d047b6b9a5a0d04c140053'] | If you want to get data values from rows with the same index value as you have in spreadsheet 1, you can use the VLOOKUP function to accomplish.
VLOOKUP(A1,'C:\PathToWorkBook\[Workbookname.xlsx]SheetName!$A$1:$F$200,2,FALSE)
This would return the value in column B of from SheetName in Workbookname.xlsx where the value in column A of that sheet has the same value as cell A1 of your current worksheet. If no corresponding value is found in Workbookname.xlsx, this function will return a '#N/A'. It should also be noted that if your key value in column A is not unique, this function will return the results from the FIRST match only and not tell you that multiple look up keys exist.
By modifying the 3rd parameter, you can change which column (B through F) in your target spreadsheet you are reading values from.
You can also use the VLOOKUP in VBA code if you desire using
WorksheetFunction.VLookup
to perform the same functionality. You can then write the result of the look up directly to a cell value.
| b89c53bde25893d8591d18a36e711c9a7358506102a859fe79d74562cd64ded1 | ['5091f34343d047b6b9a5a0d04c140053'] | I have a VB.NET application that is processing a large volume of data from an Oracle database and performing calculations on the data retrieved. The data is being retrieved from 3 related tables.
The main table has a single record for each item that needs to be calculated (slightly less than 1 million rows at this time). There is a one-to-many relationship to each of the other two tables with an average of 20 records in the subsidiary tables to each record in the main table (about 20 million rows total).
I am currently retrieving the data using an OracleDataReader object to access a stored procedure that returns a REF_CURSOR to the result of a query that joins these tables. The .NET code reads the records one at a time and uses the primary key column to group a set of records from this result set into a computation batch which it then performs the required calculations on.
The processing time for this application is longer than I currently want and I am looking for a more efficient way to access this data for processing that could support multithreading of the application so multiple worker threads could perform the calculations on each set of main record / sub-record sets from my database. Any suggestions?
|
ba99b66109ffb645ccc9674be179df79c4ed4091a5eb19bb28dbe3613580e01c | ['509a87254e8f4a1a9679c4033ccd4865'] | I think you will want to use a data-* attribute within the anchor. Then access it using Javascript or JQuery.
<a href="#modalDialog" data-itemid="1" class="edit-name-link" >Edit Name</a>
Then in JQuery
$(".edit-name-link").click(
function()
{
var itemid = $(this).attr("data-itemid"); // this will get the clicked itemid
//now open your modal however you opened it before, and do something with itemid
});
| 1724d2899b067497fccdbd6bebbbe30a9f5b8be37ef96b222927bf4c3df5acb2 | ['509a87254e8f4a1a9679c4033ccd4865'] | It looks like the ADC communicates over I2C. The RPi B+ can use SMBUS in python (like in the link you have in your question) to communicate over I2C. I imagine that 2 of the lines on this ADC are V+ and GND, the other two will correspond with the SCL (clock line for I2C) and the SDA (data line for I2C) which on the B+ are physical pins 3 (SDA) and 5(SCL).
Edit 1:
Once you have it connected you'll need the address of the ADC. You can get it with
i2cdetect -y 1
at the shell.
For some example code check out this instructable.
|
e238e5f9b503136004d3dc1a5489279f7297a082228b7fa892ab1ac21797b6fe | ['509c207efe3b47f2bb0e281b6dc36c1b'] | I have these movies and when a movie is clicked a floating div appears.
In this floating div i need to put a link to a video / trailer inside the div when it opens. Any link i put inside that div does not work when clicked. Chrome even shows the link when hovering over the link, but clicking it does nothing.
Also any link outside the floating div works just fine.
How can i fix this?
Please check this demo with running code. Thanks.
Codepen Demo
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div class="app">
<h3>Most Popular Movies</h3>
<section class="movies">
<div class="movie">
<img src="https://m.media-amazon.com/images/M/MV5BMTc5MDE2ODcwNV5BMl5BanBnXkFtZTgwMzI2NzQ2NzM@._V1_.jpg" alt="" class="poster" />
<div class="title">Avengers: Endgame</div>
<div class="info">
<span class="length">182 min</span>
<span class="year">2019</span>
</div>
<div class="desc">
Adrift in space with no food or water, <PERSON> sends a message to <PERSON> as his oxygen supply starts to dwindle. Meanwhile, the remaining Avengers <PERSON>, <PERSON>, <PERSON> and <PERSON> must figure out a way to bring back their vanquished allies for an epic showdown with <PERSON> the evil demigod who decimated the planet and the universe.
<br>
<a target="_blank" class="info-btn color small" href="https://www.youtube.com/watch?v=TcMBFSGVi1c"><i class="fas fa-info-circle"></i> Play Trailer</a>
<div>
</div>
<a class="popup-youtube" href="https://www.youtube.com/watch?v=TcMBFSGVi1c">Popup</a>
</div>
</div>
<div class="movie">
<img src="https://m.media-amazon.com/images/M/MV5BMjU0NDk0N2EtNTliZS00MjNmLTk0M2MtYTMzOTUxMGQwZWI3XkEyXkFqcGdeQXVyMzE0MTQ2NzQ@._V1_.jpg" alt="" class="poster" />
<div class="title">Top End Wedding</div>
<div class="info">
<span class="length">113 min</span>
<span class="year">2019</span>
</div>
<div class="desc">
<PERSON> and <PERSON> have 10 days to find <PERSON>'s mother who has gone AWOL in the remote far north of Australia so that they can reunite her parents and pull off their dream wedding.
<a target="_blank" class="info-btn color small" href="https://www.dolby.com/us/en/cinema"><i class="fas fa-info-circle"></i> Play Trailer</a>
</div>
</div>
<div class="movie">
<img src="https://cineprog.de/images/Breite_400px_RGB/p_77672.jpg" alt="" class="poster" />
<div class="title">Dumbo</div>
<div class="info">
<span class="length">112 min</span>
<span class="year">2019</span>
</div>
<div class="desc">
Struggling circus owner <PERSON> enlists a former star and his two children to care for <PERSON>, a baby elephant born with oversized ears. When the family discovers that the animal can fly, it soon becomes the main attraction bringing in huge audiences and revitalizing the run-down circus. The elephant's magical ability also draws the attention of <PERSON>, an entrepreneur who wants to showcase <PERSON> in his latest, larger-than-life entertainment venture.
<a target="_blank" class="info-btn color small" href="https://www.dolby.com/us/en/cinema"><i class="fas fa-info-circle"></i> Play Trailer</a>
</div>
</div>
<div class="movie">
<img src="https://m.media-amazon.com/images/M/MV5BODVjZThlMzMtZjQwNy00YjRlLWE5ZTMtMWVlMWUwM2U1NjRkXkEyXkFqcGdeQXVyODcyODY1Mzg@._V1_UY1200_CR90,0,630,1200_AL_.jpg" alt="" class="poster" />
<div class="title">The Happy Prince</div>
<div class="info">
<span class="length">105 min</span>
<span class="year">2018</span>
</div>
<div class="desc">
His body ailing, <PERSON> lives out his last days in exile, observing the difficulties and failures surrounding him with ironic detachment, humour, and the wit that defined his life.
<a target="_blank" class="info-btn color small" href="https://www.dolby.com/us/en/cinema"><i class="fas fa-info-circle"></i> Play Trailer</a>
</div>
</div>
</section>
<div class="detail">
<svg class="close">
<use xlink:href="#close"></use>
</svg>
<div class="movie">
<img src="https://github.com/supahfunk/supah-codepen/blob/master/movie-room.jpg?raw=true" alt="" class="poster" />
<div class="title">Room</div>
<div class="info">
<span class="length">117 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
<PERSON> is a young boy of 5 years old who has lived all his life in one room. He believes everything within it are the only real things in the world. But what will happen when his Ma suddenly tells him that there are other things outside of Room?
<a target="_blank" class="info-btn color small" href="https://www.dolby.com/us/en/cinema"><i class="fas fa-info-circle"></i> Play Trailer</a>
</div>
</div>
</div>
</div>
<a class="popup-youtube" href="https://www.youtube.com/watch?v=TcMBFSGVi1c">Trailer Popup</a>
</div>
CSS
/*Card APP*/
/*-------------------- Body --------------------*/
*, *::before, *::after {
box-sizing: border-box;
}
/*-------------------- App --------------------*/
.app {
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80vw;
height: 390px;
background: #fff;
border-radius: 15px;
box-shadow: 0 5px 30px rgba(0, 0, 0, .2);
}
.app h3 {
color: #525661;
font-size: 17px;
box-shadow: inset 0 1px 0px rgba(0, 0, 0, 0.1);
padding: 20px 28px 0;
margin: -6px 0 0 0;
}
/*-------------------- Movies --------------------*/
.movies {
display: flex;
padding: 8px 18px;
}
.movies .movie {
padding-right:10%;
cursor: pointer;
}
.movies .movie .poster {
width:11vw;
margin-bottom: 6px;
border-radius: 4px;
}
.movies .movie .poster.active {
opacity: 0;
}
.movies .movie .title {
color: #525661;
margin-bottom: 4px;
font-size: 16px;
}
.movies .movie .info {
font-size: .95vmax;
opacity: 0.8;
color: #8b9095;
font-family: 'Roboto', sans-serif;
}
.movies .movie .desc {
display: none;
}
/*-------------------- Detail --------------------*/
.detail {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
padding: 37px 30px 30px 255px;
display: none;
}
.detail<IP_ADDRESS>before {
content: '';
background: #fff;
position: absolute;
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 15px;
opacity: 0;
transition: all 0.4s cubic-bezier(0.67, 0.13, 0.1, 0.81);
}
.detail .close {
position: absolute;
top: 21px;
right: 22px;
width: 12px;
height: 12px;
cursor: pointer;
border: 6px solid #fff;
box-sizing: content-box;
z-index: 10;
}
.detail .poster {
position: absolute;
z-index: 2;
top: -10%;
left: -6%;
height: 100%;
border-radius: 5px;
box-shadow: 0 5px 30px rgba(0, 0, 0, .2);
transition: all 0.5s cubic-bezier(0.67, 0.13, 0.1, 0.81);
}
.detail .title, .detail .info, .detail .desc, .detail .play, .detail .close {
transform: translateX(-50px);
opacity: 0;
transition: all 0.4s cubic-bezier(0.67, 0.13, 0.1, 0.81);
}
.detail .close {
transform: translateX(10px);
}
.detail .title {
font-size: 3vmax;;
font-weight: 300;
color: #525661;
margin-bottom: 5px;
}
.detail .info {
font-size: .95vmax;
opacity: 0;
margin-left: 2px;
color: #8b9095;
font-family: 'Roboto', sans-serif;
}
.detail .desc {
text-align: left;
margin-top: 30px;
font-size: 1.25vmax;
line-height: 1.6;
text-align: left;
color: #8b9095;
font-family: 'Roboto', sans-serif;
}
.detail .play {
background: linear-gradient(90deg, #e4761f, #ff8b32);
border: none;
border-radius: 20px;
color: #fff;
font-size: 12px;
line-height: 1.5;
padding: 8px 17px;
margin: 30px 0 0 -2px;
text-transform: uppercase;
z-index: 10;
outline: none !important;
cursor: pointer;
opacity: 0;
}
.detail .play svg {
vertical-align: middle;
position: relative;
top: -2px;
margin-right: 3px;
}
.detail.ready<IP_ADDRESS><IP_ADDRESS>before, *<IP_ADDRESS>after {
box-sizing: border-box;
}
/*-------------------- App --------------------*/
.app {
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80vw;
height: 390px;
background: #fff;
border-radius: 15px;
box-shadow: 0 5px 30px rgba(0, 0, 0, .2);
}
.app h3 {
color: #525661;
font-size: 17px;
box-shadow: inset 0 1px 0px rgba(0, 0, 0, 0.1);
padding: 20px 28px 0;
margin: -6px 0 0 0;
}
/*-------------------- Movies --------------------*/
.movies {
display: flex;
padding: 8px 18px;
}
.movies .movie {
padding-right:10%;
cursor: pointer;
}
.movies .movie .poster {
width:11vw;
margin-bottom: 6px;
border-radius: 4px;
}
.movies .movie .poster.active {
opacity: 0;
}
.movies .movie .title {
color: #525661;
margin-bottom: 4px;
font-size: 16px;
}
.movies .movie .info {
font-size: .95vmax;
opacity: 0.8;
color: #8b9095;
font-family: 'Roboto', sans-serif;
}
.movies .movie .desc {
display: none;
}
/*-------------------- Detail --------------------*/
.detail {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
padding: 37px 30px 30px 255px;
display: none;
}
.detail::before {
content: '';
background: #fff;
position: absolute;
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 15px;
opacity: 0;
transition: all 0.4s cubic-bezier(0.67, 0.13, 0.1, 0.81);
}
.detail .close {
position: absolute;
top: 21px;
right: 22px;
width: 12px;
height: 12px;
cursor: pointer;
border: 6px solid #fff;
box-sizing: content-box;
z-index: 10;
}
.detail .poster {
position: absolute;
z-index: 2;
top: -10%;
left: -6%;
height: 100%;
border-radius: 5px;
box-shadow: 0 5px 30px rgba(0, 0, 0, .2);
transition: all 0.5s cubic-bezier(0.67, 0.13, 0.1, 0.81);
}
.detail .title, .detail .info, .detail .desc, .detail .play, .detail .close {
transform: translateX(-50px);
opacity: 0;
transition: all 0.4s cubic-bezier(0.67, 0.13, 0.1, 0.81);
}
.detail .close {
transform: translateX(10px);
}
.detail .title {
font-size: 3vmax;;
font-weight: 300;
color: #525661;
margin-bottom: 5px;
}
.detail .info {
font-size: .95vmax;
opacity: 0;
margin-left: 2px;
color: #8b9095;
font-family: 'Roboto', sans-serif;
}
.detail .desc {
text-align: left;
margin-top: 30px;
font-size: 1.25vmax;
line-height: 1.6;
text-align: left;
color: #8b9095;
font-family: 'Roboto', sans-serif;
}
.detail .play {
background: linear-gradient(90deg, #e4761f, #ff8b32);
border: none;
border-radius: 20px;
color: #fff;
font-size: 12px;
line-height: 1.5;
padding: 8px 17px;
margin: 30px 0 0 -2px;
text-transform: uppercase;
z-index: 10;
outline: none !important;
cursor: pointer;
opacity: 0;
}
.detail .play svg {
vertical-align: middle;
position: relative;
top: -2px;
margin-right: 3px;
}
.detail.ready::before {
opacity: 1;
}
.detail.ready .info {
opacity: 0.8;
}
.detail.ready .poster {
opacity: 1;
transition-duration: 0.5s;
}
.detail.ready .title, .detail.ready .info, .detail.ready .desc, .detail.ready .play, .detail.ready .close {
transform: translateX(0);
opacity: 1;
transition-delay: 0s;
transition-duration: 0.5s;
}
.detail.ready .title {
transition-delay: 0.2s;
}
.detail.ready .info {
transition-delay: 0.3s;
}
.detail.ready .desc {
transition-delay: 0.4s;
}
.detail.ready .play {
transition-delay: 0.5s;
}
.the-most {
position: fixed;
z-index: 1;
bottom: 0;
left: 0;
width: 50vw;
max-width: 200px;
padding: 10px;
}
.the-most img {
max-width: 100%;
}
JS
var $play = $('.play'),
$detail = $('.detail'),
$movie = $('.movie', $detail),
$close = $('.close');
$('.movies .movie').click(function(){
$movie.html($(this).html());
$play.appendTo($movie);
$poster = $('.poster', this).addClass('active');
$('.poster', $detail).css({
top: $poster.position().top,
left: $poster.position().left,
width: $poster.width(),
height: $poster.height()
}).data({
top: $poster.position().top,
left: $poster.position().left,
width: $poster.width(),
height: $poster.height()
})
$detail.show();
$('.poster', $detail).delay(10).queue(function(next) {
$detail.addClass('ready');
next();
}).delay(100).queue(function(next){
$(this).css({
top: '-10%',
left: '-6%',
width: 266,
height: 400
});
next();
})
})
/*--------------------
Close
--------------------*/
function close(){
console.log('asd');
$p = $('.detail .poster');
console.log($p)
$p.css({
top: $p.data('top'),
left: $p.data('left'),
width: $p.data('width'),
height: $p.data('height'),
})
$detail.removeClass('ready').delay(500).queue(function(next){
$(this).hide();
$poster.removeClass('active');
next();
});
}
$close.click(close);
$('body').click(function(e){
$p = $(e.target).parents();
if ($p.is('.app')){
return false;
} else {
close();
}
})
/*--------------------
Thumbnail preview
--------------------*/
setTimeout(function(){
$('.movie:eq(0)').click();
}, 300);
setTimeout(function(){
close();
},1700);
//popup trailer
$(document).ready(function() {
$('.popup-youtube').magnificPopup({
type: 'iframe'
});
});
//---------------Mobile--------------
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}
Codepen Demo
| d651b9d7f6954eeaaed942c8954c9af8609434673e2d58d3323700710818f6a9 | ['509c207efe3b47f2bb0e281b6dc36c1b'] | My CSS code for table is overriding the bootstrap datepicker.It doesn't look anything like a calendar. How can i fix this?
I tried using css ":not" which unfortunately did not work.
I do not know what else to try.
I also tried to change them to classes and try which did not work as well.
Is there anyway to ignore the the css file for this element only or make bootstrap css !important?
Please check the demo with running code.
Thanks.
Codepen Demo
CSS Code of the table
/*Table*/
body{
background-color:black;
color:white;
}
table:not(.form-control) {
font-family: "Open Sans", sans-serif;
border: 1px solid salmon;
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
table-layout: fixed;
}
table caption {
font-size: 1.5em;
margin: .5em 0 .75em;
}
table tr:not(.form-control) {
background-color: #0B0C10;
border: 1px solid #0B0C10;
padding: .35em;
}
table th:not(.datepicker),
table td:not(.datepicker) {
padding: .625em;
text-align: center;
}
table th:not(.datepicker-days) {
font-size: .85em;
letter-spacing: .1em;
text-transform: uppercase;
}
@media screen and (max-width: 600px) {
table {
border: 0;
}
table caption {
font-size: 1.3em;
}
table thead {
border: none;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
table tr {
border-bottom: 3px solid salmon;
display: block;
margin-bottom: .625em;
}
table td {
border-bottom: 1px solid salmon;
display: block;
font-size: .8em;
text-align: right;
}
table td<IP_ADDRESS>before {
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
}
Codepen Demo
|
3f6c0899134de89ea5f41a8b5091c46a0cf8ee49bfbf735afc01699a6838dcf3 | ['50a000bd2fcb4d909ee836733d640902'] | You can set the Music directory (and all its files and sub-directories) to have 775 permissions, so that the owner of the files, and anyone in the same group can do anything they want to the files. Then the next trick is to make a new group with whatever name you want (e.g. share) and chgrp the Music directory (and all its files and sub-directories) to the new group. Now you just have to make sure that users that you to grant read/write access to the shared files are in the "share" group. If you need to make this work with other computers just take care that the share group has the same numeric ID in all the computers and you'll be fine.
| 3e71e85aa7c8fd3eae02ffb3a536c0af788e74bbd27da034d4b703a870fb0b51 | ['50a000bd2fcb4d909ee836733d640902'] | You don't say what the problem is. I assume that the command fails.
There are several things to note:
resize only works if the new size is bigger than the existing size. Note that size is the size of the virtual disk and not the size of the image file. By default it's specified in MB.
you have to use absolute paths with the vboxmanage tool. That is, you have to specify the complete path to the files being modified.
If you are trying to resize that image file you should go to /Applications/VirtualBox.app/MacOS and run VBoxManage from there like so:
VBoxManage modifyhd /myusername/VirtualBox\ VMs/Windows\ 98/Windows98.vdi --resize 1000
PS: Like <PERSON> said you must escape spaces with \ on Unix-like OSes
|
90f16c3f9cdc6964fde79bae485d7b36efe73ce87ef9f0abb2882675608ba921 | ['50c4706fd3a943ac9eef2822ce629efb'] | When retrieve a record from database , it retrieve object, but How to know is a Empty Object which no data retrieved ...
object(Illuminate\Database\Eloquent\Collection)#243 (1) { ["items":protected]=> array(0) { } }
this is empty object retrieved from database .. How to check if this Empty or Not ... via PHP methods or something like that !!
| 7e7d3b1c3510e0a884cc454174dc6b2624ccead174c08b79a3d4bd862b355cdd | ['50c4706fd3a943ac9eef2822ce629efb'] | Simply , Hard link : is just add new name to a file, that's mean , a file can have many name in the same time, all name are equal to each other, no one preferred, Hard link is not mean to copy the all contents of file and make new file is not that, it just create an alternative name to be known..
Symbolic link (symlink) : is a file pointer to another file, if the symbolic link points to an existing file which is later deleted, the symbolic link continues to point to the same file name even though the name no longer names any file.
|
08b6992eb45c1d32de11f453803602b9b181cc15372cf8c85497487705522d1d | ['50c68b16fffd480b8faa27802abe589e'] | Have tried to follow this tutorial Laravel show last reply left on post, was working but now returns on some threads with this error here
Trying to get property 'author' of non-object (View: /var/www/html/web/resources/views/forums/board.blade.php)
This is my code used:
<h1>{{$board->name}}</h1>
@auth
<a role="button" href="{{route('forums.thread.create', $board->id)}}" class="btn btn-primary">Create Thread</a>
@endauth
@foreach($board->threads->sortByDesc('pinned') as $thread)
<div class="thread-box {{$thread->pinned ? '' : 'bg-light'}} p-3 mt-3" style="background-color: #eee;">
<a href="{{route('forums.thread.show', $thread->id)}}" class="text-decoration-none">
<img src="{{$thread->author->avatar}}" alt="User Avatar" style="max-height: 40px;" class="rounded-circle">
<span>
{{$thread->name}}
</span>
</a>
@if(!$thread->pinned)
@else
<div class=" d-inline lock">
<i class="fas fa-thumbtack"></i>
</div>
@endif
@if(!$thread->locked)
@else
<div class=" d-inline lock">
<i class="fas fa-lock"></i>
</div>
@endif
<hr>
@if($thread->replies)<p>Last Update: <img src="{{$thread->replies->sortBydesc('id')->first()->author->avatar}}" alt="User Avatar" style="max-height: 40px;" class="rounded-circle"> <b>{{$thread->replies->sortBydesc('id')->first()->author->username}}</b></p>@else<p>No New Activity</p>@endif
</div>
@endforeach
</div>
@endsection
Was working before like I said, but does not seem to work anymore. Any ideas?
| e5e6837b5597c95bb00db6f0b293018beec70e21c4d3d2b1db64231a8f543745 | ['50c68b16fffd480b8faa27802abe589e'] | I am trying to get my application to sign in with Google using a function and without using Google's pre built button, but using GIDSignIn.sharedInstance().signIn(). However, it is wanting to set the view first but I can't as I am using SwiftUI without Storyboards.
I have defined a gLog() function in a class called auth() stored as authC, I then call authC.gLog() upon pressing a button in my view, however it has a thread issue and responds with this error here: Thread 1: "presentingViewController must be set."
View File (SwiftUI):
//
// ContentView.swift
// maraki-rev1
//
// Created by <PERSON> on 25/10/20.
//
import SwiftUI
// base page name
var pageName: String = "Welcome"
var authC = auth()
struct ContentView: View {
var body: some View {
VStack{
Text(verbatim: data.userFirst)
.font(.title)
.multilineTextAlignment(.center)
Text("Please Log In Below")
.padding()
HStack{
Button(action: {
authC.gLog()
}) {
Text("Log In with Google")
.padding()
}
Button(action: {
authC.aLog()
}) {
Text("Log In with Apple")
.padding()
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Class File that contains glog() and the auth() class.
//
// authContent.swift
// maraki-rev1
//
// Created by <PERSON> on 26/10/20.
//
import Foundation
import Firebase
import GoogleSignIn
import SwiftUI
class auth {
// google auth login
func gLog(){
GIDSignIn.sharedInstance().signIn()
}
func aLog(){
print("hello with apple")
}
}
There is nothing else on line that can help and their are a lack of tutorials surrounding my issue, so I appreciate all answers and comments on this question.
Thanks once again, <PERSON>.
|
d52d8b25bc7964aee9bc71ef04e12849e8330e3df7891b1df073b6a5d8ddfc12 | ['50cc11cdff1e42ccb7a7d3b7bd428260'] | So I messed up several ways. I did not understand the declarative way to establish inheritance. Nothing in my example actually was an "object". Second, order appears to matter. The object classes seem to need to appear before their children. Third, the injector class needs to include both sides of the classes to be injected.
class DefaultRgx(object): # Dependency injection service
def __init__(self, options):
self.options = None
def mtr_options(self, options, out):
mtr_result = ['Do stuff the old way']
return mtr_result
class MtrRun(DefaultRgx): # Dependency injection client
def __init__(self, host, count, options):
self.count = count
self.host = host
self.options = options
def mtr_module(self, host, count, options):
mtr_result = super().mtr_options(options, out)
return mtr_result
class MtrOptions(DefaultRgx): # Dependency injection interface
def mtr_options(self, options, out):
mtr_result = ['I was injected instead of DefaultRgx']
return mtr_result
class Injector(MtrOptions, MtrRun): # Dependency injection injector
pass
def main():
mtr = Injector(os.getenv('HOST'), os.getenv('COUNT'), None)
mtr_result = mtr.mtr_module()
This linted correctly. I have not run it yet, but conceptually that YouTube really helped things click. Thank you so much.
| 2f226980b35e32c5fe40959f8c3b3e0302bc7908cff248e865f90bde5a878244 | ['50cc11cdff1e42ccb7a7d3b7bd428260'] | I am trying to learn the concept of "dependency injection" in Python. First, if anyone has a good reference, please point me at it.
As a project I took the use case of changing logic and formatting based on options passed to the linux command "mtr"
The dependency client class is MtrRun. The initial dependency injection service is DefaultRgx (I plan to add a couple more). The injection interface is MtrOptions. And the injector class is just called Injector.
class MtrRun(MtrOptions): # Dependency injection client
def __init__(self, MtrOptions, options, out):
self.MtrOptions = MtrOptions
self.options = options
self.out = out
def mtr_options(self, options, out):
return self.MtrOptions.mtr_options(options, out)
class DefaultRgx(MtrOptions): # Dependency injection service
def __init__(self, options):
self.options = None
def mtr_options(self, options, out):
pass # code abbreviated for clarity
class MtrOptions(): # Dependency injection interface
def __init__(self, svc):
self.svc = svc
def mtr_options(self, options, out):
return self.svc.mtr_options(options, out)
class Injector(): # Dependency injection injector
def inject(self):
MtrOptions = MtrOptions(DefaultRgx())
mtr_result = MtrRun(MtrOptions)
This snippet will not clear a lint. My IDE claims that the MtrOptions class passed into the injection client and service are not defined. When I try to resolve it, a new MtrOptions class is created, but the error persists. I am certain I just don't know what I am doing. Conceptually I admit a weak grasp. Help is appreciated.
|
407104fbfe36cde5274c6f7a1774320599cc305e93a20c0981daa1681d41ed8c | ['50d1270c14b04fba84587a0020f444d6'] | Consegui com a seguinte solução
Code behind
protected void Unnamed1_Click(object sender, EventArgs e)
{
var ss = hdnResultValue.Value;
//PopularGrid();
}
javascript
function setHiddenField() {
debugger;
var DropdownList = document.getElementById("dpdCidades");
var SelectedValue = DropdownList.value;
document.getElementById('hdnResultValue').value = SelectedValue;
//alert(SelectedValue);
}
Default.aspx
<asp:Button Text="Pesquisar" runat="server" ID="lblPesquisar" OnClick="Unnamed1_Click" OnClientClick="setHiddenField()"/>
| ceace4d9953d65f4ba630256e8b6d46a9c6e567499c669eec5b66714b691bf22 | ['50d1270c14b04fba84587a0020f444d6'] | I'm writing a basic little forums web app (for fun and to sharpen the ole' saw), and I'm having a bit of trouble with AppSettings.
My plan is to have these settings in their own file (Settings.config), to which I will grant modify permissions to the web process user account, and store all editable settings in this file (e.g. forum title, description, etc).
This is my code:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(FormCollection collection)
{
try
{
var config = WebConfigurationManager.OpenWebConfiguration("~/Web.config");
config.AppSettings.Settings["SiteTitle"].Value = collection["SiteTitle"];
config.AppSettings.Settings["SiteDescription"].Value = collection["SiteDescription"];
config.Save(ConfigurationSaveMode.Minimal, false);
ConfigurationManager.RefreshSection("appSettings");
return RedirectToAction("Index");
}
catch (Exception ex)
{
ModelState.AddModelError("_FORM", ex.Message);
return View("Index");
}
}
...but running it returns the following error:
A configuration file cannot be created for the requested Configuration object.
I've tried granting full permission to all users to the settings file, with no effect (I'm currently just running under Cassini, so the process user is me who has ownership of the file in any case).
Any ideas?
|
799836ef2fce5b3502153a993ffa0995e40247d6fc0ba5d7e19a9af205bce370 | ['50dada3edde64303aace00ac011c67ff'] | What if you do something like this:
public class CustomerCollection: Collection<Customer>
{
public CustomerCollection: : base(new List<Customer>())
{}
public static IList<Customer> FindCustomers()
{
//return them from DAL
}
}
Using List in your constructor will let you use useful's methods in List in your class without the need to write your own implementation.
| 8274e27626ff883d6ab797126d551495fd5d7d3d4084d82d61fb4c5897e7876e | ['50dada3edde64303aace00ac011c67ff'] | When I copy a large file (100+mb) to a remote server using scp it slows down from 2.7 mb/s to 100 kb/s and downward and then stalls.
The problem is that I can't seem to isolate the problem. I've tried 2 different remote servers, using 2 local machines (1 osx, 1 windows/cygwin), using 2 different networks/isps and 2 different scp clients. All combinations give the problem except when I copy between the two remote servers (scp).
Using wireshark I could not detect any traffic volume that would congest the network (although about 7 packets/sec with NBNS requests from the osx machine).
What in the world could be going on? Given the combinations I've used there doesn't seem to be any overlap in the thing that could be causing the trouble.
|
20be8587d5f6da4bc28eea00bf2bd10bce025e9728f4c190c9143bdca40714e4 | ['50e25edbd50943b897563ae94e4355e1'] | To reiterate <PERSON>'s point, the best home desktop I've ever had I bought in 2011 and while there is a price discrepancy with newer comparisons I'm making, it performs on par with anything I've had since (for all practical applications I need - not gaming or heavy graphical work). Biggest changes are almost exclusively in efficiency. P.S. I'm excluding 20+ core processors as an advancement because very little software can make use of them effectively. | 9f772fd509ee1998aaddfe323e8909f835ef6ab18dcf55472a65dc5c9faf6735 | ['50e25edbd50943b897563ae94e4355e1'] | @mrswadge I had this happen again recently. In my case I think the cause was creating the Chrome window while in a Remote Desktop session from home, then logging into the workstation when I got back to work. Because Remote Desktop uses a different system font than my system default, closing that Chrome window messed with Chrome's defaults somehow. |
b4e8e99f5217145c553d4c6852d7213296845b23020429779c496ca4500321f6 | ['50e91ec3201349c9aa17be32984cb4b0'] | when i try to mount, it says `rishi@rishi:~$ sudo mount -t vfat /dev/sdb1 /media/usb
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so` | 52d1696b09c240603012a693a4509d6bef740ecca7f434cfbdef771ebc0b9497 | ['50e91ec3201349c9aa17be32984cb4b0'] | I have ubuntu 16.04 in my laptop. I don't like the look and feel of gnome-terminal.
See this screenshot i want change the title bar of tab name and add tab button and view tabs button at the right end. All of them ruining the look and feel of a terminal. I want them to be like in ubuntu 14.04. Ubuntu 14 gnome-terminal screenshot below.
http://ubuntuhandbook.org/wp-content/uploads/2015/07/terminal-tabs.jpg
|
8618815fc64560741c6d2314cefff1b45230b588339aef3cbe2fb62306324193 | ['50ea472b78214e5894d0dcf2b0dfcc50'] | To make sure that the current object's members are used. Cases where thread safety is a concern, some applications may change the wrong objects member values, for that reason this should be applied to the member so that the correct object member value is used.
If your object is not concerned with thread safety then there is no reason to specify which object member's value is used.
| 5e59bbe5b982f6cb2398bca5272ae569f8459f8f502c8771c3fb93b0421adfd2 | ['50ea472b78214e5894d0dcf2b0dfcc50'] | <PERSON>, I ended up answering my own question, but descriptions can in some cases be enough to imply a formula. For instance if I tell you that all members of a population has the same probability of reproducing per unit time, and that the probability of an individual reproducing is the same for each unit of time that the individual lives, and there is no immigration to the population, emigration from the population, or death in the population, then I have given enough information to indirectly tell you the type of equation describing the relationship between time and population size. |
f805830c5f75e64bac1e42dfa98625e9fb01c066fd9386561207b768459d8cac | ['50ea4cf3331b47afb6079f81b844f3bd'] | How do you show and hide divs in Angular (4 thru 9) upon a user selecting an option(s) in a dropdown select?
My code below is only showing one/the same div no matter the option I select.
public Terminated = true;
public Release = true;
selectedFilter:string;
public filterTypes = [
{value:'empty', display:''},
{value:'release', display:'Release Report'},
{value:'reports', display:'Detail Report'},
{value:'terminated', display:'Terminated Report'},
];
constructor() {
this.selectedFilter='release';
}
filterChanged(selectedValue:string){
if(this.selectedFilter) {
this.Terminated = false;
} else {
this.Release = false
}
<select class="form-control" (change)="filterChanged($event.target.value)">
<option *ngFor="let type of filterTypes" [value]="type.value">{{type.display}}
</option>
</select>
<div [hidden]="Terminated"><p>terminated content here</p></div>
<div [hidden]="Release"><p>release content here</p></div>
| a918cdf6e4aee2b0eb2fff52e78e140ce9412c5b213bb942e4751ee1379625ba | ['50ea4cf3331b47afb6079f81b844f3bd'] | I have numerous buttons on a page. Each is related to its own separate div on the page. When button 1 is clicked div 1 is shown. When button 2 is clicked div 2 is shown and so on.
What's the best way to write the following jQuery below, so I don't have to keep writing a new function for every new button and new div that will need to be added?
$("#bio-1").click(function () {
$('.one').toggle();
});
$("#bio-2").click(function () {
$('.two').toggle();
});
$("#bio-3").click(function () {
$('.three').toggle();
});
$("#bio-4").click(function () {
$('.four').toggle();
});
|
437df63ed370eea7da603a129235404ac4959e43e9530487d85112fbc04e5bbf | ['50f9eedf67e2403e91b7c964b68b075c'] | The log line still shows up because that line is logged by ActiveRecord, not Delayed Job. See the github bug report for more info on that. Here's a workaround:
in config/initializers/delayed_job_silencer.rb:
if Rails.env.development?
module Delayed
module Backend
module ActiveRecord
class Job
class << self
alias_method :reserve_original, :reserve
def reserve(worker, max_run_time = Worker.max_run_time)
previous_level = ::ActiveRecord<IP_ADDRESS>Base.logger.level
::ActiveRecord<IP_ADDRESS>Base.logger.level = Logger<IP_ADDRESS>WARN if previous_level < Logger<IP_ADDRESS>WARN
value = reserve_original(worker, max_run_time)
::ActiveRecord<IP_ADDRESS><IP_ADDRESS>ActiveRecord::Base.logger.level
<IP_ADDRESS>ActiveRecord::Base.logger.level = Logger::WARN if previous_level < Logger::WARN
value = reserve_original(worker, max_run_time)
<IP_ADDRESS>ActiveRecord::Base.logger.level = previous_level
value
end
end
end
end
end
end
end
| 11e0281f4fcd9fdb66bfda1242aadc1956a83eda7308965fb4972ee050cd4582 | ['50f9eedf67e2403e91b7c964b68b075c'] | You need to use different connections to the database in your threads. First, disconnect the main thread, then reconnect in each thread, and finally reconnect in the main, like so:
ActiveRecord<IP_ADDRESS>Base.connection.disconnect!
(0..1).each do |index|
threads << Thread.new do
ActiveRecord<IP_ADDRESS>Base.establish_connection
# ...
end
end
ActiveRecord<IP_ADDRESS>Base.establish_connection
There are other problems in testing that way: You have no guarantee of the point where concurrency happens. The ruby GIL will also not help. You should use forks instead of threads, or use the fork_break gem: https://github.com/remen/fork_break
|
f1253406174fa4a47b82cebb079d8cb4c565d1bd7a030cb135b5f485be97a8e1 | ['510f0b8082cf4af996f5b445da30c6d7'] | Here is an example to count the occurrence of distinct values in an array.
var a = ["toto","tata","toto","foo","foo","bar","foo","toto","tata","toto"];
var countPerValue = {};
a.map(function(i) {
if (!countPerValue[i]) countPerValue[i] = 0; // init counter to 0 for this value
countPerValue[i]++;
});
console.log(countPerValue); // {toto: 4, tata: 2, foo: 3, bar: 1}
console.log(countPerValue["foo"]); // 3
| 58fa8a68fbb84653b71fa413397d2c04bbc26e332ce4d2c60227fa7b381bc421 | ['510f0b8082cf4af996f5b445da30c6d7'] | To address multiple screen sizes, you can use css media queries as they are designed for that purpose.
Media queries let you adapt your site or app depending on the presence
or value of various device characteristics and parameters.
They are a key component of responsive design. For example, a media
query can shrink the font size on small devices, increase the padding
between paragraphs when a page is viewed in portrait mode, or bump up
the size of buttons on touchscreens.
Note that you may encounter a popular issue dealing with width. You can easily find solutions online.
$(window).width() not the same as media query
|
818482f9f405edc4d5d0e92e7d564b43e671d433b919d43293c5f50cab687b7f | ['511a77e8827e43dcbea497bde4883c8f'] | If some of these aren't working out for you, I was looking for a similar thing for vivaldi, and managed to do it combining some things here and others in another post
xdotool windowactivate $(xdotool search --class vivaldi | tail -1) key ctrl+r windowactivate $(xdotool getactivewindow)
you can add other key - keyvalue combinations after the first one
| ea3164376cad679dc685937480f774a5af9e0b159cf9708eb33c6fe25170d249 | ['511a77e8827e43dcbea497bde4883c8f'] | I'm trying to use Apache StringUtils stripAccents() method to remove accents from characters, and isntead of doing that it outputs question marks in place of accented letters.
Example: <PERSON> is converted to ?dam instead of <PERSON>. I'm using Scala version 2.12.3
Has anybody had this issue?
|
a31de74063f90a0548f29c964126ef2d392932fada6917be8309cf7537b0045a | ['511c680e7efc4b1a9af3833d76c4e9fd'] | Estou começando os estudos com SVG e tentando compreender um exemplo não consigo executá-lo corretamente, foram demonstradas as partes HTML/CSS/JS e eu fiz a conexão dessas partes, porém não funcionou... Se alguém puder me falar o que estou fazendo errado seria de muita ajuda:
<html>
<head>
<title>Exemplo Teste</title>
<style>
.meu-circulo {
r: 30;
cx: 50;
cy: 40;
fill: lightgreen;
stroke: orange;
stroke-width: 5;
transition: all 1s ease;
}
.meu-circulo:hover {
cx: 70;
fill: green;
stroke-width: 10;
}
</style>
<script>
const circle = document.querySelector('.meu-circulo');
let r = 30;
circle.addEventListener('click', () => {
r += 10;
circle.style.r = r;
})
</script>
</head>
<body>
<svg>
<circle class="meu-circulo"></circle>
</svg>
</body>
</html>
| d9ad88b6514fe4233c138560e31f4d5464bc6cb294b38e2a043e70106cf0b897 | ['511c680e7efc4b1a9af3833d76c4e9fd'] | I marked an Artboard to be exported (as PNG, also tried PDF) to be exported to InVision and then syncing the Sketch file via the Craft plugin. I was expecting the Artboard to show up in the assets of the InVision prototype. But they are not. Any help on this? Or are full Artboards only exportable manually?
Is there anything else I might have forgotten?
|
0ee94ab840853a3e1ee7dd2bbc3bd7e899b254f78dae411ebae200d609e3df4c | ['5121632eaf644f62b9584c989cde3da4'] | Directly from the firebase docs here is reads:
Change the engines value from 8 to 10 in the package.json file that
was created in your functions/ directory during initialization.
(this is locally on your computer)
... the entry should look like this: "engines": {"node": "10"}
Redeploy using your Firebase CLI (v8.1+) and you should be good to go.
| c8ba3d15ecd0dec2bb466c6d3c2bd90d0d26f5deacfe00532683846fc9837a11 | ['5121632eaf644f62b9584c989cde3da4'] | To what extent do Chrome Extensions mirror Chrome Apps? I understand that Chrome Apps are being deprecated, so wondering if the docs are inconsistent.
Extensions and Apps are similar in many ways, however for your situation the main hurdle to overcome is the two handle Google Authentication differently. Extensions have permission limitations, where javascript can't run in certain places. Therefore, Chrome Extensions use chrome.identity in background.js to establish a secure connection and token. The general process to implement it is as follows:
Make a Chrome Extension, zip it, upload to your Google Dev account & get extensionID#
In Google API Console, register an OAuth ClientID# using the extensionID#
Update your Chrome Extension manifest to include an 'oauth2' section with the OAuth ClientID# as well as the scopes you allow, and include 'identity' under "permissions:"
Enable the API of your choosing in the Google API Console and generate a key. Include this key in your background.js file so you can use the API.
Is it possible to do this without packaging and uploading my app? The Oauth credentials page in Console asks for a Web Store URL
No, mainly because you need both the chrome extension and the API to be aware of each other and be 'linked' in a sense so they can be secure and work properly. You can still have a private app however, as you only need to package (.zip it) and upload it into your Developer Dashboard, and you can leave it out of the public Chrome Store by simply not publishing. It can forever linger in 'Draft' stage for your personal use.
Is it acceptable to store a copy of Google's api.js in my extension, or must I load it from https://apis.google.com/js/client.js? If so,
For the Chrome App Sample, Where do I get the key included in manifest.json? I've seen instructions like "Copy key in the installed manifest.json to your source manifest" but I don't understand.
You don't need to store a copy within your extension, you can add the following to your manifest.json:
"content_security_policy": "script-src 'self' https://apis.google.com/; object-src 'self'"
and then this at the bottom of your popup.html:
<script src="https://apis.google.com/js/client.js?onload=onGAPILoad"></script>
It's a rather confusing process without a guide; here is the one that finally made sense of it all for me. This official example from Google is a good one as well.
Is anyone aware of a complete, self-contained Chrome Extension sample?
'self-contained' is a bit tricky here, as the manifest needs to reference keys specific to the OAuth ClientID and API that YOU are utilizing, however this (download link) along with the two links above should be enough to get you to a working extension.
|
88e24a8c80b358ae9256fba6953e80c11b85a16c942f612ffd6a1aace3978d20 | ['51230be1b70a4f95af997bb66b00accc'] | As Castile (at the time Spain) I had the same problem. I had maxed out all of my buildings in my Europe territories. I got around the problem by constantly building a better navy. My force limit for the navy was 600 and I barely hit 300. I simply had the poor Iberian Peninsula building ships 7 days a week, 24 hours a day. At the end of it, I had too many light ships so I sent them to Bordeaux, The Channel, Genoa, and Venice to steal everyone's money. But after that I couldn't spend the rest of my money so I just decided to go to war with everyone to take their colonies in the new world (so I don't have to deal with them afterwards) I also decided to build 8 colonies at a time to secure the new world
| fe982969c9fdf757afa76723e712f7c7b8f43607797eb51d6920b1a3cf9a53cf | ['51230be1b70a4f95af997bb66b00accc'] | A point particle is technically something with zero size, i.e. an object with zero dimensions. Where as normal objects occupy some length, area or volume depending on their dimensionality, a point particle is something that is said to exist at a specific point. So when we treat the object as a point particle we pretend it exists at a single point in space (but keeps its properties such as mass). It is merely a simplification to ease our calculations. |
fe2018f82781a66a9e886c6fb2b71b4d1da47972500225af156ab2d991921735 | ['51363db4f7b64bfbbd6c5b4a6f5f525c'] | I trying to make a simple app in node and I have this as model:
var mongoose = require("mongoose");
var jobs = new mongoose.Schema({
jobNumber: Number,
jobField: String,
jobTitle: String,
jobCity: String,
jobArea: String,
jobAddress: String,
jobPhone: String,
jobInsurance: String,
jobSalary: Number,
jobAccommodation: String,
jobDescription: String,
author: {
id: {
type: mongoose.Schema.Types.ObjectId,
ref: "User"
},
username: String
},
created: {
type: Date,
default: Date.now
}
});
//EXPORT
module.exports = mongoose.model("jobs", jobs);
and for router i have this:
//SHOW OWNED JOBS
router.get("/myjobs", function (req, res) {
jobs.find({},function (err, myjobs) {
if (err) {
res.send(err);
} else {
res.render("filteredJobs", {
datas: myjobs
});
}
});
});
I can find some data by jobs.find{salaryJob : "900"} but if I want to find data by parameters of author how does it work?
I try several time like this but it doesn't work!
//SHOW OWNED JOBS
router.get("/myjobs", function (req, res) {
jobs.find({author.username : "blackcat"},function (err, myjobs) {
if (err) {
res.send(err);
} else {
res.render("filteredJobs", {
datas: myjobs
});
}
});
});
thank you
| 41bd5168da52630c3109a33bd40dbd72d3a4284a233d146153c6cccbc48f969d | ['51363db4f7b64bfbbd6c5b4a6f5f525c'] | I get user query information when use req.user at first time but in second inside function I got cannot read property user of null.
router.post("/orders", function (req, res) {
console.log(req.user);//here I can see user info!
orders.count({
customerInfo: req.user//here I can get user info!
}, function (req, count) {
if (count > 0) {
console.log(count);
orders.findOne({
customerInfo: req.user//here:cannot read property user of null
}, function (err, orders) {
products.findOne({
_id: req.body.id
}, function (err, products) {
if (err) {
console.log(err);
} else {
orders.productInfo.push(products);
orders.save(function (err, data) {
if (err) {
console.log(err);
} else {
console.log(data);
}
});
}
});
});
}
|
09aa4886c20ce57d60edff4fcbd471c8337dfe8f97ead920cd52ebf9f64c0b6a | ['5141a4fe8e984ea9959ad3ecfe39d161'] | This older (6 yrs) thread on Perlmonks still seems like a good response to this question, in my opinion.
http://www.perlmonks.org/?node_id=782340
Basically, if you have a fax server that has some more or less straightforward method of communicating with it programmatically (like HylaFax) then you can use Perl to interact with it in a familiar way.
If that is not the case then your best answer is to seek out an external program and perhaps automate that, if possible. The "external program" is what you need in order to take care of the many fiddly issues involved with dialing the number, negotiating with the receiver, and so on.
One example of an external program to send faxes is OpenOffice
http://www.linuxjournal.com/content/faxing-openofficeorg
Finally, there is fax4j in Java which you could try and use with Inline<IP_ADDRESS>Java, which is kind of cheating in the sense that it is just barely a Perl solution.
http://sourceforge.net/projects/fax4j/
http://search.cpan.org/dist/Inline-Java/Java.pod
If any of this matches something that you can try out in your environment go ahead and then post back in more detail if you run into trouble implementing.
| c5d0a62fcae0b436a09c0fdf9f50934179b7b65fbbfd4013cc9c422f55a52107 | ['5141a4fe8e984ea9959ad3ecfe39d161'] | I have a JBoss application which has Oracle DB based password authentication using org.jboss.security.auth.spi.DatabaseServerLoginModule. This application is running on the older community edition jboss-6.1.0.Final. I would like to throttle failed login attempts.
I figure that these may come in a couple of ways:
A username which exists in the database has repeated failed password attempts
Attempts are made with usernames (likely machine generated) that do not exist in the database
I am currently only concerned with (2).
This server is behind a reverse proxy, which would make tracking the IPs attempts come from difficult.
After a few fruitless hours of Googling I am none the wiser about how to implement logic whereby, in the case of (2), the failed attempts may be logged and some sort of lockout takes place. Another thought I had was that maybe a lockout isn't necessary, and instead implement some sort of CAPTCHA system. Again, I find no good resources on how to implement this within my current authentication scheme.
What are the suggested practices to deal with this?
|
505fd18a754c724d41a6570768ba10154d78341e6022d91f470ec7990306a932 | ['514979f23b854e3b902ff1380ec4ea1b'] | Your problem is not actually related to arduino in any way. This tutorial is utilizing onboard USB->UART transceiver IC. So in theory you could even remove Atmel chip from the board. Its more like using module like this FT232 converter. Anyways sorry if I confused you but you can research the subject.
But anyways to the problem. Couple of questions:
Did you press reset button on module while powerin up the circuit?
Thats the way it enters to AT command mode
Did you try to reverse RX-TX lines, don't worry connecting these guys across eatch other doesn't harm your board.
(They are so often plugged in wrong..)
Did you make sure you have connected EN pin of module also. (To arduino 3.3V not 5V)
Did you triple check all connections
Try to upload simple Sketch like blinky to Arduino to make sure you are connected to USB-UART transeiver and you have correct drivers.
Make sure you upload empty sketch or remove the chip when you try to apply tutorial steps.
Change jumper wires. Sometimes cheap jumper wires are really bad quality.
I have been sometimes scratching head for long time because of broken jumper cable.
Please let me know if you have checked all of those so we can think for next step.
| 21e49ff253dd662dc3f322b4ca12423a13c3130e20e6745ef7ccf660641a9ce0 | ['514979f23b854e3b902ff1380ec4ea1b'] | Here is my two cents to help you but please take all in this solution with grain of salt because this solution might contain some stupid stuff...
Maybe you can pick parts or at least learn something how not to do from this one.
Example is for 0-10 for easier testing... change them how you like by changing MAXVALUE and MINVALUE definitions / constant strings to match those...
Good luck and have a nice day.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ncurses.h>
// PREDEFINED VALUES FOR DEFINING NON CHANGING VALUES IN CODE THIS CASE
#define WINDOWHEIGHT 20
#define WINDOWWIDTH 60
#define WINDOWSTARTX 0
#define WINDOWSTARTY 0
#define CORRECT 1
#define INCORRECT 0
#define START 2
#define WRONGFORMAT 3
#define MAXVALUE 10
#define MINVALUE 0
// PREDEFINED VALUES FOR DEFINING NON CHANGING VALUES IN THIS CASE
// initialising global structure for saving amount of right and wrong guesses and number to compare with.
struct game {
int rightGuesses;
int wrongGuesses;
int rightNumber;
} myGame;
void initializeGame()
{
// Returns a pseudo-random integer between 0 and MAXVALUE.
int randomNumber = rand() % MAXVALUE;
myGame.rightGuesses=0;
myGame.rightNumber=randomNumber;
}
WINDOW *create_newwin(int height, int width, int starty, int startx)
{
WINDOW *local_win;
local_win = newwin(height, width, starty, startx);
box(local_win, 0, 0);
wrefresh(local_win);
return local_win;
}
int getGuess()
{
int guess=0;
char guessString[32];
scanf("%s", guessString);
// Read number as string by using scanf, but convert to int for comparison with atoi()
guess= atoi(guessString);
size_t allowedEntries = strspn(guessString, "0123456789");
// Some checking if guess was between allowed range + its a number + checking if answer is correct or not
if(guess>=MINVALUE && guess<=MAXVALUE && guessString[allowedEntries] == '\0')
{
if(guess==myGame.rightNumber)
return CORRECT;
else
return INCORRECT;
}
else
return WRONGFORMAT;
}
/**
Function for updating views regarding the input values...
**/
void updateWindowTexts(WINDOW* window, int state)
{
char* greetingsString = "Guess the correct number!";
char* instructionsString = "Enter number 0-10 and press enter";
char* correctGuess = "That was correct! Lets play again";
char* incorrectGuess = "Sorry that was not right";
char* wrongFormat = "incorrect number, please enter number between 0-10";
char* correctAnswersString = "Correct answers:";
char correctAnswers[32];
char wrongAnswers[32];
const char rightAnswersBase[] = "Right numbers so far: ";
sprintf(correctAnswers, "%s%d", rightAnswersBase, myGame.rightGuesses);
const char wrongAnswersBase[] = "Wrong numbers so far: ";
sprintf(wrongAnswers, "%s%d", wrongAnswersBase, myGame.wrongGuesses);
wclear(window);
box (window, 0, 0);
mvwprintw (window, 1, (WINDOWWIDTH/2)-(strlen(greetingsString)/2), greetingsString);
mvwprintw (window, (WINDOWHEIGHT-3), (WINDOWWIDTH/2)-(strlen(correctAnswers)/2), correctAnswers);
mvwprintw (window, (WINDOWHEIGHT-2), (WINDOWWIDTH/2)-(strlen(wrongAnswers)/2), wrongAnswers);
mvwprintw (window, (WINDOWHEIGHT/2), (WINDOWWIDTH/2)-(strlen(instructionsString)/2), instructionsString);
switch (state) {
case START:
break;
case CORRECT:
mvwprintw (window, WINDOWHEIGHT-5, (WINDOWWIDTH/2)-(strlen(correctGuess)/2), correctGuess);
myGame.rightGuesses++;
break;
case INCORRECT:
mvwprintw (window, (WINDOWHEIGHT-5), (WINDOWWIDTH/2)-(strlen(incorrectGuess)/2), incorrectGuess);
myGame.wrongGuesses++;
break;
case WRONGFORMAT:
mvwprintw (window, (WINDOWHEIGHT-5), (WINDOWWIDTH/2)-(strlen(wrongFormat)/2), wrongFormat);
break;
}
wrefresh (window);
}
int main (int argc, char **argv)
{
WINDOW *my_win;
initscr();
// Here we call crea_newwin to make new window, paremeters are static and defined at the top of file
// You can try to play with these numbers
my_win = create_newwin(WINDOWHEIGHT, WINDOWWIDTH, WINDOWSTARTY, WINDOWSTARTX);
// Initialization of random generator, should only be called once.
srand(time(NULL));
initializeGame();
// Update window once before enteringing loop
updateWindowTexts(my_win,START);
while(1)
{
updateWindowTexts(my_win,getGuess());
}
return 0;
}
|
8e21584b29040bf4f0c868ca1ca1b3db365f98c6ec90b248364c6a8df1de2312 | ['514a4ca25ea94aa2a53e4fd12e3e0c2b'] | OK so I'm writing a tally counter app and I'm trying to get a button to add to a text view.
Right now I have a variable named count set equal to 0. What I want to do is make it so that whenever I press a button count is updated to count + 1, and then the new count is displayed in my text view.
This is the code I have for it right now but once I press the button once it goes to 1 and stays there.
txtView.setText(Integer.toString(count +1));
| 4cf18779b8c4d7e60a76997274fe438e1a8f8784b0318b1ee3295b89d18cf20f | ['514a4ca25ea94aa2a53e4fd12e3e0c2b'] | I have a database that stores the count of a tally and a name associated with that tally, I've gotten the list view to display the tally count but I can't figure out how to display the name as a sub item.
Here is my code so far.
public class SavedScreen extends ListActivity {
TallyDB db = new TallyDB(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_saved_screen);
List<TallyCount> allTallyCounts = db.getAllTallyCounts();
int listSize = allTallyCounts.size();
String[] adapter = new String[listSize];
int i=0;
for (TallyCount tallyCount:allTallyCounts) {
tallyCount.getTally();
tallyCount.getTallyCount();
adapter[i++]=tallyCount.toString();
}
setListAdapter(new ArrayAdapter<String>(this, R.layout.activity_saved_screen, R.id.txtTemplate, adapter));
}
}`
I'm not very good at this yet so forgive me if it's simple. I tried putting a second adapter and for loop to display the name but I must've done it wrong.
|
e86a5459b6a61b837edd2ba3b07475f2a529dd3cf96baad5ce38d249ba2f0d07 | ['5160a4db2e914a8c8e5d481c04fb0c94'] | Ok, I was able to add a case to handle this functionality. Going off the un-minified current version (2.7.8) around line 390 you should see a conditional like so:
if( cMin.id() == target.id() ){
var rPath = reconstructPath( source.id(), target.id(), cameFrom, [] );
rPath.reverse();
return {
found: true,
distance: gScore[ cMin.id() ],
path: eles.spawn( rPath ),
steps: steps
};
}
I added a separate case for handling passing in filters that match multiple items immediately following it:
//if there was a filter passed in, check the array of ids matching that to see if cMin.id() is in there
if (is.string( options.goal ) && this.filter( options.goal ).map(function(item){return item.id()}).indexOf(cMin.id()) > -1 ) {
var rPath = reconstructPath( source.id(), cMin.id(), cameFrom, [] );
rPath.reverse();
return {
found: true,
distance: gScore[ cMin.id() ],
path: eles.spawn( rPath ),
steps: steps
};
}
The key two changes are the if condition (obviously) and that rPath takes the current cMin.id() as the destination, instead of target.id().
Anyway, it works for my use case! Hope it's useful to someone else.
| 15b37384f70d0871d5e3c7f6758c8420fcd05e7da9c1ee909dd65a8788d02545 | ['5160a4db2e914a8c8e5d481c04fb0c94'] | It appears that compound nodes don't obey layouts if they have connections between other parents, but children do not have connections. Best way to show is to modify their DAGRE example:
http://jsbin.com/gist/e52c2fbc0b09edd6ec46?html,output
by replacing their data with this:
elements: {
nodes: [
{"data":{"id":"SimpleTest"}},
{"data":{"id":"child1","parent":"SimpleTest"}},
{"data":{"id":"child2","parent":"SimpleTest"}},
{"data":{"id":"subParent1"}},
{"data":{"id":"terminal0_socket","parent":"subParent1"}},
{"data":{"id":"subParent2"}},
{"data":{"id":"terminal1_socket","parent":"subParent2"}},
{"data":{"id":"terminal0"}},
{"data":{"id":"terminal1"}}
],
edges: [
{"data":{"source":"SimpleTest","target":"subParent1"}},
{"data":{"source":"SimpleTest","target":"subParent2"}},
{"data":{"source":"terminal0_socket","target":"terminal0"}},
{"data":{"source":"terminal1_socket","target":"terminal1"}}
]
},
The links from the children to unparented nodes are honored by the layout, but the links between SimpleTest and the two sub-parents are not.
I've tried running the layout on just the parents by assigning classes and passing layout() the sub-Graph and then just running grid on the remaining nodes, but that doesn't appear to work either.
Is there an example somewhere of how to handle this case? It appears in the two examples on their website (unless I'm mistaken) they're manually setting position for parents.
The only workaround I can see is to add dummy links between children to get the layout to run, and then filter them from the graph / hide them afterwards, but I feel like there's a way to do this I'm not seeing...
Thanks!
|
d8989447b4ab02c0c7da3e9a71ec4d4936d9b0f6840ecda5c3a7428e0f7e04a8 | ['516d4b283ea64676b65b128233bc9c60'] | Estoy intentando que al enviar un formulario me envie los datos al backend para así poder crear una nueva estancia en la base de datos.
El caso es que no me da ningún error, y me muestra el alert de que se ha hecho correctamente, pero no se crea en la base da datos, no se si es que no estoy tratando los datos bien en el controlador o como, la query funciona correctamente porque he probado a añadir la estancia de forma hardcoedada y funciona.
El formulario es el siguiente:
<form id="formCountry">
<div class="modal fade" id="addPaisModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Afegeix País</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="agreementCode">Nom</label>
<input type="text" name="nomPais" class="form-control" id="nomPais" placeholder="Nom país">
</div>
<div class="form-group">
<label for="agreementStudies">Programa</label>
<select name="programaPais" class="form-control" id="programaPais">
<?php foreach ($programs as $program): ?>
<option>
<?php echo $program->codiPrograma;?>
</option>
<?php endforeach;?>
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary">Tanca</button>
<button type="submit" name="submit" value="Submit" id="addCountry" class="btn btn-primary">Guarda</button>
</div>
</div>
</div>
</div>
</form>
Al darle al botón submit mediante jquery lo envío por post al backend (los 2 alerts me muestran los valores correctamente):
$(document).on("submit", "#formCountry", function(e) {
e.preventDefault();
var data = new FormData;
data.append("programaPais", $("#programaPais").val());
data.append("nomPais", $("#nomPais").val());
alert($("#programaPais").val());
alert( $("#nomPais").val());
$.ajax({
type: "POST",
url: "admin.php/updateTableCountries",
data: data,
processData: false,
contentType: false,
success:function(t,e,c){
alert("Pais creat correctament!");
$("#addPaisModal").modal('hide');
},
error: function(e, a, t) {alert("Error al crear el pais!");}
});
})
Controlador (sigo arquitectura MVC):
case 'updateTableCountries':
$data= $_POST['data'];
array_push($parameters, $data);
$actionName = $controller;
break;
Función:
public function updateTableCountries($parameters){
require 'models/CountriesModel.php';
$countriesModel = new CountriesModel();
$data = $parameters[0];
$countriesModel->addCountry($data['programaPais'],$data['nomPais']);
$countriesModel->disconnect();
}
Query:
public function addCountry($codiPrograma,$nomPais){
try {
$consulta = $this->db->prepare("INSERT INTO pais(codiPrograma,nomPais) VALUES (?,?)");
$consulta->execute(array($codiPrograma,$nomPais));
} catch (Exception $e) {
$obj = $e;
}
}
Alguna idea de que puede pasar?
| a2b12c298e05bdcc92a4ec3e29d911fba79790fbac66c210101971e8829e0948 | ['516d4b283ea64676b65b128233bc9c60'] | @A.Cedano Es porque en la web hay bastantes URLS que redirijen a paginas webs de universiades del mundo y el objetivo es facilitar al administrador de la web aquellas URLs que ya no existen porque se han modificado, entonces la idea es testear estas URLS y mostrar por pantalla aquellas que ya no funciona para que sepa donde se encuentran de la web y poderlas borrar |
0d05699d1066d1575ccc830b443b59916688398392bb5e05531c75d4424ef496 | ['517d2927e6814a148723d72546f76f4e'] | 'Boolean given' suggests the return value from your fopen is the value false, so your attempt to open /dev/ttyACM0 for reading failed.
You should check to see if your handle is valid after the fopen before trying to use it
$handle = fopen ('/dev/ttyACM0', "r"); // ouverture du flux
if ($handle) {
while (fread($handle, 1) != chr(2));
...
}
As for why? Perhaps the location doesn't exist or you do not have permission or maybe something else has it open with an exclusive lock.
| 4fad7b93d8e42b8ea2f1e42b5705f387d8e5c0a98a1d1e212be3bd500d9dce7d | ['517d2927e6814a148723d72546f76f4e'] | It's the right way, although in your case, given the application is one of the passed parameters, you could just call
app.IdleTimerDisabled = true;
I see you're calling
base.FinishedLaunching(app, options);
at the end of your function - I don't use xamarin but it occurs to me that maybe this call is setting it back to false, so you could try calling that first and then setting it to true after:
base.FinishedLaunching(app, options);
app.IdleTimerDisabled = true;
return true;
|
c29b3b59a8411122889bc2f296a910a884639c1068242ea877bab591708d6783 | ['518244f5b54d45aab1c11fd18915c338'] | I was curious to know how a SimpleXMLElement object was formed in PHP from an XML document, but I think there might be something in this process that is unknown to me.
When we loop through an object in PHP, the public properties are iterated over. So if the first property is an array, then we should need another loop inside our first loop to iterate over it, however, it doesn't seem to be the case about a SimpleXMLElement object. Look at this object for instance:
object(SimpleXMLElement)#1 (1) {
["user"]=>
array(5) {
[0]=>
object(SimpleXMLElement)#2 (3) {
["firstname"]=>
string(6) "Sheila"
["surname"]=>
string(5) "Green"
["contact"]=>
object(SimpleXMLElement)#7 (3) {
["phone"]=>
string(9) "1234 1234"
["url"]=>
string(18) "http://example.com"
["email"]=>
string(18) "<EMAIL_ADDRESS><PERSON>"
["surname"]=>
string(5) "Green"
["contact"]=>
object(SimpleXMLElement)#7 (3) {
["phone"]=>
string(9) "1234 1234"
["url"]=>
string(18) "http://example.com"
["email"]=>
string(18) "pamela@example.com"
}
}
[1]=>
object(SimpleXMLElement)#3 (3) {
["firstname"]=>
string(5) "<PERSON>"
["surname"]=>
string(5) "Smith"
.
.
.
It contains a "user" property in which there's an array(of 5 elements). So when we loop through this object, we should get this error:
Notice: Array to string conversion in ...
I've tested this in this snippet:
$var = (object)array(
'user'=>['joe','mia'],
);
Now this loop gives the error I just mentioned above:
foreach ($test as $property => $val){
echo $property.':'.$val.'<br>';
}
| c6ab65695a4d89a1d1af0bc347a508c434ad5df1a65e5941f2c309133bb92fe1 | ['518244f5b54d45aab1c11fd18915c338'] | Alright, no port 80, no Skype blame! My problem was indeed quite simple(&silly),
I had an extra backslash (\) (on Windows) after the path I'd specified for the DocumentRoot directive, so I made a change like this and the problem is gone like a duck soup.
My index.php was in the path "D:\websites\dummy" and my httpd.conf was like this:
<VirtualHost <IP_ADDRESS>:80>
ServerName dummy.local
DocumentRoot "D:\websites\dummy\" #mistake here
</VirtualHost>
<Directory "D:\websites\dummy\"> #mistake here
Require all granted
</Directory>
So just change those two lines like this:
#first mistake fix:
DocumentRoot "D:\websites\dummy"
#second (similar) mistake fix:
<Directory "D:\websites\dummy">
...and everything's fine now. To prevent such mistakes in future, always copy the path of any folder you want to refer to instead of typing it yourself.
|
18abd5c946ad2363aad554c8346639c5375a440ee6448546352c2f2995f29989 | ['5187cad311874d2cb3ca3cff9a24f86d'] | I have an aurora MySQL table with about 4.5 billion records. I am trying to migrate it to another environment. I am trying to dump it using MySQL dump functionality and then restore it from the dump file. But it seems to dump the data only partially. about 420k records. Any reason why this is happening.
I searched the internet high and low. But nobody seems to have faced this issue.
Any suggestion on how to migrate thi?
| 08408cca9d70df20512dfff16d328956dd66d3fb0634c27958c294cc45b029fe | ['5187cad311874d2cb3ca3cff9a24f86d'] | I am trying to export data from a table to excel file.
I am using the select ... INTO ... file method to do so. I am getting the error
Error Code: 1290 The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
The output of below query is NULL.
SHOW VARIABLES LIKE "secure_file_priv";
In the post below, staza resolved the issue by adding LOCAL> But their issue was while working with importing csv to MySQL while mine is exporting from MySQL to csv. Is there any "LOCAL" equivalent for the export issue?
How should I tackle --secure-file-priv in MySQL?
Thanks in advance!!
|
ef97018c0b0782c190bbf7db66e82069ed5e103e1b8a118aaa4f7092464a42d5 | ['5189d6c6194c473892bd5e63b145aad5'] | Something like the code below? I assumed the desk number are on column A sheet1 starting at row 2. You will need to adjust the end rows for both sheet though.
Sub MoveRowBasedOnCellValue()
Dim s1 As Sheet1
Set s1 = Sheet1
Dim s2 As Sheet2
Set s2 = Sheet2
Dim s1StartRow As Integer
Dim s1EndRow As Integer
Dim s2StartRow As Integer
Dim s2EndRow As Integer
s1StartRow = 2
s1EndRow = 8
s2StartRow = 2
s2EndRow = 10
Application.ScreenUpdating = False
For i = s1StartRow To s1EndRow
For j = s2StartRow To s2EndRow
If s1.Cells(i, 1) = s2.Cells(j, 1) Then
s1.Range("B" & i & ":Q" & i).Copy
s2.Cells(j, 2).PasteSpecial xlPasteAll
Application.CutCopyMode = False
End If
Next j
Next i
Application.ScreenUpdating = True
End Sub
| c2bf2a1ce1cf351d1f9b509de4ae2f487a4a95f168c76032894eaf0c2d03ae46 | ['5189d6c6194c473892bd5e63b145aad5'] | I think this is the code you need. Just replace the names in it and this is inside the userform.
Private Sub OptionButton1_Click()
countOptions
End Sub
Private Sub OptionButton2_Click()
countOptions
End Sub
Private Sub OptionButton3_Click()
countOptions
End Sub
Private Sub OptionButton4_Click()
countOptions
End Sub
Private Sub UserForm_Initialize()
CommandButton1.Enabled = False
End Sub
Sub countOptions()
Dim cntrl As Control
Dim Count As Integer
Count = 0
For Each cntrl In UserForm1.Controls
If TypeOf cntrl Is msforms.OptionButton Then
If cntrl = True Then
Count = Count + 1
End If
End If
Next
If Count >= 2 Then
CommandButton1.Enabled = True
End If
End Sub
|
426e49bca8a17368950bd41ca60ca88456c655dec0e0623dee550ab80423bb24 | ['51c077f8e99e45bb8e5d859dd8870e5a'] | Verify input'$var' to empty() function
empty($var)
Returns FALSE if var exists and has a non-empty, non-zero value.
Otherwise returns TRUE.
The following things are considered to be empty:
"" (an empty string) 0 (0 as an integer)
0.0 (0 as a float) "0" (0 as a string) NULL FALSE array() (an empty array) $var; (a variable declared, but without a value)
http://php.net/manual/en/function.empty.php
| 12e5b2b808e56167ed4748417472ca7a2d5e2491828fb20fc6965b4bd4d431ce | ['51c077f8e99e45bb8e5d859dd8870e5a'] | I need to change background color of single cell in table using java script.
During document i need style of all cell should be same ( so used style sheet to add this. ) , but on button click i need to change color of first cell.
following is the sample code
<html lang="en">
<head>
<script type="text/javascript" >
function btnClick()
{
var x = document.getElementById("mytable").cells;
x[0].innerHTML = "i want to change my cell color";
x[0].bgColor = "Yellow";
}
</script>
</head>
<style>
div
{
text-align: left;
text-indent: 0px;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
}
td.td
{
border-width : 1px;
background-color: #99cc00;
text-align:center;
}
</style>
<body>
<div>
<table id = "mytable" width="100%" border="1" cellpadding="2" cellspacing="2" style="background-color: #ffffff;">
<tr valign="top">
<td class = "td"><br /> </td>
<td class = "td"><br /> </td>
</tr>
<tr valign="top">
<td class = "td"><br /> </td>
<td class = "td"><br /> </td>
</tr>
</table>
</div>
<input type="button" value="Click" OnClick = "btnClick()">
</body>
</html>
|
deadc5628dcd4285dba1910ee637a74c3b4de8a85412b39f65e9f092ded673c8 | ['51c20306634e4400b812c6de60d6514b'] | Yes it does get freed.
You can check this by using:
function a() {
$var = "Hello World";
$content = "";
for ($i = 0; $i < 10000; $i++) {
$content .= $var;
}
print '<br>$content size:'.strlen($content);
print '<br>memory in function:'.memory_get_usage();
return null;
}
print '<br>memory before function:'.memory_get_usage();
a();
print '<br>memory after function:'.memory_get_usage();
output:
memory before function:273312
$content size:110000
memory in function:<PHONE_NUMBER>
memory after function:273352
Before the function PHP used 273312 bytes.
Before the function was finished we checked the memory usage again and it used <PHONE_NUMBER>.
We checked the size of $content which is 110000 bytes.
273312 + 110000 = <PHONE_NUMBER>
The remaining 208 bytes are from other variables (we only counted $content)After the function was finished we checked the memory usage again and it was back to (almost (40 bytes difference)) the same as it was before.
The 40 bytes difference are likely to be function declarations and the for loop declaration.
| e8f93391a9cdf2841f3e1fe16d01ef31c29d3dcbf272276a54bf59f832c56783 | ['51c20306634e4400b812c6de60d6514b'] | Porbably not, Vulkan API is an Graphics Library much like OpenGL.
Where in Linux Ubuntu OpenGL is used for animation effects of the desktop in Unity and could be replaced with Vulkan for better performance.
But I don't think Windows will change it as they have their own DirectX Graphics Library and would be weird if they use something else instead their own software.
The most applications that are going to benefit from Vulkan are Games and other software that uses either 2D or 3D rendering.
It's very likely that most of the games are going to change to Vulkan because it's Cross-platform and therefore they will gain more users which equals to more profit.
Khronos (Vulkan API developers) are also bringing out tools that will largely port your application from OpenGL or DX12 to Vulkan therefore requiring less development/porting from the software developers side.
So...
Window creation, likely. (Although the code behind the window is CPU side, the library that draws the window on screen might be using Vulkan) - this differs greatly from which OS, distribution and version you are working on.
Mouse/keyboard events, no as this doesn't require any graphical calculations but CPU calculations.
|
d10bcc66a0522327b767ef303ed86b199ab5ce0ae77b30149194093454091d57 | ['51c45f27b01a4bb88f75fab5677d59af'] | I have timerange strings like the following example:
"10:00 AM - 8:00 PM"
I know we're always going to be dealing with EST.
I'm looking for a simple way of handling parsing this so that I can check if "now" is within the time range.
My initial thought is I need to do a string split on the "-", trim the strings, and then use simpledateformat to take "10:00 AM" and "8:00 PM" into time objects. From there I would check if "now" is after 10am, and before 8pm.
My thought is there might be a simpler method in a java library to handle all of this and return a boolean true/false. Does anyone have suggestions?
Thanks in advance!
| bed1edcbccd790fd34585e7f5dd5d74a377083397447715b44d9251a6eea991d | ['51c45f27b01a4bb88f75fab5677d59af'] | So I'm working on a project where I take in an image from either gallery or camera and get a series of statistics from the image (brightness, contrast, sharpness, etc). Currently I have this working from gallery. I can open gallery, pull an image, and if a face is detected it will be cropped in a 2nd imageview. The stats are gathered from the cropped image ( see showimage(bitmap) in the gallery button area ). I've been struggling for the last week trying to get the same thing to work from the camera.
I'm currently using the following open source projects for getting the image from gallery and for cropping the face from the image:
https://github.com/hanscappelle/SO-2169649
https://github.com/lafosca/AndroidFaceCropper
I've made some advancements, and then backtracked a lot because I think I was trying to do it wrong. Here is my current working code for JUST gallery:
public class MainActivity extends AppCompatActivity {
// this is the action code we use in our intent,
// this way we know we're looking at the response from our own action
private static final int SELECT_SINGLE_PICTURE = 101;
public static final String IMAGE_TYPE = "image/*";
/* Get the reference to the text label */
TextView label = null;
private ImageView selectedImagePreview;
private ImageView imageViewFace;
void showImage(Bitmap image)
{
/* Get the starting time */
long startTime = 0;
startTime = System.nanoTime();
/* Get the image statistics */
ImageStats imageStats = new ImageStats(image);
System.out.println("Execution time: " + (((double)(System.nanoTime() - startTime))/1000000000.0) + " seconds!");
/* Get the image statistics */
double[] stats = imageStats.getStats();
/* Decide whether or not the image is of good quality */
String results = imageStats.result;
/* Create the labels */
String[] labels = new String[]{"Standard Luminosity: ", "Contrast: ", "Face orientation: ", "Sharpness: "};
/* The string of statistics */
StringBuffer strStatsBuff = new StringBuffer();
/* Go through all the statistics */
for(int statIndex = 0; statIndex < stats.length; ++statIndex)
{
/* Add the statistics */
strStatsBuff.append(labels[statIndex]);
strStatsBuff.append(String.valueOf(stats[statIndex]));
strStatsBuff.append("\n");
}
/* Add the file name */
strStatsBuff.append("\n");
strStatsBuff.append(results);
/* Set the label and show the cropped image */
label.setText(strStatsBuff.toString());
FaceCropper mFaceCropper = new FaceCropper();
mFaceCropper.setEyeDistanceFactorMargin(0);
image = mFaceCropper.getCroppedImage(image);
imageViewFace.setImageBitmap(image);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// no need to cast to button view here since we can add a listener to any view, this
// is the single image selection
label = (TextView)findViewById(R.id.label);
findViewById(R.id.buttonGallery).setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// in onCreate or any event where your want the user to
// select a file
Intent intent = new Intent();
intent.setType(IMAGE_TYPE);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
"Select image"), SELECT_SINGLE_PICTURE);
}
});
selectedImagePreview = (ImageView)findViewById(R.id.imageView1);
imageViewFace = (ImageView)findViewById(R.id.imageViewFace);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == SELECT_SINGLE_PICTURE) {
Uri selectedImageUri = data.getData();
try {
Bitmap bitmap;
selectedImagePreview.setImageBitmap(new UserPicture(selectedImageUri, getContentResolver()).getBitmap());
bitmap=BitmapFactory.decodeStream(getContentResolver().openInputStream(selectedImageUri));
showImage(bitmap);
} catch (IOException e) {
Log.e(MainActivity.class.getSimpleName(), "Failed to load image", e);
e.printStackTrace();
}
}
} else {
// report failure
Toast.makeText(getApplicationContext(),"failed to get intent data", Toast.LENGTH_LONG).show();
Log.d(MainActivity.class.getSimpleName(), "Failed to get intent data, result code is " + resultCode);
}
}
}
My "closest to working" method pulled an image from the camera, but both the original imageview and the imageview that should have been cropped to face both just showed the original image.
I had the following included under oncreate -
findViewById(R.id.buttonCamera).setOnClickListener(new View.OnClickListener(){
public void onClick(View arg0 ){
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
});
and this included in onactivityresult -
else if (requestCode==CAMERA_REQUEST && resultCode == RESULT_OK){
Bitmap bitmap = (Bitmap) data.getExtras().get("data");
selectedImagePreview.setImageBitmap(bitmap);
showImage(bitmap);
}
Welcome to any suggestions! If you need any more info or I haven't provided something obvious, let me know. I'm new to stackoverflow, java, and android. Thanks!
|
d2b1e5ef07ec7bca883053d9fa40c97132eef9bb46b67122da7fd3948edbb89a | ['51c6e02a9adf425495abcbe094379b8c'] | The best way (as per my knowledge) to inflate a row is as follows-
View v[i] = inflater.inflate(R.layout.row, null);
linear.addView(v[i]);
This v returns the inflated view in row.xml. hence we can access Button as
photoButton[i]=(Button) v[i].findViewById(R.id.button1inInflatedRow);
Where I was wrong---
I was using
View v[i] = inflater.inflate(R.layout.row, linear);
this V[i] is the parent layout an hence i couldnt access button through
(Button) v[i].findViewById(R.id.button1inInflatedRow)
| bd38843031045b90642646a140e03337a41bb6c71edbf91f44a48d484854ad58 | ['51c6e02a9adf425495abcbe094379b8c'] | I am using camera intent to take photo. But I am getting to big image on Imageview.
My problem is--
1.I want full sized image (Which I am getting using putExtra(), )
2.But due to this My imageview size is increasing.
3. Main problem is , Image captured is 90 degree roteted..
My code is as follow.
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
try
{
// place where to store camera taken picture
tempPhoto = createTemporaryFile("picture", ".png");
tempPhoto.delete();
}
catch(Exception e)
{
return ;
}
mImageUri = Uri.fromFile(tempPhoto);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, mImageUri);
startActivityForResult(cameraIntent, 6);
and in onActivityResult---
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
ContentResolver cr = getApplicationContext().getContentResolver();
Bitmap photo=null;
if (resultCode == RESULT_OK) {
try {
photo = android.provider.MediaStore.Images.Media.getBitmap(cr, Uri.fromFile(tempPhoto));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ImageView imageView = (ImageView)this.findViewById(R.id.imageView1);
imageView.setImageBitmap(photo);
}
I am trying to get small image using
//Bitmap photo = (Bitmap) data.getExtras().get("data");
this causing null pointer Exception..
How to resolve the problem?
|
67bcff7db4b6b92cb6966da37bacfeda5bbcd19a0f28cce3bcfeea2041282efe | ['51f12b1266ff4505af080ed319c8273c'] | Basically I need to render an object into a react component. It looks something like this:
var obj = {
prop1: "prop1",
prop2: "prop2",
prop3: "prop3",
}
I just want to print out both the property name and the value, and to do so I am using map, which currently looks something like this:
render(){
return(
<div>
{Object.keys(obj).map(function(data, key){
return (<div>{data}</div>);
})}
</div>
);
}
The thing is, the way I have it, I am only able to render the property name, I have tried a few ways to access the property's value, but so far nothing works.
How can I do this?
| 6e74b64ca13c5a01af46ea1f720046e1e4bff03432d047fa760d3f1132d28366 | ['51f12b1266ff4505af080ed319c8273c'] | I want to find some entries in my DB through the createdAt column, but just using the date. I am using postgres and the createdAt is a timestamptz. Here is an example of what an entry in it looks like: 2019-02-27 20:17:07.05+00
This is what the setting of my query looks like:
const dateString = momentDate.format('YYYY-MM-DD')
query.createdAt = { $iLike: `%${dateString}` }
Unfortunately this is not working and I am getting the following error:
retry-as-promised:error SequelizeDatabaseError: operator does not exist: timestamp with time zone ~~* unknown
Is the issue perhaps because I am using a string? What is the right way to query by date?
|
59e16680bdd101853bae59eac12374b32644e5b15089d7aaefe747b301dfb42c | ['52037e999a594aef89a3728eb21ec45f'] | I am using a 2008 MegaRAID SAS 8888ELP. I was unable to boot into webbios, although I was able to install storcli onto my arch linux setup. The raid works well although I am new to using raid and storcli.
Currently, when I run storcli /c0 show this is the result:
Controller = 0
Status = Success
Description = None
Product Name = MegaRAID SAS 8888ELP
Serial Number = P037780510
SAS Address = 500605b001d4afa0
PCI Address = 00:01:00:00
System Time = 10/17/2016 21:02:12
Mfg. Date = 02/06/10
Controller Time = 10/17/2016 21:02:11
FW Package Build = 9.0.1-0038
FW Version = 1.20.42-0525
BIOS Version = 2.01.00
Driver Name = megaraid_sas
Driver Version = <PHONE_NUMBER>-rc1
Vendor Id = 0x1000
Device Id = 0x60
SubVendor Id = 0x1000
SubDevice Id = 0x1006
Host Interface = PCI-E
Device Interface = SAS-3G
Bus Number = 1
Device Number = 0
Function Number = 0
Total foreign drive groups = 0
Physical Drives = 3
PD LIST :
=======
-------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp
-------------------------------------------------------------------------
252:0 44 UGood - 1.999 TB SATA HDD N N 512B TOSHIBA DT01ACA300 U
252:4 46 UGood - 1.999 TB SATA HDD N N 512B ST4000DM000-1F2168 U
252:5 45 UGood - 1.999 TB SATA HDD N N 512B ST3000DM001-9YN166 U
-------------------------------------------------------------------------
EID-Enclosure Device ID|Slt-Slot No.|DID-Device ID|DG-DriveGroup
DHS-Dedicated Hot Spare|UGood-Unconfigured Good|GHS-Global Hotspare
UBad-Unconfigured Bad|Onln-Online|Offln-Offline|Intf-Interface
Med-Media Type|SED-Self Encryptive Drive|PI-Protection Info
SeSz-Sector Size|Sp-Spun|U-Up|D-Down|T-Transition|F-Foreign
UGUnsp-Unsupported|UGShld-UnConfigured shielded|HSPShld-Hotspare shielded
CFShld-Configured shielded|Cpybck-CopyBack|CBShld-Copyback Shielded
The size of the disks say 1.999 TB. If you look to the right a bit it describes the actual size of the disks. ST4000DM000 is a 4 TB drive, ST3000DM001 is a 3TB drive, and the toshiba is a 3TB.
Why does it show up as 2TB?
How can I tell the raid that they are larger drives?
Any storcli commands I can use to do this?
Thank you for all the help!
| 81b9b2efd41eb130eeb416d5e46007629f2df6de167da9255f89f86335afb15b | ['52037e999a594aef89a3728eb21ec45f'] | Well I've just finished installing it on my Mac - you have to watch out for the Python Platform under Tools and File. The default is Jython, but you want to change it to point to your python version in the Frameworks file of your Library.
Does that make sense?
|
7d08c9d596855826fbc500347beb0b8fa23151bd0f814d3a32163e53f598c5ef | ['521638758f644ecf9db714302c401109'] | public bool IsUser(string username)
{
bool user = false;
using (var client = new datingEntities())
{
var result = from x in client.Person
select x;
foreach (var item in result)
{
if (item.Username == username)
{
user = true;
}
}
}
return user;
}
This method am I using to get data from a SQL database that I have. It's no problem with the database connection, it's just that it always is returning false even if the parameter username is existing in the database (double checked the data in the database). I tried this method before and then it worked but it don't. I'm using entity framework against my database
| 542c6924e2bcfb2cad549bc8a291845d9cd7062e808e10aab61a1b23447179b1 | ['521638758f644ecf9db714302c401109'] | I'm using asp and have some textboxes where I want to set the value from code behind. The code below is wrapped inside an asp:DetailsView.
The Textbox I want to get and set value of is InsertItemTemplate with ID=strPositionsName
<asp:TemplateField HeaderText="Name" SortExpression="strPositionName">
<InsertItemTemplate>
<asp:TextBox ID="strPositionName" Width="380px" MaxLength="49" runat="server" Text='<%# Bind("strPositionName") %>'></asp:TextBox>
</InsertItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Textbox1" Width="380px" MaxLength="49" runat="server" Text='<%# Bind("strPositionName") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Width="380px" Text='<%# Bind("strPositionName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
I managed to get the value by:
var testName = ((TextBox)DetailsView1.FindControl("strPositionName")).Text;
So I tried using this:
((TextBox)DetailsView1.FindControl("strPositionName")).Text = "textboxvalue";
But it didn't work
|
541cd3de3b8382be40b59b6a33833ff4bafe513b08e95a0ec249e4939f6b6d54 | ['5226532280ce47518ba2562cb655f6da'] | I have created a method that returns a collection of strings, each containing a number.
public static IEnumerable<string> SeparateNumbers(string inputText)
{
var matches = Regex.Matches(inputText, "[0-9]{12}");
foreach (Match match in matches)
{
yield return inputText.Substring(match.Index, match.Length);
}
}
You would simply use it like this. I have also added a way to comma separate them again:
string inputText = "sdgsjglksdjgkl,512025151988,512025151988,512025151988,512025151988,512025151988,sdgsgd";
var separatedNumbers = SeparateNumbers(inputText)
.ToArray();
string numbersOnly = string.Join(',', separatedNumbers);
I hope this helps.
Edit:
The reason that it gives you this: System.Text.RegularExpressions.MatchCollection is because of the default implementation of the ToString method, it simply gives you the full name of the type (including namespaces).
Also, if you want it to match any amount of numbers up to 12, simply change the regex to [0-9]{1,12} as you did initially.
| 3830e9aa41ea34723e556ff31be38d8d10de29d9ae5d0287a813224d6d05aa29 | ['5226532280ce47518ba2562cb655f6da'] | I have made a download program in C#. It is a queue downloader.
You can see how it works here: Click Express Downloader
Is there any faster method to download?
Here is the method i use, it must support resume support.
private void Download(object startPoint)
{
try
{
try
{
//int startPointInt = Convert.ToInt32(startPoint);
Int64 startPointInt = Convert.ToInt64(startPoint);
webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.AddRange(startPointInt);
webRequest.Credentials = CredentialCache.DefaultCredentials;
webResponse = (HttpWebResponse)webRequest.GetResponse();
Int64 fileSize = webResponse.ContentLength;
strResponse = webResponse.GetResponseStream();
if (startPointInt == 0)
{
strLocal = new FileStream(txtPath.Text + "\\" + filename, FileMode.Create, FileAccess.Write, FileShare.None);
}
else
{
strLocal = new FileStream(txtPath.Text + "\\" + filename, FileMode.Append, FileAccess.Write, FileShare.None);
}
int bytesSize = 0;
byte[] downBuffer = new byte[4096];
while ((bytesSize = strResponse.Read(downBuffer, 0, downBuffer.Length)) > 0)
{
strLocal.Write(downBuffer, 0, bytesSize);
this.Invoke(new UpdateProgessCallback(this.UpdateProgress), new object[] { strLocal.Length, fileSize + startPointInt });
if (goPause == true)
{
break;
}
}
}
catch { }
}
finally
{
strResponse.Close();
strLocal.Close();
}
}
|
a4f95fd991fe9efbc8c7283091aa69830225ab0de6cceeda2062291d9de2734d | ['522895175f01465284fde4e172906997'] | In the example of CX_Freeze, this is happening most likely because your build is missing one of the packages it requires. The reason it is opening the console window is because you didn't set the base to "Win32GUI". Once you do this, you'll get a dialog box which shows the error message and you can include that package in your "include" list.
Try:
#setup.py
from cx_Freeze import setup, Executable
setup(
name = "MainExe",
version = "1.0.0",
options = {"build_exe": {
'packages': ["ast","random","thread","time", "tkMessageBox", "Tkinter","os", "selenium"],
'include_files': ['smallblack.png','geckodriver','geckodriver.exe'],
'include_msvcr': True,
}},
executables = [Executable("main.py", base="Win32GUI")]
)
| d2ddef2c82e1244a71f1bf19465786faa42e8a418d727616540d4284176c0f14 | ['522895175f01465284fde4e172906997'] | I received a C++ project from a 3rd party and found how to get the CPU and Board Temp using C++. I then found this which I used to to help me mimic the C++ functions in python with ctypes, a lot of this code is copied directly from that repository. '\\.\AdvLmDev' is specific to the PC I was using, and should be replaced with '\\.\PhysicalDrive0'. There is also a function to get other CPU power measurements. I did this because I didn't want to use Open Hardware Monitor. You may have to run the code as administrator for it to work.
import ctypes
import ctypes.wintypes as wintypes
from ctypes import windll
LPDWORD = ctypes.POINTER(wintypes.DWORD)
LPOVERLAPPED = wintypes.LPVOID
LPSECURITY_ATTRIBUTES = wintypes.LPVOID
GENERIC_READ = 0x80000000
GENERIC_WRITE = 0x40000000
GENERIC_EXECUTE = 0x20000000
GENERIC_ALL = 0x10000000
FILE_SHARE_WRITE=0x00000004
ZERO=0x00000000
CREATE_NEW = 1
CREATE_ALWAYS = 2
OPEN_EXISTING = 3
OPEN_ALWAYS = 4
TRUNCATE_EXISTING = 5
FILE_ATTRIBUTE_NORMAL = 0x00000080
INVALID_HANDLE_VALUE = -1
FILE_DEVICE_UNKNOWN=0x00000022
METHOD_BUFFERED=0
FUNC=0x900
FILE_WRITE_ACCESS=0x002
NULL = 0
FALSE = wintypes.BOOL(0)
TRUE = wintypes.BOOL(1)
def CTL_CODE(DeviceType, Function, Method, Access): return (DeviceType << 16) | (Access << 14) | (Function <<2) | Method
def _CreateFile(filename, access, mode, creation, flags):
"""See: CreateFile function http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).asp """
CreateFile_Fn = windll.kernel32.CreateFileW
CreateFile_Fn.argtypes = [
wintypes.LPWSTR, # _In_ LPCTSTR lpFileName
wintypes.DWORD, # _In_ DWORD dwDesiredAccess
wintypes.DWORD, # _In_ DWORD dwShareMode
LPSECURITY_ATTRIBUTES, # _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes
wintypes.DWORD, # _In_ DWORD dwCreationDisposition
wintypes.DWORD, # _In_ DWORD dwFlagsAndAttributes
wintypes.HANDLE] # _In_opt_ HANDLE hTemplateFile
CreateFile_Fn.restype = wintypes.HANDLE
return wintypes.HANDLE(CreateFile_Fn(filename,
access,
mode,
NULL,
creation,
flags,
NULL))
handle=_CreateFile('\\\\.\\AdvLmDev',GENERIC_WRITE,FILE_SHARE_WRITE,OPEN_EXISTING,ZERO)
def _DeviceIoControl(devhandle, ioctl, inbuf, inbufsiz, outbuf, outbufsiz):
"""See: DeviceIoControl function
http://msdn.microsoft.com/en-us/library/aa363216(v=vs.85).aspx
"""
DeviceIoControl_Fn = windll.kernel32.DeviceIoControl
DeviceIoControl_Fn.argtypes = [
wintypes.HANDLE, # _In_ HANDLE hDevice
wintypes.DWORD, # _In_ DWORD dwIoControlCode
wintypes.LPVOID, # _In_opt_ LPVOID lpInBuffer
wintypes.DWORD, # _In_ DWORD nInBufferSize
wintypes.LPVOID, # _Out_opt_ LPVOID lpOutBuffer
wintypes.DWORD, # _In_ DWORD nOutBufferSize
LPDWORD, # _Out_opt_ LPDWORD lpBytesReturned
LPOVERLAPPED] # _Inout_opt_ LPOVERLAPPED lpOverlapped
DeviceIoControl_Fn.restype = wintypes.BOOL
# allocate a DWORD, and take its reference
dwBytesReturned = wintypes.DWORD(0)
lpBytesReturned = ctypes.byref(dwBytesReturned)
status = DeviceIoControl_Fn(devhandle,
ioctl,
inbuf,
inbufsiz,
outbuf,
outbufsiz,
lpBytesReturned,
NULL)
return status, dwBytesReturned
class OUTPUT_temp(ctypes.Structure):
"""See: http://msdn.microsoft.com/en-us/library/aa363972(v=vs.85).aspx"""
_fields_ = [
('Board Temp', wintypes.DWORD),
('CPU Temp', wintypes.DWORD),
('Board Temp2', wintypes.DWORD),
('temp4', wintypes.DWORD),
('temp5', wintypes.DWORD)
]
class OUTPUT_volt(ctypes.Structure):
"""See: http://msdn.microsoft.com/en-us/library/aa363972(v=vs.85).aspx"""
_fields_ = [
('VCore', wintypes.DWORD),
('V(in2)', wintypes.DWORD),
('3.3V', wintypes.DWORD),
('5.0V', wintypes.DWORD),
('temp5', wintypes.DWORD)
]
def get_temperature():
FUNC=0x900
outDict={}
ioclt=CTL_CODE(FILE_DEVICE_UNKNOWN, FUNC, METHOD_BUFFERED, FILE_WRITE_ACCESS)
handle=_CreateFile('\\\\.\\AdvLmDev',GENERIC_WRITE,FILE_SHARE_WRITE,OPEN_EXISTING,ZERO)
win_list = OUTPUT_temp()
p_win_list = ctypes.pointer(win_list)
SIZE=ctypes.sizeof(OUTPUT_temp)
status, output = _DeviceIoControl(handle, ioclt , NULL, ZERO, p_win_list, SIZE)
for field, typ in win_list._fields_:
#print ('%s=%d' % (field, getattr(disk_geometry, field)))
outDict[field]=getattr(win_list,field)
return outDict
def get_voltages():
FUNC=0x901
outDict={}
ioclt=CTL_CODE(FILE_DEVICE_UNKNOWN, FUNC, METHOD_BUFFERED, FILE_WRITE_ACCESS)
handle=_CreateFile('\\\\.\\AdvLmDev',GENERIC_WRITE,FILE_SHARE_WRITE,OPEN_EXISTING,ZERO)
win_list = OUTPUT_volt()
p_win_list = ctypes.pointer(win_list)
SIZE=ctypes.sizeof(OUTPUT_volt)
status, output = _DeviceIoControl(handle, ioclt , NULL, ZERO, p_win_list, SIZE)
for field, typ in win_list._fields_:
#print ('%s=%d' % (field, getattr(disk_geometry, field)))
outDict[field]=getattr(win_list,field)
return outDict
|
eed09a027d1e5b4f907e658a23f801a8a0c017a5b4a443bdd31c81fa81ff1c63 | ['522fa2d535ab44299769b1f5a222f81b'] | var isButtonOn = UserDefaults.standard.bool(forKey: "isButtonOn")
override func viewDidLoad() {
super.viewDidLoad()
activateButton(bool: isButtonOn)
customiseUI()
}
func activateButton(bool: Bool) {
isButtonOn = bool
UserDefaults.standard.set(isButtonOn, forKey: "isButtonOn")
UserDefaults.standard.synchronize()
likeButton.backgroundColor = bool ? UIColor(red: 0/255, green: 166/255, blue: 221/255, alpha: 1.0) : .clear
likeButton.setTitle(bool ? "unlike": "like", for: .normal)
likeButton.setTitleColor(bool ? .white : UIColor(red: 0/255, green: 166/255, blue: 221/255, alpha: 1.0), for: .normal)
}
| 641af8bbba57e32d4e08fd14555db419a098811707160c67c65a14e9b9c17bca | ['522fa2d535ab44299769b1f5a222f81b'] | I am trying to install cocoa-pods got this error in terminal. I have searched a lot and tried many solution which were available on stackoverflow but nothing work for me. Please help how can i get out of this problem..
$ sudo gem install cocoapods
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno<IP_ADDRESS>ECONNREFUSED: Connection refused - connect(2) (https://api.rubygems.org/specs.4.8.gz)
ED: Connection refused - connect(2) (https://api.rubygems.org/specs.4.8.gz)
|
5ca7bc918753a9ae254e9b95d66068039725f9cbefee1b51f26e18cb462ca582 | ['523d53fdde9c4a948d004255355bb33c'] | I have an application which is distributed without an installer. Just a .zip is given to the users which contains the .app structure of the application. The application is signed with a valid Developer ID and the .zip has been notarized successfully. When I run the security check with the the command spctl -a -vv -t execute the response is "accepted". However this doesn't seem to be a valid check because also old version of the application (without notarization) obtain the same response.
The problem is that when the .zip is downloaded this is flagged with the attribute com.apple.quarantine and when the user double click on the .app an error message is shown: The application MyApp.app can't be opened.
The only way to run the application is manually remove the flag and set the executable permission to the binary.
How can I avoid these manual steps without creating a .pkg of the application ?
Why Gatekeeper doesn't trust the application which is signed and notarized ?
| 8ea32db9bc17a5f7f35fab8936673e76c56a1b7bd270c4eb009bab6fc5eba020 | ['523d53fdde9c4a948d004255355bb33c'] | To generate a valid pairwise master key for a WPA2 network a router uses the PBKDF2-HMAC-SHA1 algorithm. I understand that the sha1 function is performed 4096 times to derive the PMK, however I have two questions about the process.
Excuse the pseudo code.
1) How is the input to the first instance of the SHA1 function formatted?
SHA1("network_name"+"network_name_length"+"network_password")
Is it formatted in that order, is it the hex value of the network name, length and password or straight ASCII?
Then from what I gather the 160 bit digest received is fed straight into another round of hashing without any additional salting. Like this: SHA1("160bit digest from last round of hashing") Rise and repeat.
2) Once this occurs 4096 times 256 bits of the output is used as the pairwise master key. What I don't understand is that if SHA1 produces 160bit output, how does the algorithm arrive at the 256bits required for a key?
Thanks for the help.
|
6d144acfe0f62500a8bc6338ab2653597539f669f8e3204635bd6968f940326e | ['523e4b02fab94aa7a2c19fc15940d81c'] | I'm creating a user profile that updates into a database using JQuery Post and I've just noticed that if I use the word can't in the textarea it uploads to the database as can/'t and reads that back on the profile. My request in the php looks like this:
$name = mysqli_real_escape_string($con, $_REQUEST["name"]);
$location = mysqli_real_escape_string($con, $_REQUEST["location"]);
$about = mysqli_real_escape_string($con, $_REQUEST["about"]);
So is there anything I can add to prevent a slash being added?
| 27d51663b471984eb0ff882232399c787763904706ab9ffdd4233272fac05a9e | ['523e4b02fab94aa7a2c19fc15940d81c'] | I've been messing about with this code for a few hours now and can't work out why it's not working. It's a profile update php page that is passed through JQuery and all seems to be fine except for it actually updating into the table. Here is the code I'm using:
session_start();
include("db-connect.php");//Contains $con
$get_user_sql = "SELECT * FROM members WHERE username = '$user_username'";
$get_user_res = mysqli_query($con, $get_user_sql);
while($user = mysqli_fetch_array($get_user_res)){
$user_id = $user['id'];
}
$name = mysqli_real_escape_string($con, $_REQUEST["name"]);
$location = mysqli_real_escape_string($con, $_REQUEST["location"]);
$about = mysqli_real_escape_string($con, $_REQUEST["about"]);
$insert_member_sql = "UPDATE profile_members SET id = '$user_id', names = '$name', location = '$location', about = '$about' WHERE id = '$user_id'";
$insert_member_res = mysqli_query($con, $insert_member_sql) or die(mysqli_error($con));
if(mysqli_affected_rows($con)>0){
echo "1";
}else{
echo "0";
}
All I get as the return value is 0, can anybody spot any potential mistakes? Thanks
|
a4fcf49a6f3b1a3434edfdaf54a7a240bd29dab0f9096085258fbf151aabb357 | ['524929922f3f44ca834f636884ecac36'] | Use list.reverse() to reverse your list so that you are starting from the end:
list= [1,2,3,4,5,6,7,8,9]
n=(3)
list.reverse()
def search(list,n):
for i in reversed(range(len(list))):
print(list)
if list[i] == n:
return True
return False
search(list,n)
| 5a94dc360b19a2f7e54ec6ff6a6c0298371d4e5e2a0a1955d2dff35fff38a4f9 | ['524929922f3f44ca834f636884ecac36'] | Here is one of my previous codes, you can change all the variable names to whatever you see fit.
s = input('Enter in a word or string.')
ret = ""
i = True # capitalize
for char in s:
if i:
ret += char.upper()
else:
ret += char.lower()
if char != ' ':
i = not i
print(ret)
I hope it works for you.
|
201175f33f11aa1c13fa8f4831cdfc50d5a3174d38196857ee4a54d163a79add | ['5249d605cfc74fd38a7ac49d7897b9a6'] | Just after water began to fill the tank, lower switch will then be **OFF (or OPENED)**. At that time, the upper switch's status is **ON (or CLOSED)** (since the water inside the tank began drained). Just immediately after the pump filling water up to the tank, the lower switch will be **OFF (OPENED)** but upper switch is remain **ON (or CLOSED)**. Until then the tank is full, the mechanical sensor will floating and will cause the upper switch to **OFF (OPENED)**. Now, both the switch are **OFF (OPENED)**. Until then water began drained, upper switch become **ON (CLOSED)** again. Is like that? | 3fece7db88f2840c78b08ec19ff055ef538c76f5898ce2cc707a107a828f05d9 | ['5249d605cfc74fd38a7ac49d7897b9a6'] | I am not sure yours is more general or not, but for sure, it is incorrect. By pointing in the node, I can see the Vo. Unfortunately the gain is not shown. But however, as the output voltage on the Ro (=27k) is correctly shown, the gain must be correct. |
dc79cefc1bdc9b1a10ce67f0c2bdee66f8a8269a24ad34057f6b56d181592760 | ['52659bea2e9c4ea4947b0e1f6194b03b'] | Usually when i want to check if more input stored in a multiple strings are not empty i follow this simple approach:
std<IP_ADDRESS>string fieldA = "";
std<IP_ADDRESS>string fieldB = "";
std<IP_ADDRESS>string fieldC = "Hello";
Now, i can check for all:
if ( fieldA.empty() || fieldB.empty() || fieldC.empty() )
std<IP_ADDRESS>cout << "Oh oh.. one or more fields are empty << std<IP_ADDRESS>endl;
But it would be nice to know which fields are empty, then, i can write:
if ( fieldA.empty() )
std<IP_ADDRESS>cout << "fieldA is empty" << std<IP_ADDRESS>endl;
if ( fieldB.empty() )
std<IP_ADDRESS>cout << "fieldB is empty" << std<IP_ADDRESS>endl;
if ( fieldC.empty() )
std<IP_ADDRESS>cout << "fieldC is empty" << std<IP_ADDRESS>endl;
But in this way i can discover that fieldA is empty but not the fieldB and in this example i have only three fields, but with more fields?
What is the best practice to managing the control of many strings and locate the empty string?
| 0e5684e043301f1c21a62d072a7941ae74b3866c9470b9102ef503c210d4ae34 | ['52659bea2e9c4ea4947b0e1f6194b03b'] | I have this sample code:
#include <iostream>
#include <mongo/util/time_support.h>
using namespace std;
int main()
{
cout << mongo<IP_ADDRESS>curTimeMillis64() << endl;
return 0;
}
and compile with:
g++ -I/tmp/include prova.cpp -o prova -L/tmp/lib -lmongoclient
the result is:
/tmp/ccH0vDvx.o: In function `main':
prova.cpp:(.text+0x5): undefined reference to `mongo<IP_ADDRESS>curTimeMillis64()'
collect2: error: ld returned 1 exit status
I use the 26compat of mongo cxx driver and i have also check with nm the symbols within the library:
nm /tmp/lib/libmongoclient.so | grep curTime
00000000000ea510 t _ZN5mongo13curTimeMicrosEv
00000000000ea4f0 t _ZN5mongo15curTimeMicros64Ev
00000000000ea440 t _ZN5mongo15curTimeMillis64Ev
everything seems to be ok but the compile fails. Any suggestions?
Thanks
|
3d550f4e15284e2412a44cc0c185e48ad0cde32c8fb312da8d0ded778d73e463 | ['526611f5703f4f55891b34007be304e2'] | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def fill_list(l, promt):
while True:
x = input(promt)
if not x:
break
l.append(x)
if __name__ == '__main__':
first_names = list()
last_names = list()
fill_list(first_names, "Input first name: ")
print('first_names: {}'.format(first_names))
fill_list(last_names, "Input last name: ")
print('last_names: {}'.format(last_names))
for first, last in zip(first_names, last_names):
print('{}.{}@abc.mail.com'.format(first, last))
Output:
Input first name: fff
Input first name: ddd
Input first name: ggg
Input first name:
first_names: ['fff', 'ddd', 'ggg']
Input last name: 111
Input last name: 222
Input last name: 333
Input last name:
last_names: ['111', '222', '333']
<EMAIL_ADDRESS>
<EMAIL_ADDRESS>
<EMAIL_ADDRESS>
| 77097f54a2ad5962306061b3a984f491cc87e908e8b6bb207ab6077576a71890 | ['526611f5703f4f55891b34007be304e2'] | foo = '/input/directory/'
faa = ['/input/directory/file1.txt', '/input/directory/file2.txt']
import os.path
bar = [os.path.splitext(path.replace(foo, ''))[0]
for path in faa]
print(bar)
Or without foo:
faa = ['/input/directory/file1.txt', '/input/directory/file2.txt']
from os.path import basename, splitext
bar = [splitext(basename(path))[0]
for path in faa]
print(bar)
|
29e47a050d927d661f1d243626080b4c25df4db407738f81e80a84c9ab01913f | ['527036f8460747298f6cafcc6c4eda4d'] | I have an array of CKRecords that I'm trying to save to the default Container's public database for the first time. I created a CKModifyRecordsOperation and attempted to add the operation to the public database. It was unsuccessful but I'm not getting any error messages. So I tried adding each method individually to the database, sans any CKOperation... also unsuccessful, also devoid of error messages. To be sure, I checked my CloudKit Dashboard; there's nothing there.
Below is the method in question. It's hooked up to a simple IBAction for a button in an NSWindow. You can ignore the nested loops where I'm creating the CKRecords from my model data. They seem to be working as expected. My error checking code is inside of the completion blocks for CKModifyRecordsOperation. Specifically, the modifyRecordsCompletionBlock is printing: "Saved 0 records into CloudKit."
@IBAction func uploadDataToCloudKit(_ sender: NSButton) {
// Get CloudKit container and Public Database
let myContainer = CKContainer.default()
let publicDB = myContainer.publicCloudDatabase
// Create array of cloudkit records so we can save a batch
var cloudRecords = [CKRecord]()
let groups = PayCodes().groups
// For each PayCode Group...
for payCodeGroup in groups {
// Create CKRecord and give it a type
let payCodeGroupRecord = CKRecord(recordType: "payCodeData")
// For each PayCode in the group...
for payCode in payCodeGroup.payCodes {
// Fill the new CKRecord with key/value pairs
payCodeGroupRecord.setObject(payCodeGroup.title as NSString, forKey: "group")
if let commercialID = payCode.id.commercial as NSString?, let residentialID = payCode.id.residential as NSString? {
payCodeGroupRecord.setObject(commercialID, forKey: "commercialID")
payCodeGroupRecord.setObject(residentialID, forKey: "residentialID")
}
payCodeGroupRecord.setObject(payCode.title as NSString, forKey: "title")
if let description = payCode.description as NSString? {
payCodeGroupRecord.setObject(description, forKey: "description")
}
payCodeGroupRecord.setObject((payCode.includesTripCharge ? 1 : 0) as NSNumber, forKey: "includesTripCharge")
payCodeGroupRecord.setObject((payCode.needsResolutionCode ? 1 : 0) as NSNumber, forKey: "needsResolutionCode")
payCodeGroupRecord.setObject(payCode.pay.commercial as NSNumber, forKey: "commercialPay")
payCodeGroupRecord.setObject(payCode.pay.residential as NSNumber, forKey: "residentialPay")
// Save new CKRecord into the Array
cloudRecords.append(payCodeGroupRecord)
}
}
print("There are \(cloudRecords.count) records about to be saved...")
// print(cloudRecords)
// Create an operation to save the records
let operation = CKModifyRecordsOperation(recordsToSave: cloudRecords, recordIDsToDelete: nil)
operation.perRecordCompletionBlock = { savedRecord, error in
guard error != nil else {
print("There was an error: \(error!.localizedDescription)")
return
}
print("Saved a record into CloudKit")
}
operation.modifyRecordsCompletionBlock = { savedRecords, deletedRecordIDs, error in
guard error != nil else {
print("There was an error: \(error!.localizedDescription)")
return
}
guard let savedRecords = savedRecords else { return }
print("Saved \(savedRecords.count) records into CloudKit")
}
// Run the operation
publicDB.add(operation)
// cloudRecords.forEach { record in
// publicDB.save(record) { savedRecord, error in
// guard error != nil else {
// print("There was an error: \(error!.localizedDescription)")
// return
// }
//
// guard let savedRecord = savedRecord else { return }
// print("Saved a record: \(savedRecord.allKeys())")
// }
// }
}
| aaf7e0ad9febf2a3a433b133fb0045465768180defee891265610a586a44a3a0 | ['527036f8460747298f6cafcc6c4eda4d'] | According to Apple's Developer Docs the Library global allows one to import compiled scripts so they can be used as a library in one's current script. This works just fine if you were to do something like the below code with myLibName.scpt located at ~/Library/Script Libraries:
myLib = Library('myLibName');
myLib.myLibMethod() // Works just fine
But, the docs also claim that one can export an environment variable — OSA_LIBRARY_PATH containing a string of : delimited paths — and Library() would then defer to that list of paths before proceeding to it's default path: ~/Library/Script Libraries. Ya know, like the bash environment variable Path. Here's the relevant piece of documentation below; it describes the path hierarchy:
The basic requirement for a script to be a script
library is its location: it must be a script document in a “Script
Libraries” folder in one of the following folders. When searching for
a library, the locations are searched in the order listed, and the
first matching script is used:
If the script that references the library is a bundle, the script’s
bundle Resources directory. This means that scripts may be packaged
and distributed with the libraries they use.
If the application running the script is a bundle, the application’s bundle Resources
directory. This means that script applications (“applets” and
“droplets”) may be packaged and distributed with the libraries they
use. It also enables applications that run scripts to provide
libraries for use by those scripts.
Any folders specified in the environment variable OSA_LIBRARY_PATH. This allows using a library
without installing it in one of the usual locations. The value of this
variable is a colon-separated list of paths, such as /opt/local/Script
Libraries:/usr/local/Script Libraries. Unlike the other library
locations, paths specified in OSA_LIBRARY_PATH are used exactly as-is,
without appending “Script Libraries”. Supported in OS X v10.11 and
later.
The Library folder in the user’s home directory, ~/Library.
This is the location to install libraries for use by a single user,
and is the recommended location during library development.
The
computer Library folder, /Library. Libraries located here are
available to all users of the computer.
The network Library folder,
/Network/Library. Libraries located here are available to multiple
computers on a network.
The system Library folder, /System/Library.
These are libraries provided by OS X.
Any installed application
bundle, in the application’s bundle Library directory. This allows
distributing libraries that are associated with an application, or
creating applications that exist solely to distribute libraries.
Supported in OS X v10.11 and later.
The problem is that it doesn't work. I've tried exporting the OSA_LIBRARY_PATH variable — globally via my .zshrc file — and then running a sample script just like the one above via both the Script Editor and the osascript executable. Nothing works; I get a "file not found" error. I found this thread-where-the-participants-give-up-hope online; it doesn't explain much. Any thoughts?
On a somewhat related note, the Scripting Additions suite provides two other methods — loadScript and storeScript — that seem like they might be useful here. Unfortunately, when you try to use them, osascript gives you the finger. Though, I did manage to return what looked like a hexadecimal buffer from a compiled script using loadScript. Anyway, any insight you guys can shed on this would be much appreciated. Thanks.
|
5624b66c5f49874ecd393e89d33f8471968b5fd53d9397ed974ed675f0228f46 | ['5297c8dbcde14293b055176bc4e23d6f'] | i have a small javascript form
<div id="calculator-text"><h2>Tape calculator - based on cable size 1 mm to 28 mm, with 15% overlap</h2></div>
<form name="form1" method="post" action="">
<div id="calcformlabel"><label for="val2">Enter your cable size</label> (in mm)</div>
<div id="calcformtext1"><input type="text" name="val2" id="val2"></div>
<div id="calcformbutton"><input type="button" name="calculate" id="calculate" value="Calculate"></div>
<div id="calcformresult">The tape size you require is:- <span id="result1" class="maintext1"></span> (mm)</div>
</form>
<script type="text/javascript">
var btn = document.getElementById('calculate');
btn.onclick = function() {
// get the input values
var val2 = parseInt(document.getElementById('val2').value);
// get the elements to hold the results
var result1 = document.getElementById('result1');
// create an empty array to hold error messages
var msg = [];
// check each input value, and add an error message
// to the array if it's not a number
if (isNaN(val2)) {
msg.push('<span class="maintext1">Enter your cable size</span>');
}
// if the array contains any values, display the error message(s)
// as a comma-separated string in the first <span> element
if (msg.length > 0) {
result1.innerHTML = msg.join(', ');
} else {
// otherwise display the results in the <span> elements
result1.innerHTML = val2 * 3.142 * 1.15;
}
};
</script>
basically this is a simple calculation
a) how can i get this to output to 2 decimal places (and obviously round up or down depending on -.5 = round down and +.5 = round up)
b) replace the input type button for an image ( i have tried the obvious code and >input type = image>, basically these do actually work but instead of displaying the actual result, they display the result in a split second then reload the page with the blank form again...
any help on this would be much appreaciated
thanks in advance
| f1014e55325263bec9393b1ca43f8f9adc0855e3b454898224b2c5b68b016b54 | ['5297c8dbcde14293b055176bc4e23d6f'] | i have the following statement in my php file
<div id="product-info-left-column"><?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'] ); ?></div>
this gets the image from a database, now the image size is actually 300px x 600px, but i want it to be good for mobiles, so i need to figure out how to make this responsive.
i also have a css statement
#product-info-left-column {
max-width:300px;
float:left;
margin:0px 0px 0px 0px;
padding:20px 22px 20px 22px;
}
but unfortunately this doesnt control the image size either..
is there a better way of getting this to place the image on the page so its responsive
thanks in advance
}
|
69038612ff6ba10435a92cfa25ba389c46de10e3d05b442e80a370147b6b8dad | ['529977f88fd541709dfff1b578f8a130'] | I have a leaveList containing 4 leave names.This leaveList is passed as map value.I want to get leave details from CompanyLeave Table by passing leaveList in hql query.Let be considered,my Company Leave Table contains 6 leave details.leaveList has 3 leave names.I want to get details of these 3 leaves from CompanyLeave Table.
Code for Hql query here leaveNameList is a list as well as map
public List<CompanyLeaveType> getByValidLeave(Map<String, Object> params) {
Query query = sessionfactory.getCurrentSession().createQuery("from CompanyLeaveType WHERE companyCode = :companyCode and leaveName IN (:leaveNames)");
query.setParameter("companyCode", params.get("companyCode"));
query.setParameter("leaveNames", params.get("leaveNameList"));
List<CompanyLeaveType> validLeaveDetails = query.list();
return validLeaveDetails;
}
N.B: I have got java.util.ArrayList cannot be cast to java.lang.String error.How can I pass list in hql query?
| 130429ed9e6aed719cda59e657f70c729b14a0f28efffe9bb82aaddfa4e6e993 | ['529977f88fd541709dfff1b578f8a130'] | html code:
<button id="getQuotes">get quotes</button>
<div id="display"></div>
jqueryCode:
$(document).ready(function(){
$("#getQuotes").on("click", function(){
var index = Math.floor(Math.random() * (quotes.length));
for(var i = 0; i<=index; i++){
var html = "<h6> " + quotes[i].author + "</h6> <br>";
html += "<h1>" + quotes[i].quote + "</h1>";
}
$("#display").html(html);
});
});
You may try like this. https://jsfiddle.net/yu799cdz/
|
f13ae63bcc71184f18d59d83239ca42160db6821db27db726b025347721d5f1b | ['529feb648c93491a9b481d79baed2d1e'] | I hope there isn't an underlying implication that being driven by "more conservative and binary gender role attitudes" (and thus resistant to alternative pronouns) is negative and inherently a violation of the upcoming SE code of conduct. Ideally, a solution for the site should be acceptable to people of differing ideologies and cultures, not only those in Silicon Valley, but also coders in developing nations such as in Africa and the Middle East that are more likely to hold traditional gender values. | 84d944de56d1535b43ccbd11040f1dc184afd5918b2901cec50190d414c4e676 | ['529feb648c93491a9b481d79baed2d1e'] | Another common overlap is between [Science Fiction & Fantasy](http://scifi.stackexchange.com/) and [Movies](http://movies.stackexchange.com/), when the question is about a sci-fi or fantasy movie. In fact, it's quite common for the same question to be asked on each site by different users, such as *Why does <PERSON> wear a mask?* ([SF&F](http://scifi.stackexchange.com/q/111174/13217), [Movies](http://movies.stackexchange.com/q/<PHONE_NUMBER>)) |
2995970c8cfe592882d4d73753dddd9ba9303fc7699184005a9b08cf2466f332 | ['52a2e65e3748458e91ca5c66f64a8b11'] | I think I stumbled into a solution. I removed any special characters from the title and replaced spaces with hyphens. This is how my url generation logic looked:
const cleanTitle = title.toLocaleLowerCase()
.replace(/\s\s+/g, '-') // replace duplicate whitespace with hyphen
.replace('(', '')
.replace(')', '');
this.router.navigate([`/posts/${id}/${cleanTitle}`]);
after this, the routing config started matching urls like /posts/1/json-web-token-jwt-authentication-with-asp.net-core-2.0
| 6b53065a05d5987872ee07c0b52049b9cd91e26d308e824ca04154f795184149 | ['52a2e65e3748458e91ca5c66f64a8b11'] | A tweak of <PERSON>'s answer worked for me trying to work with pdfmake and not pdfkit. First you need to have memorystream added to your project using npm or yarn.
const MemoryStream = require('memorystream');
const PdfPrinter = require('pdfmake');
const pdfPrinter = new PdfPrinter();
const docDef = {};
const pdfDoc = pdfPrinter.createPdfKitDocument(docDef);
const memStream = new MemoryStream(null, {readable: false});
const pdfDocStream = pdfDoc.pipe(memStream);
pdfDoc.end();
pdfDocStream.on('finish', () => {
console.log(Buffer.concat(memStream.queue);
});
|
6654ba82c662de9eae3fd0962473b91a6abcd3f5937b537c74849caad80395d1 | ['52b7408d8de541d18af08abab0b9784f'] | soy nuevo en la comunidad y en el mundo de la programación, espero estar respetando todas las reglas :D
He desarrollado una aplicación que guarda un registro de alumnos. Los datos guardados son:
Nombre
Apellidos
Edad
Carrera
Hora de llegada a la biblioteca.
Hora de salida de la biblioteca.
Los procesos de "manipulación" (guardado, actualización, eliminación) de la base de datos se realiza sin problema alguno. Sin embargo me surge la duda de si he de preocuparme por el tamaño de la base de datos. Se trata de una aplicación desarrollada con fines educativos, sin embargo me gustaría seguir progresando en el mundo del desarrollo de aplicaciones móviles y por lo tanto creo que es importante saber este tipo de cosas.
Me imagino que mi base de datos no puede consumir muchos recursos, sin embargo me gustaría confirmarlo.
La solución que se me podría llegar a ocurrir es crear un método que eliminase entradas antiguas (siempre y cuando la persistencia de datos a largo plazo no sea importante). Algo como:
"DELETE FROM DBTable WHERE Time <= date('now','-10 day')";
Para ello agregaría a mi base de datos la columna Time y debería funcionar.
¿Alguna recomendación?¿Cómo trabajáis vosotros con SQLite y la persistencia de datos?
Muchas gracias de antemano por vuestra ayuda!
Un saludo!
| 336b2bdf3cd5eac90c2c0eabf018aa3d2eeac2e0d5f564e1a3324c1a34fac302 | ['52b7408d8de541d18af08abab0b9784f'] | Hi I have this component which I suppose is a ceramic capacitor, it is soldered into a Bose 901 Equalizer series IV and between 2 output leads of the main transformer in parallel to a bulb signalling operation is on. My question is what I have to order/look for if i want to replace it? Thanks
|
bc5bf2bf7af59cffd567eb2f4f746961898d9f51dd900c4966dbebf91bf597aa | ['52c57f4ff10141798a16eef33b95e1a9'] | **fundamental problem**: I don't know how to treat the fully connect layer as regression instead of classification, any resource I can read on? **Second problem**to get the identity is classification problem with corss_entropy as loss function and to get the bounding box is regression problem with mse as loss function. Is that possible to have labels like ["3",x,y,height,width], just use one regression model to predict them at one shot? if the identity and the bouding box are predicted as totally unrelated result from ex. two different softmax models, then localization will lose its meaning. | 7e24c6372e49c7fa190b3a68e67baaea69fe0668cf4bbade64e4ad4d8dc4f71e | ['52c57f4ff10141798a16eef33b95e1a9'] | My project is about to run on Docker mostly.
I have discovered today a ready to use AWS CloudFormation stacks on coreos.com (https://coreos.com/os/docs/latest/booting-on-ec2.html)
I'm a bit surprised with the possibility to pick PV because
my experience with AWS is that HVM machines could be resized after stop which is not possible for PV machines.
Is there a performance handicap for which I should I choose PV for CoreOS? Or should I stay with HVM for better elasticity?
|
52a0511687cfc6ed9877cfa3c08ebc53a79f006334ae668f1fa6ef72d83b8d8e | ['52c5bbc5be6d44428d0eaf229d7c8835'] | Well, suppose you have a command to execute your backup like this
BACKUP DATABASE [naass]
TO DISK = N'C:\program files (x86)\Microsoft SQL Server\MSSQL.3\MSSQL\Backup\Naass.bak''
WITH NOFORMAT, INIT,
NAME = N'naas-Complete Database Backup',
SKIP, NOREWIND, NOUNLOAD, STATS = 10
this will fail if the process that executes this command doesn't have the permissions to write in the mentioned folder. And Windows 7 (for very good security reasons) keeps the C:\program files folders and its subfolders write locked also to an administrator account.
You could mess with the default permissions and give to your folder above write permissions for your account but of course this is not the recommended way.
Much better, simply change the script to work on a different directory on your disks.
BACKUP DATABASE [naass]
TO DISK = N'D:\BackupSQL\naass.bak'
WITH NOFORMAT, INIT,
NAME = N'naas-Complete Database Backup'
SKIP, NOREWIND, NOUNLOAD, STATS = 10
Of course this new directory should have the correct permissions.
| 7b8855989208b0cb0c35cbc4e5f55cf8a0c7ee57c732f5fce841233175f902e8 | ['52c5bbc5be6d44428d0eaf229d7c8835'] | Thanks for your answer, although I'm having trouble following it due to your reuse of $f$ both to represent sets and again for functions. E.g. you have "if $y \in f(A)$, then $y=f(x)$." If you wouldn't mind using a different symbol, I think it would be much clearer. E.g. use $f(x)$ as I have used it above (as the function within the set-builder forms), but something else for the sets. |
144f5d1131adb39037067c441115767d13564adeafafdbabff64807071c6c77d | ['52cf1babb5774c508b775d6fd9b1384b'] | I have to create a program that applies box blur on an image in c. box blur is you get the average of the rgb values within 1 pixel away from the pixel you want to blur.
00ffff ff00ff fff0f0
0f0f0f f0f0f0 fff000
000fff f0f00f f00f0f
let's say I have a 2d array that has those RGB values of a pixel in an image. To blur the top right pixel I would have to average out the pixels in (0,0), (0,1), (1,0), (1,1) right? so for example the average is ffffff then if I have to blur the pixel in (0,1) would I have to use the original value 00ffff or the new value ffffff???
| 65eb8350230359931f558d88d23402a28584da5973d6d18821cac99bbbeea987 | ['52cf1babb5774c508b775d6fd9b1384b'] | These two lines are the same thing:
(*(*(*a).b).c).d
a->b->c->d
It just seems more practical and better to look at, otherwise you'd have to use the one at the top which seems very hard to read, so we use the -> operator because it's much simpler.
|
49b4565c61ab90d5d1fb8074c9e15fa600b0bcd68ae628bf2fb81c19b2262330 | ['52d35641a7ce4d96a79b3d0408a588a0'] | This is the action that when it's called it gets an id so it can filter the object with the same id in reducer .
export const buyItem = (24) => {
return {
type: BUY_ITEM,
payload: 24
};
};
This is the array of products in reducer file
products: [
{
id: 1,
price: 4500000,
number: 0,
inCart: false
},
{
id: 24,
price: 7210000,
number: 0,
inCart: false
},
{
id: 10,
inCart: false,
category: 'electronics',
number: 0,
}
]
This is the reducer action case that I filter the product filter then I try to update inCart and number value of it
switch (action.type) {
case BUY_ITEM:
let item = state.products.filter((item) => {
if (item.id === action.payload) {
return item;
}
});
console.log(state.products);
return {
...state,
productsInCart: state.productsInCart + 1,
cartPrice: state.cartPrice + item[0].price,
products: [
...state.products,
state.products.map((item) => {
if (item.id === action.payload) {
item.inCart = true;
item.number += 1;
}
})
]
};
The problem is it's not doing it properly it actually changes the object values successfully but when console log happens after the action is done it shows me this :
21: {id: 19, nam, number: 0, …}
22: {id: 22, number: 0, …}
23: {id: 23, n,…}
24: {id: 25, name: "Adidas کیف", pric دهید", number: 0, …}
25: (25) [undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined]
26: (26) [undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined]
27: (27) [undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined]
28: (28) [undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined]
29: (29) [undefined, undefined, undefined, undefined, {…}, undefined, undefined, undefined, undefined, undefined, undefined]
30: (30) [undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined]
31: (31) [undefined, undefined, undefined, undefined, undefined, undefined, undefined, {…}, undefined, undefined, undefined, undefined]
It basically adds multiple null arrays to the end of products array which is how I see is not what I want .
How can I properly update an object's value in an array when the action is called ?
| 09d09b84a46c53671b3585b169f415dc42515299b0727912064e4ed48a8a7d4a | ['52d35641a7ce4d96a79b3d0408a588a0'] | It's not actually a problem to be worry about and it's completely normal in react js .
The component renders itself at first so the first console.log is for that . Then when you make an axios call on componentDidMount lifecycle method , It re-renders itself again .
It's react js nature to re-render when the state or props change . You may want to use react's PureComponent . You can find all the documentation on that in react's own documenttaion website
|
fb07c1a281061a41907e3a639bc704fbd531dcda930ee9f84b00e01cbe322def | ['52dbe9fccef6442db809e48309c786c8'] | Consider the following piece of code:
int x = 1;
int y = 2;
y = x + (x = y);
When this runs in C#, the variables end up assigned with these values:
x = 2
y = 3
On the other hand, when the same runs in C++, the variables end like this:
x = 2
y = 4
Clearly, the C++ compiler is using different precedence, associativity and order of evaluation rules than C# (as explained in this <PERSON> article).
So, the question is:
Is it possible to rewrite the assignment statement to force C++ to evaluate the same as C# does?
The only restriction is to keep it as a one-liner. I know this can be rewritten by splitting the assignments into two separate lines, but the goal is to maintain it in a single line.
| 788d5cc803031b71241a5c2a920855e7b21eb39d785a75f3a93368deb01633b8 | ['52dbe9fccef6442db809e48309c786c8'] | Below are two implementations of the same iterative algorithm that generates the Pisano periodic sequence for any given modulo n under the following contraints:
1<=n<=CR
Where CR stands for your computing resources. In my case, CR approximates 10,000,000,000.
The algorithm is constructed around the ideas that a Pisano sequence always starts with 0 and 1, and that this sequence of Fibonacci numbers taken modulo n can be constructed for each number by adding the previous remainders and taking into account the modulo n.
C#
public static IEnumerable<int> PisanoPeriodicSequence(int n)
{
int current = 0, next = 1;
yield return current;
if (n < 2) yield break;
next = current + (current = next);
while (current != 0 || next != 1)
{
yield return current;
next = current + next >= n ? current - n + (current = next) : current + (current = next);
}
}
C++
std<IP_ADDRESS>vector<int> pisano_periodic_sequence(int n)
{
std<IP_ADDRESS>vector<int> v;
int current = 0, next = 1;
v.push_back(current);
if (n < 2) return v;
current = (next += current) - current;
while (current != 0 || next != 1)
{
v.push_back(current);
current = current + next >= n ? (next += current - n) + (n - current) : (next += current) - current;
}
return v;
}
|
b39dbfdfffb6f976d8238cbeed58675ac519a4809818f2e95d2886ced25a367e | ['531f378d588a40288dcbb9a1bff55122'] | Hello I have this column :
date1
6/19/2019 3:10:12 PM
I wanted just to extract the time so I used the following query :
select try_parse([date1] as time using 'en-US') from myTable
But the problem is I got this :
15:10:12.0000000
whereas I would like to just have this :
15:10:12
How can I solve this ?
Thank you very much !
| f9ac24f94c2d395bfd0ef661dddf9c2c8426917ed60b03588a7edd8d4332e2ff | ['531f378d588a40288dcbb9a1bff55122'] | Hello I am using SQL Server and I have this column :
data
6/19/2019 3:10:12 PM
12/23/2016 5:02:15 AM
I wanted to extract only the time so I used the following query :
select try_parse([data] as time using 'en-US') from Table_1
But the problem is I get as a result this :
15:10:12.0000000
05:02:15.0000000
All is okay except the 0 I mean I would like to get :
15:10:12
05:02:15
Thank you very much for your help !
|
3fe0fba4cbf93d7ce26887fc8a034133f8499decae047bea08186b14d0dfee34 | ['532752eef07a4c79aa5f178c07b047dd'] | I don't know of a free plugin but you can get quite a long way towards this with some muscle memory and the built in autoformat command.
CTRL+E, CTRL+D, CTRL+S
will do code indentation and formatting, and save the file.
If you have Resharper (sorry), there's a configurable code cleanup tool which will do what you want and CTRL+E, CTRL+F, CTRL+S will do the cleanup and save.
| c2af99a48dfe73d95a1a034bcd27fbfbd2f0b4d0c6342e3149b11ab68cf3113f | ['532752eef07a4c79aa5f178c07b047dd'] | You're absolutely right about chained .Include() statements, the performance documentation warns against chaining more than 3 as each .Include() adds an outer join or union. I didn't know about ThenInclude but it sounds like a gamechanger!
If you keep your virtual navigation properties but turn off Lazy Loading on the DbContext
context.ObjectContext().ContextOptions.LazyLoadingEnabled = false;
then (as long as Change Tracking is enabled) you can do the following:
var a = context.aObjectNames.First(x=> x.id == whatever);
context.bObjectNames.Where(x=> x.aId == a.Id).Load()
This should populate a.bObjects
|
3daac3898bb018971fb39daf44bd867955956fa1a80d198f7d2f86ec6796464a | ['532e441de1214f8694cdd0a78ebd606d'] | Does $.noConflict() works?
Import the js/jquery-1.5.2.min.js first and use $.noConflict() to register js/jquery-1.5.2.min.js. Then use another code block and import another version of jQuery. In the end, rewrite the top banner using jQuery.xxx() instead of $.xxx()
I think this should be work.
| 23c513b5db688a7b02f844544f336102d582fbb81d09f245cbde57d29968ac34 | ['532e441de1214f8694cdd0a78ebd606d'] | Well I was convinced I had single boot menu (GRUB) that let me do that. Most of the time stuff like that works just fine so I don't know a lot about it but learnt a few things while trying to get something to work. Then I stumbled upon a hybrid combination and thought this was it but this is a setup on a GPT disk with a MBR compatible view for an OS that can't handle GPT.
https://wiki.gentoo.org/wiki/GRUB2/Chainloading
In the end the only option was to convert my old MBR Windows to a GPT bootable one and then install an UEFI bootloader with a Windows install disk. |
7a10e4c410c20aa0199666d504123529b8121e5e4073a6c0758f81569b2cc813 | ['533504b256c44ec1bcd3dd0e9c5c92c3'] | You need to to control NULL result in the sibling search:
gennode* general<IP_ADDRESS>search(int element, gennode *t){
if(t == NULL)
{
return t;
}
if(t->item == element)
{
return t;
}
gennode* result = NULL;
if(t->siblingList != NULL)
{
result = search(element, t->siblingList)
}
if(result==NULL)
{
result = search(element, t->firstChild);
}
return result;
}
| 525d7eabd2dddca3845148349f02ca215bc03e65e958ed5794a89d6ad2dc7a36 | ['533504b256c44ec1bcd3dd0e9c5c92c3'] | Of course you can definitely bring your code over other platforms easily if you only have cross-platform and standard implementations. In order to port your code to Android you can look at JNI and for XCode you can just create Cocoa static libraries to be used in the objective-C++ projects
|
9999c220f8c2c4729d9db2c261f27d7468526092135289a6068b1d81c932381c | ['533ff698c2bb462ba82e5d1fb3a48e42'] | Server.Transfer()
and Response.Redirect()
both are performing same functionality like help to navigate user from one page to another, but internal process happening inside system little bit different. To get more idea about that please visit
http://www.dotnet-tricks.com/Tutorial/csharp/c4SE281212-Difference-between-Response.Redirect-and-Server.Transfer.html
| e2338c5d64416f45d2678ac4d2eb40917b036d6fb3a91c027dc03d1be362c87d | ['533ff698c2bb462ba82e5d1fb3a48e42'] | Below code helped me to implement REST API calls with Twitter
var oauth_token = membership.Token; //"insert here...";
var oauth_token_secret = membership.TokenSecret; //"insert here...";
var oauth_consumer_key = consumerKey;
var oauth_consumer_secret = consumerSecret;
// oauth implementation details
var oauth_version = "1.0";
var oauth_signature_method = "HMAC-SHA1";
// unique request details
var oauth_nonce = Convert.ToBase64String(
new ASCIIEncoding().GetBytes(DateTime.Now.Ticks.ToString()));
var timeSpan = DateTime.UtcNow
- new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
var oauth_timestamp = Convert.ToInt64(timeSpan.TotalSeconds).ToString();
// create oauth signature
var baseFormat = "oauth_consumer_key={0}&oauth_nonce={1}&oauth_signature_method={2}" +
"&oauth_timestamp={3}&oauth_token={4}&oauth_version={5}";
var baseString = string.Format(baseFormat,
oauth_consumer_key,
oauth_nonce,
oauth_signature_method,
oauth_timestamp,
oauth_token,
oauth_version
);
baseString = string.Concat("GET&", Uri.EscapeDataString(resource_url), "&", Uri.EscapeDataString(baseString));
var compositeKey = string.Concat(Uri.EscapeDataString(oauth_consumer_secret),
"&", Uri.EscapeDataString(oauth_token_secret));
string oauth_signature;
using (HMACSHA1 hasher = new HMACSHA1(ASCIIEncoding.ASCII.GetBytes(compositeKey)))
{
oauth_signature = Convert.ToBase64String(
hasher.ComputeHash(ASCIIEncoding.ASCII.GetBytes(baseString)));
}
// create the request header
var headerFormat = "OAuth oauth_nonce=\"{0}\", oauth_signature_method=\"{1}\", " +
"oauth_timestamp=\"{2}\", oauth_consumer_key=\"{3}\", " +
"oauth_token=\"{4}\", oauth_signature=\"{5}\", " +
"oauth_version=\"{6}\"";
var authHeader = string.Format(headerFormat,
Uri.EscapeDataString(oauth_nonce),
Uri.EscapeDataString(oauth_signature_method),
Uri.EscapeDataString(oauth_timestamp),
Uri.EscapeDataString(oauth_consumer_key),
Uri.EscapeDataString(oauth_token),
Uri.EscapeDataString(oauth_signature),
Uri.EscapeDataString(oauth_version)
);
ServicePointManager.Expect100Continue = false;
// make the request
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(resource_url);
request.Headers.Add("Authorization", authHeader);
request.Method = "GET";
request.ContentType = "application/x-www-form-urlencoded";
var response = (HttpWebResponse)request.GetResponse();
var reader = new StreamReader(response.GetResponseStream());
var objText = reader.ReadToEnd();
return objText.ToString();
But the problem is that when I tried to implement https://api.twitter.com/1.1/statuses/lookup.json?id=20,432656548536401920 api it shows 401 error. The error comes only this api call only.
|
800bb3ff60f0af86f34dd368a1cada359ffaaf970372c9beeedcaf73e81a251b | ['535b64b350b9404ba70f54372a3f9304'] | I am doing a small machine learning project.
I doubt that, can I standardize all of the data, X, first (except the label, Y).
I only saw the developer standardize the train set with fit_transform() and test set with transform() after splitting the train - test set
example of the code:
import pandas as pd
dataset = pd.read_csv('../../dataset/dataset_experiment_1.csv')
X_no_stdize = dataset.iloc[:,:-1].values
y = dataset.iloc[:,86].values
from sklearn.preprocessing import StandardScaler
X = StandardScaler().fit_transform(X_no_stdize)
kfold = StratifiedKFold(n_splits=10, shuffle=True)
print('XGBoost')
model = XGBClassifier(booster='gbtree', objective='binary:logistic', learning_rate=0.2, max_depth=3)
f1_score = cross_val_score(model, X, y, cv=kfold, scoring=scoring3)
print('f1-score: ', f1_score.mean(), ' +- ', f1_score.std())
Thanks in advance for your assistance.
| 7069c9c8757648ffe4c450baaa3ddb475dfda8721880be3eeb06b77137b5017e | ['535b64b350b9404ba70f54372a3f9304'] | I don't know how to find the third point that I have said.
However, I try to write code write this:
float extraX; // x of the third point
float extraY; // y of the third point
float extraZ; // z of the third point
void CalculateExtraPoint(float x1, float y1, float z1, float x2, float y2, float z2){
float range = extraRange; //range from the first point to third point
float d_x = x1-x2;
float d_y = y1-y2;
float d_z = z1-z2;
distance1_2 = sqrt(pow(d_x,2)+pow(d_y,2)+pow(d_z,2));
float temp = (range/distance1_2)+1;
extraX = x2 + (temp*d_x);
extraY = y2 + (temp*d_y);
extraZ = z2 + (temp*d_z);
}
It come from vector equation, r=(x2,y2,z2) + (lambda)[x1-x2,y1-y2,z1-z2]. r is any point.
Is it correct? Thanks in advance.
|
00bec1b82a202aaf7aede135a97aaef365a173bfeebda1584ee2ee8006913b78 | ['53696db3ac3640f5902a7b92a8501ee4'] | code :
s64 end_time;
struct timespec ts;
getrawmonotonic(&ts);
end_time = timespec_to_ns(&ts);
How to remove the first three bytes from end_time and last one byte from it?? I want to store it in a uint32. could someone tell me how to do that??
uint32 latency;
fscanf(fp, "%lu\n", latency); //fp is reading the end_time and storing in latency.
latency = (uint32) (latency >> 8) & 0xFFFFFFFF;
after reading the s64 value from uint32. I am reading only 4bytes from that.
Is it possible to read the s64 from uint32 ??
| 272f7b8f54f3ce1a07c3d6f846d44149e62b63d7c61f13e33da36e12aaf88888 | ['53696db3ac3640f5902a7b92a8501ee4'] | In kernel : I am reading the time value as type extern s64 Latency;
In user space :
extern double latency;
//fp is reading the kernel value (i.e Latency)
fscanf (fp,"%lf", latency);
If I read s64 from kernel as double in the user space. Is there possibility of data loss ??
which data type should I use to get the complete value ??
|
611703a5627b0838aa573e108d49d86e7f222ad5865df628f4091fa268c70706 | ['5386fa6fd52047aba54389cfbcf88a28'] | $json= '[{
"pid":"28",
"prod_brand_name":"IPCA",
"prod_cat_name":"Zerodol P",
"prod_comp_name":"Zedfit Tablet",
"prod_mrp":"100",
"prod_name":"Collaflex",
"prod_quantity":"2",
"prod_size":"11",
"prod_total":"200",
"prod_unit":"90",
"ref_pid":"24"
}]';
$array= json_decode($json, true);
if you pass TRUE to the json_decode function, returned objects will be converted into associative arrays. By default this function take it as FALSE.
echo "<pre>";
print_r($array);
| 8b7d03a0ea0e2b577bd4fdfa8d62073c81502f7cd4b14d1aef747a3ed1ac0a85 | ['5386fa6fd52047aba54389cfbcf88a28'] | You can use the php explode function. First you can explode request_uri with delimiter '/'. It will return an array. Then you should explode again your element of the array with delimiter '-'. Hope this will help you.
You can get more about explode function here-
http://php.net/manual/es/function.explode.php
|
f974d4f08b98fac8a142f5d0e1847a99615b3f56d5db4361d04bf7e341cf4174 | ['53912223a86b4634852579d6af747f58'] | Why it doesn't work:
In Python the "**" prefix in the arguments is to make one argument capture several other ones. For example:
SP = {'key1': 'value1','key2': 'value2'}
def test(**kwargs): #you don't have to name it "kwargs" but that is
print(kwargs) #the usual denomination
test(**SP)
test(key1='value1', key2='value2')
The two call on the test function are exactly the same
Defining a function with two ** arguments would be ambiguous, so your interpreter won't accept it, but you don't need it.
How to make it work:
It is not necessary to use ** when working with normal dictionary arguments: in that case you can simply do:
SP = {'key1': 'value1','key2': 'value2'}
CP = {'key1': 'value1','key2': 'value2'}
def test(SP,CP):
print(SP)
print(CP)
test(SP,CP)
Dictionaries are objects that you can directly use in your arguments. The only point where you need to be careful is not to modify directly the dictionary in argument if you want to keep the original dictionnary.
| 138c8406332b711f108be84468272bc01946c175f7fd7dbc8e300e3018352086 | ['53912223a86b4634852579d6af747f58'] | After asking a previous question someone told me the organization of my application was weird, so I looked at other examples to see how I could handle what I want to do.
The clearest example I found is a school case of flask application. From what I understand:
The app object is declared in the app module
Routes are declared in the routes module
The blueprint import the routes as I want
However in my application to answer some of the routes I need to access parameters that are defined in the app module (they are used before creating the app object).
How can I make these parameters accessible in the routes module?
I can't just import them from app since that would be a circular import.
I could use a constructor function like suggested in this question but considering the remarks to my previous question it seems like it is not the usual way to deal with this issue.
|
d8e37558f9cbd20b2477c7c6a7811ef485ceb302560651af95adf045f7dc0f8c | ['5393658b6d2c417c93c7bc3e4e7baaf3'] | Here is one solution that seems to work with your example:
Change your CSS to match the following.
@media only screen and (max-width: 1914px) and (min-width: 1715px)
.navbar-nav > li {
padding-left: 0.5%;
padding-right: 0.5%;
}
I am reducing your padding because with a padding of 3% total for each element you end up with 24% of your page being padding, the li items just won't fit with that.
.navbar .navbar-nav {
vertical-align: top;
float: right;
display: block;
}
Your ul can float right if you want to take up the right side of the page, and make it display block as well.
Does this work for you?
| a677c239c9450a857af978291cf4d0127a55e9228fa73c6565bb23959461d94f | ['5393658b6d2c417c93c7bc3e4e7baaf3'] | Here is a pure HTML and CSS solution. You could also do this with SVG.
http://codepen.io/tylerism/pen/xGpQwQ
HTML
<div class="pop_line active">
</div>
<div class="pop_line active">
</div>
<div class="pop_line active">
</div>
<div class="pop_line">
</div>
<div class="pop_line">
</div>
CSS
.pop_line{
background:#444;
border-radius:3px;
width:5px;
height:20px;
float:left;
margin:2px;
}
.pop_line.active{
background:#999;
}
html{
background:#111;
}
|
94571cdfe4b37026820790a98c355e1948c71c53d12ffc861d8dc39ca881edfe | ['53a9e7e9a4524ccab7239dce3c67c830'] | I'm developing a ViewPager with several fragments, one of them I want it to be a "PreferenceActivity" the problem is that I'm using API7, so no PreferencesFragment... I've already search for a way to embed an activity (PreferencesActivity) in a Fragment, and given up for lack of results. So my next take is to "build" a preference activity Look and feel in a fragment, so my question is this how can I build an interface that looks just like the preference activity, more specifically a listPreferences lookalike (with the text title and description, icon, behavior, etc)?
Thanks very much for your help!
| 91a30969dc5ab2c43ee98785213256d05c8dacb88a0052e5f78e1eb0e3eb356a | ['53a9e7e9a4524ccab7239dce3c67c830'] | After many hours searching I finally did it. I leave here my solution for further reference.
//Managed Bean - View
public class DummyLazySearchPageBean {
private LazyDataModel<DummyObject> results;
private String searchFilter;//to simulate search filter
private DummyBusinessClass dummyBusinessClass;
public DummyLazySearchPageBean() {
results = new SearchsLazyLoader();
}
// GETTERS AND SETTERS
@SuppressWarnings("serial")
private final class SearchsLazyLoader extends LazyDataModel<DummyObject> {
@Override
public List<DummyObject> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String,Object> filters) {
//Simulate BD model
List<DummyObject> data = new ArrayList<DummyObject>();
dummyBusinessClass = new DummyBusinessClass();
data = dummyBusinessClass.search(searchFilter, 5000);
//rowCount
this.setRowCount(data.size());
//paginate
if(data.size() > pageSize) {
try {
return data.subList(first, first + pageSize);
}
catch(IndexOutOfBoundsException e) {
return data.subList(first, first + (data.size() % pageSize));
}
}
else {
return data;
}
}
}
public final void search(){
results = new SearchsLazyLoader();
}
}
|
a73cbfb0ada56b0ed78ebc5ebaf298c0fc168f6c6e3ef2ee709acf36ff2e1fb2 | ['53b8aa036c40432593289f92adc204cf'] | Because its assignment I don't want to give you straight whole solution. Please don't hesitate to comment if you need more help.
My suggestion is to create object
class MoveOffset
{
public int OffsetX { get; set; }
public int OffsetY { get; set; }
}
then create collection of them with possible moves
var moves = new List<MoveOffset>()
{
new MoveOffset(){OffsetX = -1, OffsetY = -2},
new MoveOffset(){OffsetX = -2, OffsetY = -1},
new MoveOffset(){OffsetX = 1, OffsetY = -2},
new MoveOffset(){OffsetX = -2, OffsetY = 1},
new MoveOffset(){OffsetX = -1, OffsetY = 2},
new MoveOffset(){OffsetX = 2, OffsetY = -1},
new MoveOffset(){OffsetX = 1, OffsetY = 2},
new MoveOffset(){OffsetX = 2, OffsetY = 1},
};
then cycle through collection and check conditions if its possible to move there from 'horse' location .
| 2ebc1a200b042c67b5e69723612ae8862617af1a1faad70ef18e38c463d75613 | ['53b8aa036c40432593289f92adc204cf'] | Some areas in Visual Studio 2017 are black(not refreshed) when i open it or i swich tabs. Text is showed again if i select it.
The biggest issue is in aspx files - it shows previous aspx file. When i hover over some menu options its fixed for that menu. Or if i change size of window its fixed but some areas stays black - line numbers.
|
0ea8ef2750a4d818a76a939051e2fec4dbf0cd06b17918a23dae3594853b7f11 | ['53b9bcb3aad949048aa3ba42933a0406'] | I am working on my first app with Xamarin Forms in Visual Studio 2015.
I have a page with a grid, which is in a StackLayout, which is in a ScrollView, which is in an AbsoluteLayout.
Here is the constructor for that page:
public ConditionsPage(long reportId)
{
InitializeComponent();
Title = "New Entry";
this.ReportId = reportId;
var columns =
DependencyService.Get<IGetReports.IGetReportsService>().GetAllVisibleColumns(ReportId);
Rows = new List<RowEntry>();
foreach (var c in columns)
{
Label label = new Label
{
Text = c.ColumnName,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
TextColor = Color.Black
};
Picker picker = new Picker
{
Title = "Condition",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
TextColor = Color.Black
};
foreach (string condition in conditionOperators.Values)
{
picker.Items.Add(condition);
}
// Create Entry for condition value input
Entry rowEntry = new Entry()
{
WidthRequest = 100,
HeightRequest = 50,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
TextColor = Color.Black,
};
if (c.ColumnType == ReportColumnType.Datetime)
{
rowEntry.Keyboard = Keyboard.Text;
}
else if (c.ColumnType == ReportColumnType.Text)
{
rowEntry.Keyboard = Keyboard.Text;
}
else
{
rowEntry.Keyboard = Keyboard.Numeric;
}
Rows.Add(new RowEntry() {ColumnId = c.Id, Entry = rowEntry, Label = label, Picker = picker });
}
// Build the page.
var absoluteLayout = new AbsoluteLayout();
var stackLayout = new StackLayout();
var scrollView = new ScrollView();
var grid = new Grid()
{
VerticalOptions = LayoutOptions.Fill,
HorizontalOptions = LayoutOptions.Fill,
RowDefinitions =
{
new RowDefinition { Height = GridLength.Auto },
new RowDefinition { Height = GridLength.Auto },
new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) }
},
ColumnDefinitions =
{
new ColumnDefinition { Width = GridLength.Auto },
new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
new ColumnDefinition { Width = new GridLength(100, GridUnitType.Absolute) }
}
};
int i = 0;
foreach (var row in Rows)
{
grid.Children.Add(row.Label, 0, i);
grid.Children.Add(row.Picker, 1, i);
grid.Children.Add(row.Entry, 2, i);
i++;
}
stackLayout.Children.Add(grid);
var generateReportButton = new Button()
{
Text = "Generate Report"
};
generateReportButton.Clicked += new EventHandler(GenerateReport_OnClicked);
stackLayout.Children.Add(generateReportButton);
stackLayout.HorizontalOptions = LayoutOptions.Fill;
stackLayout.VerticalOptions = LayoutOptions.Fill;
scrollView.HorizontalOptions = LayoutOptions.Fill;
scrollView.VerticalOptions = LayoutOptions.Fill;
scrollView.Content = stackLayout;
absoluteLayout.Layout(new Rectangle(0,0, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
AbsoluteLayout.SetLayoutFlags(scrollView, AbsoluteLayoutFlags.PositionProportional);
absoluteLayout.Children.Add(scrollView);
absoluteLayout.HorizontalOptions = LayoutOptions.Fill;
absoluteLayout.VerticalOptions = LayoutOptions.Fill;
Content = absoluteLayout;
}
I have another page that the app goes to after the 'Generate' button is clicked:
Navigation.PushAsync(new ReportPage(ReportId, Rows));
When I press the Back button on the Report page I see the Conditions Page in Portrait, however the width is much larger than the device screen and I can only see the first two columns /the third one is not visible/.
I have an attribute on the Conditions Activity as follows:
[Activity(Label = "Report Conditions", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
ScreenOrientation = ScreenOrientation.Portrait)]
and on the Report Activity:
[Activity(Label = "Report", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
ScreenOrientation = ScreenOrientation.Landscape)]
also I have added custom page renderer as follows:
For the Conditions Activity:
public class ConditionsCustomContentPageRenderer : Xamarin.Forms.Platform.Android.PageRenderer
{
//private ScreenOrientation _previousOrientation = ScreenOrientation.Unspecified;
protected override void OnWindowVisibilityChanged(ViewStates visibility)
{
base.OnWindowVisibilityChanged(visibility);
var activity = (Activity)Context;
if (visibility == ViewStates.Gone)
{
// Revert to previous orientation
activity.RequestedOrientation = ScreenOrientation.Portrait;
//_previousOrientation == ScreenOrientation.Unspecified ? ScreenOrientation.Portrait : _previousOrientation;
}
else if (visibility == ViewStates.Visible)
{
//if (_previousOrientation == ScreenOrientation.Unspecified)
//{
// _previousOrientation = activity.RequestedOrientation;
//}
activity.RequestedOrientation = ScreenOrientation.Portrait;
}
}
}
For the Report Activity:
public class ReportCustomContentPageRenderer : Xamarin.Forms.Platform.Android.PageRenderer
{
private ScreenOrientation _previousOrientation = ScreenOrientation.Unspecified;
protected override void OnWindowVisibilityChanged(ViewStates visibility)
{
base.OnWindowVisibilityChanged(visibility);
var activity = (Activity)Context;
if (visibility == ViewStates.Gone)
{
// Revert to previous orientation
activity.RequestedOrientation = _previousOrientation == ScreenOrientation.Unspecified ? ScreenOrientation.Portrait : _previousOrientation;
}
else if (visibility == ViewStates.Visible)
{
if (_previousOrientation == ScreenOrientation.Unspecified)
{
_previousOrientation = activity.RequestedOrientation;
}
activity.RequestedOrientation = ScreenOrientation.Landscape;
}
}
}
I am missing something, but I am not sure what exactly.
Any help is greatly appreciated!
| 1332df2a79525485d51e4ed97555a97d5a7306e58528b1ad6e380800feb3403b | ['53b9bcb3aad949048aa3ba42933a0406'] | I have an asp.net core 2.1 web app, which is deployed to Ubuntu 18.04 LAMP server as a self-contained app.
There is a Chat page, created with SignalR and on localhost everything works fine.
However, when I connect to http://www.limboworld.net /real website/
and go to the Chat page and inspect the Console using developer tools I see the following:
https://drive.google.com/open?id=12JxhgoDtpXwrMFX7Z5oJ6MlkpkuN0How
When clicking on the link http://www.limboworld.net/hubs/chat?id=8rE5uw4Ck9PIpoaCF_KuMA I get "No Connection with that ID".
According to http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html, I tried adding the
ProxyPass "/ws2/" "ws://echo.websocket.org/"
directive, but I am not sure what causes the problem.
Maybe there is some problem with my code and that is why I am posting this here even though I only tried configuring Apache.
Would someone please help me remove the error message in the Chrome developer tools console?
Any help on why this is not working is appreciated.
|
0ef10fa3eba9f468e4c741195e29d1fd31ec8009c92a8ae8eca3b65f4fd0c3e6 | ['53c96da969034b98bbc6258b3a349485'] | Attach the event handler with jQuery (not with the onclick attribute) and remove the href attribute altogether. The problem is that the browser is navigating when the link is clicked. I see this happen alot when onclick is used and there is an error in your event handler before preventing the default.
Another way to fix it for sure is to not use an <a> but rather a <span>.
| 02c686a6717df599305673e257db629343710bbc019a068ddb6396fb50f38c2e | ['53c96da969034b98bbc6258b3a349485'] | Based on the information you shared, the issue might point to a misconfiguration inside wordpress since you have successfully mapped Cloud DNS to your google domain.
I understand that you are tying to display your domain in the search bar instead of your IP.
Here's a link which guide you how to fix this issue.
|
c80ed3feafd77c965cd4e099af4cdb13035b07a078058e0ca0e11ca4271285d0 | ['53d988a1a9f84321840e2de11f6c5147'] | As of 2020, apparently there is still no way to disable this behaviour according to
this jetbrains support entry.
There is a workaround described:
1) Start with Edit | Macros | Start Macro Recording
2) Press "Ctrl" + "/" to comment out current line
3) Press "Up" to move caret to that line again
4) End with Edit | Macros | Stop Macro Recording
But if you apply this, selecting multiple lines to comment them out/in behaves different. There are two tickets in the Issue tracker for this, but it doesn't seem to be worked on.
Highlighting a piece of text on the line and then doing the comment shortcut is the closest non-breaking fix I could find...
| f52e0f69be31587c4183a4c91c8952406a0dbd929cc24a8556f08a0bbb7b7186 | ['53d988a1a9f84321840e2de11f6c5147'] | Your Variable projectnamevar cannot be found in the class as you have not saved it as such, try it with
self.projectnamevar = tk.StringVar()
Also, you might want to use the os module instead of calling it on the system, you can use it like this
import os
path = "~/my/path/"
os.mkdir(path)
|
9ab01dcfe101bdf060335eb0b3471711fc427dc2c2bd0de6e96c0003bc44b601 | ['53e27e8b58d94a6a9414263e2a2eaa99'] | We all know scoring by characters is ripe for abuse. Let's prove this.
The Challenge
Output the following:
"m8V}G=D@7G1lAI,v08`
#(hNb0A8T!g;==SVaG5~
g"jUF!bmRY(3I@na?2S{
fJVzo/GQYU%ybpfUq3aG
Yza[jc,WJ$bP^7r};Da}
V-!Z+Nk:`/poc}d/X:G\
sWX{dbAUv6,i]%RG$hRp
),bd+?/{U1tU[;<;u.Nk
ZFPIOzJ/HimL!nexc,ls
HM%k3D$n2|R,8L?'eI_n
qs.kzbil$UQy_#Z)l#i%
*G4gr2<R^y#/iQ9,<+p%
}BYnb3_&:!m;#~QL1C?t
f.U>wIkTz=P>bf!uwb!d
z()rG)>~:q4#\}~pQEvZ
=OT8T4<i50%/8%eX^"3E
#Ks(8}OzZ&]RQ(-BLy<7
p7B~GEsF$)>?a"dtGCC'
H;:n&p&Z($ukNd,Et.$O
F*Uq0$dm,m%ejPT~u,qL
The characters inside the box are selected uniformly at random between the codepoints 0x21 and 0x7e. This means they should not be compressable much ordinarily. However, in this challenge, your code is scored by the number of characters, which can range in codepoint between 0x00 and 0x10ffff. Since this gives about 21 bits of information per character, and the box contains about 7 bits of information per character, approaching a 3:1 packing should be possible.
Note that:
As usual, you may output to STDOUT or return the string from a function;
A trailing newline on the last line is optional. Apart from this, the output must be exactly as given.
List representations are acceptable if returning from a function.
Scoring
The score is the length of your code in characters, expressed in the encoding of your language's interpreter. For most languages, this will be UTF-8. Note that languages that use an SBCS, such as most golfing languages, are at a huge disadvantage here as the number of characters is equal to the number of bytes.
Note that characters are not the same as grapheme clusters. For example, is actually 3 characters (0x1f468 0x200d 0x1f9b2).
| d0010b494f12ad46dd845908394ca04b6f8f83e13e1797daeea0a7f53aeb3e1d | ['53e27e8b58d94a6a9414263e2a2eaa99'] | Hi! This question looks reasonable, but there are a couple of things you need to add. Firstly, if it's code golf, add the code-golf tag (instead of code-challenge). The second is I/O format: consider the community's [loose I/O rules](https://codegolf.meta.stackexchange.com/q/2447/48931). In particular, I'd suggest to allow the answer to be a function and the grader to be passed as a [black-box function](https://codegolf.meta.stackexchange.com/a/<PHONE_NUMBER>). |
d1681bddb21317a1aef3f7fc4aab6ab2700d75e3189d3364c47143b442f6712d | ['53fe5dd421fe45d0a89683b63d5e3195'] | You can't, inspector can't find setter because foo type is Boolean, not boolean.
You could use a wrapper
public class BarWrapper {
private Bar bar;
public Boolean getFoo() {
return this.bar.getFoo();
}
public void setFoo(final Boolean value) {
this.bar.setFoo(value);
}
}
and then inspect on the wrapper
Introspector.getBeanInfo(BarWrapper.class, Object.class).getPropertyDescriptors();
| 624814cc4cd0987b676b0b556885e7353207ae0712a94089e2ef677cae69b14a | ['53fe5dd421fe45d0a89683b63d5e3195'] | Your abstract Mapper class could use an abstract toArray method which provide the typed conversion from list to array.
static abstract class Mapper<T> implements MyInterface<String> {
@Override
public void consume(String... transformFrom) {
T[] array = toArray(Arrays.stream(transformFrom)
.map(this<IP_ADDRESS>transform)
.collect(Collectors.toList()));
delegate.consume(array);
}
protected abstract T transform(String toTransform);
protected abstract T[] toArray(List<T> list);
}
In implementations just implement a basic list.toArray(..) method
public static void main(String[] args) {
Mapper myMap = new Mapper<Integer>(new MapperInt()) {
@Override
protected Integer transform(String toTransform) {
return new Integer(toTransform);
}
@Override
protected Integer[] toArray(List<Integer> list) {
return list.toArray(new Integer[list.size()]);
}
};
myMap.consume("1","2");
}
public static class MapperInt implements MyInterface<Integer> {
@Override
public void consume(Integer... toConsume) {
for(Integer i: toConsume)
System.err.println(i);
}
}
|
c0ad8a53aa88890a828fc5e6a6dddaba9e69150d0043adf6b4268cf1a1d6dec6 | ['540883aa42f6418d8927793cb3d4892e'] | For one open source project, I opened pull request with commits in my branch. This PR stayed untouched for a few months.
Then, I did rebasing in that branch (because in the meantime it got conflict with master) and I messed something up so pull request got hundreds of commits from tens of contributors, and they are all added as "participants" to PR by GitHub. (I am not sure why GitHub is showing changes when those commits are from master, already merged)
I reverted rebasing in my local branch with git reset and it looks good, but I am wondering can I safely push that branch to origin? Will git push --force do the trick? If I do it, will those other commits be unaffected? What about participants to PR?
Note that this open source project is not mine, and that nobody else worked on my branch.
| 303026d4ce07febc4669f13513e059ab740f4f462ba6526fedfe498499233bad | ['540883aa42f6418d8927793cb3d4892e'] | If we have
function counter() {
static $count = 0;
$count++;
return $count;
}
can we set value of $count outside of function counter()?
I know that you can get values of all static variables inside of function with Reflection:
$vars = (new ReflectionFunction('counter'))->getStaticVariables()
but I can't find simmilar thing for setting.
|
197ce4825df6e6280a7943a4e0833f0cb76f30a2417027c14857036dc1e172bb | ['540f42c3bc204be4bfd69c9466879e38'] | Serverless is looking at your current directory for the config file and cannot find it.
Looking at this line
"program":"${workspaceFolder}\\serverless_site\\node_modules\\serverless\\bin\\serverless
It looks like your workspaceFolder is not the root of the project. You can change that the Serverless project is the root of the workspace or change the cwd (current working directory) in launch.json like the following:
"cwd": "${workspaceFolder}\\serverless_site",
For future reference: Keep in mind that VSCode prefers to open the workspace at the root of the project. Only then does it know by default how to work with all the scripts.
| a772ca89e1e95c77c328fc1bb2321bd3730d77bb995084a199676c84a68d815d | ['540f42c3bc204be4bfd69c9466879e38'] | The following script will take all the ids of the images and by executing the function add the 'active' calls to the image while removing it from others.
const allImageIds = ['button1', 'button6', 'button12'];
const styleImage = selectedImageId => {
allImageIds.forEach(imgId => {
document.getElementById(imgId).classList.remove('active');
});
const image = document.getElementById(selectedImageId);
image.classList.add('active')
}
In HTML put the following onClick calls:
<div>
<input type="radio" id="plan1" name="plan" onclick="styleImage('button1')" checked>
<input type="radio" id="plan2" name="plan" onclick="styleImage('button6')">
<input type="radio" id="plan3" name="plan" onclick="styleImage('button12')"><br>
</div>
|
6ef431906a17c9e4d73d0c6702ebbc8d28a1244ab1b4de1859c63f40d05b39f6 | ['541a0ce0ed6149709a0181a68820329c'] | I am making something and there will be a "Calculating" page on Java on an Applet! so what i want it to do is first drawstring and display "Calculating." then after a second it replaces that string and says "Calculating.." then again replace that string with "Calculating..." and loop that about 5 times. Is there any simple way of doing this??
I want it to display it on the applet!
| 677bd1ed267ebf573e2271861631461841ef3254d7df1c2d820e70b4a7e22d4f | ['541a0ce0ed6149709a0181a68820329c'] | I imported an image into an applet and attempted to make it if the mouse is pressed on the button then it will return "startButtonClicked" to be true and the page will change. My problem is that as soon as i start the applet up it immediately flips to page 2 as if it was true. If i take off the line of code that changes the page if it is true away then it will go back to normal. I tested if i got the dimensions and coordinates right by drawing an oval and seeing where it would draw and it was drawn perfectly onto the button! I don't see what i'm doing wrong. (everything is implemented right)
Here is some of the code that involves it:
int roomPage = 0;
int xPos;
int yPos;
boolean startButtonClicked = false;
boolean instructionsButtonClicked = false;
int startButtonX = 700;
int startButtonY = 200;
code that involves it:
public void init() {
setSize(1024,640);
addKeyListener(this);
addMouseListener(this);
}
public void start(){
if(startButtonClicked = true){
roomPage = 2;
}
}
Pages:
public void paint(Graphics g){
switch (roomPage){
case 0: homeScreen(g); break;
case 1: instructionsPage(g); break;
case 2: startPage(g); break;
}
}
when mouse is released:
public void mouseReleased(MouseEvent me) {
// TODO Auto-generated method stub
xPos = me.getX();
yPos = me.getY();
if (xPos > startButtonX && xPos < startButtonX+216 && yPos >startButtonY &&
yPos < startButtonY+85){
startButtonClicked = true;
}
else{
startButtonClicked = false;
}
repaint();
}
i don't get any errors starting it up but it directly goes to page 2 when i start it up. :( help?
|
bd85663a9d6f189e7211308c4fec16ec41788e37256df69d4fadcab0de57f632 | ['5424ce8e1d454c4d9e609c3f4b43a348'] | Is it correct to say 'I need you both the same'?
I want to say 'I need you both equally' but need it for the song with the word 'same'.
Doesn't it mean 'I need you both to be the same'?
Do you have any idea of what I can say instead?
Thanks a lot
| 3429afd64a4bae8df51df26746bf0789f93c9c0dd8c29310e0f4a9870313b5c2 | ['5424ce8e1d454c4d9e609c3f4b43a348'] | Just come across this question:
Let $X = (X_1, X_2, . . . , X_n)$ be i.i.d. according to a uniform
distribution $U(0, θ)$ for some $θ > 0$. Let
$x = (x_1, x_2, . . . , x_n)$ denote a particular realization of $X$.
Let $T(x) = \max(x_1, . . . , x_n)$.
Show that $p(X = x | T(x) = t)$
doesn’t depend on $\theta$, where now $t ∈ R$ is some fixed real satisfying $0 < t < θ$.
My Question:
But I think, given $T(x) = t$, since $X$ is continuous random variable, there are still infinitely many $X=x$ that may satisfy $\max(x_1, . . . , x_n)=t$, thus $p(X = x | T(x) = t)$ for any given $x$ should be zero?
|
31c98d61be9c3ae5e8d3ffbc5886ab22f707fb3062b55309dbe4806568201c99 | ['5435fc253e544578b2650656f015351a'] | Somewhat hacky workaround:
DockerUser is the user who installed Docker
Both DockerUser and the Jenkins user are in the staff group (verify with groups USERNAME)
As DockerUser:
$ chmod g+rx /Users/DockerUser/Library
$ chmod g+rx /Users/DockerUser/Library/Containers
$ chmod g+rx /Users/DockerUser/Library/Containers/com.docker.docker
$ chmod g+rw /Users/DockerUser/Library/Containers/com.docker.docker/Data/docker.sock
⚠️ Security Implications
Any user account on the machine (not just the Jenkins user) has write
access to all of your docker containers/volumes/anything and launch
anything they like.
Then as your other (Jenkins) user, you should be able to do the following to launch a container:
$ docker run --rm ubuntu uname -a
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
6a5697faee43: Pull complete
ba13d3bc422b: Pull complete
a254829d9e55: Pull complete
Digest: sha256:fff16eea1a8ae92867721d90c59a75652ea66d29c05294e6e2f898704bdb8cf1
Status: Downloaded newer image for ubuntu:latest
Linux dc3d34c548e5 5.4.39-linuxkit #1 SMP Fri May 8 23:03:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
| f2e29e76f12bc295e6552e0a633b99856a69e0b66f0c71c90a1eec2df0bf4ec9 | ['5435fc253e544578b2650656f015351a'] | I'll try that - I bought some dental picks at Harbor Freight (the happiest place on earth, if you ask me!) a while ago. I'll try to find some purer acetone, too... the stuff my beloved uses is purple and not very stinky; I find I have my doubts as to its strength.
As for the apology thing... oh yes. |
1378aada4d26c63e1104dc5d7231cb6f4718935a85354cd9f7ebfbdb27b6b9ae | ['5442b7865b3449f38f4d54094b0e0090'] | You are using find command which is only understood by bash. So if you execute this on bash, bash expands or replaces $(find) with actual result i.e. the files and then javac is invoked with actual files list.
So while executing the same using Runtime.getRuntime.exec() use as
Runtime.getRuntime.exec("bash -c \"javac -cp $(find '/root/discobo/libs' -type f -printf '%p:') -sourcepath '/root/discobo/git/Bot/src' $(find '/root/discobo/git/Bot/src' -name '*.java') -d '/root/discobo/target' -Xlint:all\"")
Hope this helps.
| e66ab222f877fd02b979bf583e2907f3558713efcd0d211757d914640c01e207 | ['5442b7865b3449f38f4d54094b0e0090'] | In some cases, we need to expose a shared resource throughout the application e.g. DB connection but we don't want to
create shared object up-front (before creation of client objects).
explicitly pass shared object to each client object.
then we can use Singleton design pattern.
Typical Singleton class looks like
public class MySingleton {
private MySingleton INSTANCE
private MySingleton() {
}
public static MySingleton getInstance() {
if (INSTANCE == null) {
syncronized (MySingleton.class) {
if (INSTANCE == null) {
INSTANCE = new MySingleton();
}
}
}
return INSTANCE;
}
// instance methods exposing business operation
}
But we can achieve the similar behaviour by making each and every instance methods which are exposing business operation as static. In this approach we don't even need to create single object.
Then why do we need Singleton?
Well, the answer is simple. To isolate actual implementation from the client. Basically we are applying abstraction OOP principle here.
This is helpful If the singleton class is part of library which is used by various clients and library wants to vary the implementation as per the client.
Sample for such singleton can be
public class MySingleton {
private MySingleton INSTANCE
private MySingleton() {
}
public static MySingleton getInstance() {
if (INSTANCE == null) {
syncronized (MySingleton.class) {
if (INSTANCE == null) {
INSTANCE = new MySingletonChild(); // here we are creating an object of subclass of MySingleton.
}
}
}
return INSTANCE;
}
// instance methods exposing business operation
}
Hope this help in understanding Singleton design pattern.
|
e1ca8d2a34dddd5920b0f36cdf00566c13debf1bd57bcc26f9c5c08c8ca30fb0 | ['5456750e38c64c0282788a713f9ce816'] | There's not much reason to go with only one. Get two or more ad networks to leverage your inventory.
Fill rates can fall for many a reason: end of an ad campaign, server error, etc.. If you have a back up, it'll fill up the fill rate. Additionally, you'll be able to compare which ad networks optimize and target ads for your demographic(s) better!
| bbcccb5856bbade1479fb329c8af3df2c64ad919e37ba074db97f59f8e856a42 | ['5456750e38c64c0282788a713f9ce816'] | No, there shouldn't be a problem because it's still showing up. You may even get a higher CTR since people might accidentally click on the ad! The ad should be at least there for five seconds, but remember, if you're showing too many impressions it can hurt your CTR and over all your impressions will be worth less to ad networks.
However, ad networks generally comply with what the IAB sets as mobile ad guidelines. In the future, you can check out IAB.net and see what their rules are.
|
68c961082c1bf00a4685e0d9df98ab2ae795e76fa9661f68d9d55b99f3b15381 | ['5469ad345bd9451eabaabff99bfda64a'] | I am taking over our entire Microsoft based management, this includes our AD servers, GPOs, etc.
So with that being said, I don't know everything about how this setup is configured. However, I have noticed that we seem to be having a lot of permissions based issues with GPO's, or with users that can't change their own attributes on their account. I believe the issue stems from SYSVOL being inaccessible according to Group Policy Management tool, but not sure. SYSVOL itself is available according to "net share".
I don't know of a sure fire way to go through and automatically check "basic" permissions on accounts, to verify that they have access, however I have double checked that the "Authenticated Users" group has at least read permissions on all GPOs. I have run dcdiag and repadmin. The results of dcdiag which can be found here:
Datacenter Master Domain Controller
Office DC
repadmin results show that everything was completed successfully. There are no errors on any of the servers.
When a user applies does a "gpupdate.exe /force" and the computer reboots (as we do software installs) and when I go to look at "gpresult.exe /z" under their own account, I always see the only applied policy as "Default Domain Policy" there is nothing else.
For instance, I have created a "Allow non-administrators to install Printers" GPO that is applied to "domain.net/user/test" OU which is currently set to linked and enforced. I then run "gpupdate.exe /force" followed by "gpresult.exe /z" it doesn't respond. If I then duplicate our "Default Domain Policy" and modify the settings to represent what I had in the "Allow non-administrators to install Printers" GPO, and call it "Non-admin installation of printers" it is successfully applied. Below are the photos of said GPO:
(apparently I can't post any more links to the photos)
Anyways, hopefully you get my point at this time.
| 74a9e052f4d75f377e9229ce26fb85f42143d8358646998d5419553384311d99 | ['5469ad345bd9451eabaabff99bfda64a'] | Hey <PERSON>. Thanks for the response.
I just checked the permissions for "Authenticated Users" group on all of the group policy objects, and they do indeed have "Apply Group Policy" checked for "Allow".
As far as the SYSVOL directory, I am not sure I understand what you mean by where the policy is located. They are all located in the SYSVOL directory, and on top of that, if I go into the proper directory it appears as the new GPOs themselves are still being placed in the SYSVOL folder on different DCs even though it says inaccessible. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.