id
stringlengths
5
11
text
stringlengths
0
146k
title
stringclasses
1 value
doc_2100
A: I very much doubt that it will ever have direct language support or even framework support - it's the kind of thing which is handled perfectly well with 3rd party libraries. My own port of the Java code is explicit - you have to call methods to serialize/deserialize. (There are RPC stubs which will automatically serialize/deserialize, but no RPC implementation yet.) Marc Gravell's project fits in very nicely with WCF though - as far as I'm aware, you just need to tell it (once) to use protocol buffers for serialization, and the rest is transparent. In terms of speed, you should look at Marc Gravell's benchmark page. My code tends to be slightly faster than his, but both are much, much faster than the other serialization/deserialization options in the framework. It should be pointed out that protocol buffers are much more limited as well - they don't try to serialize arbitrary types, only the supported ones. We're going to try to support more of the common data types (decimal, DateTime etc) in a portable way (as their own protocol buffer messages) in future. A: Some performance and size metrics are on this page. I haven't got Jon's stats on there at the moment, just because the page is a little old (Jon: we must fix that!). Re being transparent; protobuf-net can hook into WCF via the contract; note that it plays nicely with MTOM over basic-http too. This doesn't work with Silverlight, though, since Silverlight lacks the injection point. If you use svcutil, you also need to add an attribute to class (via a partial class). Re BinaryFormatter (remoting); yes, this has full supprt; you can do this simply by a trivial ISerializable implementation (i.e. just call the Serializer method with the same args). If you use protogen to create your classes, then it can do it for you: you can enable this at the command line via arguments (it isn't enabled by default as BinaryFormatter doesn't work on all frameworks [CF, etc]). Note that for very small objects (single instances, etc) on local remoting (IPC), the raw BinaryFormatter performance is actually better - but for non-trivial graphs or remote links (network remoting) protobuf-net can out-perform it pretty well. I should also note that the protocol buffers wire format doesn't directly support inheritance; protobuf-net can spoof this (while retaining wire-compatibility), but like with XmlSerializer, you need to declare the sub-classes up-front. Why are there two versions? The joys of open source, I guess ;-p Jon and I have worked on joint projects before, and have discussed merging these two, but the fact is that they target two different scenarios: * *dotnet-protobufs (Jon's) is a port of the existing java version. This means it has a very familiar API for anybody already using the java version, and it is built on typical java constructs (builder classes, immutable data classes, etc) - with a few C# twists. *protobuf-net (Marc's) is a ground-up re-implementation following the same binary format (indeed, a critical requirement is that you can interchange data between different formats), but using typical .NET idioms: * *mutable data classes (no builders) *the serialization member specifics are expressed in attributes (comparable to XmlSerializer, DataContractSerializer, etc) If you are working on java and .NET clients, Jon's is probably a good choice for the familiar API on both sides. If you are pure .NET, protobuf-net has advantages - the familiar .NET style API, but also: * *you aren't forced to be contract-first (although you can, and a code-generator is supplied) *you can re-use your existing objects (in fact, [DataContract] and [XmlType] classes can often be used without any changes at all) *it has full support for inheritance (which it achieves on the wire by spoofing encapsulation) (possibly unique for a protocol buffers implementation? note that sub-classes have to be declared in advance) *it goes out of its way to plug into and exploit core .NET tools (BinaryFormatter, XmlSerializer, WCF, DataContractSerializer) - allowing it to work directly as a remoting engine. This would presumably be quite a big split from the main java trunk for Jon's port. Re merging them; I think we'd both be open to it, but it seems unlikely you'd want both feature sets, since they target such different requirements.
doc_2101
I thought maybe there is not enough buffer, but the stream change takes about 7s (according to the HDCore debug messages) and the bufferTime, according to the associated netStream, is set to 10 seconds by default. Perhaps there's a better way to set up the buffer in HDCore? This worked fine with OSMF, but OSMF doesn't support HTTP DSS. Using: Flash Player 10.2 and Akamai HDCore 2.1.20 Embed Code: <script type="text/javascript"> /*var str = '?'; for(var b in flashVars) str += b + '=' + flashVars[b] + '&'; alert(str);*/ var params = { allowFullScreen:"true", wmode:"window", bgcolor:"#000000" }; swfobject.embedSWF(WEBCAST_SWF_URL, "flashContent", "512", "288", "10.2.0", "/flash/expressinstall.swf?", null, params); </script> A: I noticed that running locally and hitting the swf both worked find. So I changed the wrapper in the HTML and that fixed the "blip". I switched from swfobject to the native non-swfobject wrapper and everything worked (AC_OETags.js). Happy streaming.
doc_2102
I have a feeling it's a simple modification of the regular expression that I'm already using, but my only concern is the order of appearance in the markup. If I have a link with this code: <a href="somepage.html" title="My Page">link text</a> I want it to be parsed the same and not cause any errors even if it appears like this: <a title="My Page" href="somepage.html">link text</a> Here is my processing function: function getLinks($src) { if(preg_match_all('/<a\s+href=["\']([^"\']+)["\']/i', $src, $links, PREG_PATTERN_ORDER)) return array_unique($links[1]); return false; } Would I have to use another regex all together, or would it be possible to modify this one so that the title attribute is stored in the same array of returned data as the href attribute? A: You can build on that regex. Have a look: '/<a(?:\s+(?:href=["\'](?P<href>[^"\'<>]+)["\']|title=["\'](?P<title>[^"\'<>]+)["\']|\w+=["\'][^"\'<>]+["\']))+/i' ...or in human-readable form: preg_match_all( '/<a (?:\s+ (?: href=["\'](?P<href>[^"\'<>]+)["\'] | title=["\'](?P<title>[^"\'<>]+)["\'] | \w+=["\'][^"\'<>]+["\'] ) )+/ix', $subject, $result, PREG_PATTERN_ORDER); Pretty self explanatory, I think. Note that your original regex has the same problem vis-à-vis order of appearance. For example, it would fail to match this tag: <a class="someclass" href="somepage.html">link text</a> Unless you're absolutely sure there will be no other attributes, you can't reasonably expect href to be listed first. You can use the same gimmick as above, where the second branch silently consumes and discards the attributes that don't interest you: '/<a (?:\s+ (?: href=["\'](?P<href>[^"\'<>]+)["\'] | \w+=["\'][^"\'<>]+["\'] ) )+/ix', A: Try this regextrainer I made a while back. The sample contains a pattern like this: <([^ ]+) ?([^>]*)>([^<]*)< ?/ ?\1> which will capture attributes in html. I see now that it doesn't extract the attribute name and value, just the whole attribute text itself. Use this to extract the attribute details: ((([^=]+)=((?:"|'))([^"']+)\4) ?)+
doc_2103
I want to listen action ACTION_BATTERY_CHANGED using Broadcast Receiver. Broadcast will listen even if app is not on mobile stack.I do not want you use Foreground service as it always shows a notification and consume more battery.From android Oreo we can not declare all broadcast receiver on manifest. In short a want to listen broadcast above android Oreo while my app in not on mobile stack and I do not want to use Foreground service. Please suggest what should I do.
doc_2104
A: This is similar to this: Check USB Connection Status on Android Although they do make use of Broadcast Receivers. You say this is a stupid way of doing things, but can you be more specific about that? It is not the case that you can't detect it after the app has started. What you would need to do would be to put <intent-filter> <action android:name="android.intent.action.ACTION_UMS_CONNECTED"/> <action android:name="android.intent.action.ACTION_UMS_DISCONNECTED"/> in your AndroidManifest.xml underneath the <Receiver> entry for the following class: public class IntentReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub if(intent.getAction().equals(Intent.ACTION_UMS_CONNECTED)){ Toast.makeText(context, "mounted", Toast.LENGTH_LONG).show(); Intent myStarterIntent = new Intent(context, tst.class); myStarterIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(myStarterIntent); } } } ` Sources Cited: http://www.anddev.org/start_activity_on_usb_connect-t8814.html A: A1: You said "users often connect their devices to their computers to add music into the apps folder", I guess you mean that the Sd card has connected to PC in MassStorage mode, you can check this as following: String state = Environment.getExternalStorageState(); if (Environment.MEDIA_SHARED.equals(state)) { // Sd card has connected to PC in MSC mode } A2: You said "This won't work if the user starts the app after connecting to USB", I can't agree with you, in ICS, you can register a receiver to listen android.hardware.action.USB_STATE changes, the intent broadcasted by system is in STICKY mode, that to say even the receiver in your app is registered after usb cable connecting, you can also get this message: Intent intent = context.registerReceiver(...); if (intent != null) { boolean isConnected = intent.getBooleanExtra(USB_CONNECTED, false); boolean isMscConnection = intent.getBooleanExtra(USB_FUNCTION_MASS_STORAGE, false); } the intent returned in the method mentioned above the message you missed before usb cable connection to PC. refer to the link below for details: http://www.androidadb.com/source/toolib-read-only/frameworks/base/core/java/android/hardware/usb/UsbManager.java.html
doc_2105
ERROR: type should be string, got "https://docs.oracle.com/javase/8/javafx/user-interface-tutorial/pie-chart.htm\nAnd my code is as follows:\n@FXML\npublic void initialize() {\n pieChart.setTitle(\"Breakdown of Customers by City\");\n pieChart.setLegendSide(Side.LEFT);\n\n final Task<ObservableList<PieChart.Data>> task = new NumClientsAtLocationTask(new CustomerAccountDaoSelect());\n new Thread(task).start();\n task.setOnSucceeded(ae -> {\n\n pieChart.setData(task.getValue());\n\n final Label caption = new Label(\"\");\n caption.setTextFill(Color.DARKORANGE);\n caption.setStyle(\"-fx-font: 24 arial;\");\n\n for (final PieChart.Data data : pieChart.getData()) {\n data.getNode().addEventHandler(MouseEvent.MOUSE_PRESSED,\n ae2 -> {\n caption.setTranslateX(ae2.getSceneX());\n caption.setTranslateY(ae2.getSceneY());\n caption.setText(String.valueOf(data.getPieValue()));\n });\n }\n });\n\n}\n\n\nclass NumClientsAtLocationTask extends Task<ObservableList<PieChart.Data>> {\n private DaoSelect<CustomerAccount> customerAccountDaoSelect;\n\n NumClientsAtLocationTask(DaoSelect<CustomerAccount> customerAccountDaoSelect) {\n this.customerAccountDaoSelect = customerAccountDaoSelect;\n }\n\n @Override\n protected ObservableList<PieChart.Data> call() throws Exception {\n List<CustomerAccount> customerAccounts = customerAccountDaoSelect.select(RunListeners.FALSE);\n\n Map<String, List<CustomerAccount>> customerMap =\n customerAccounts\n .stream()\n .collect(Collectors.groupingBy(CustomerAccount::getCity));\n\n int london = customerMap.get(\"London\").size();\n int phoenix = customerMap.get(\"Phoenix\").size();\n int newYork = customerMap.get(\"New York\").size();\n\n ObservableList<PieChart.Data> results = FXCollections.observableArrayList(\n new PieChart.Data(\"London\", london),\n new PieChart.Data(\"Phoenix\", phoenix),\n new PieChart.Data(\"New York\", newYork));\n\n updateValue(results);\n return results;\n }\n}\n\nThe chart shows fine in its default form, but when I click the mouse on a slice, the label doesn't appear. If I print the label to console, it shows the correct value, it's just not showing up on screen like in the tutorial. Any ideas?\n\nA: The example/tutorial is pretty poor and omits an important detail. You need to add the Label 'caption' to the Scene first.\nIf you were purely using the example code in that tutorial you'd include ((Group) scene.getRoot()).getChildren().add(caption);:\nfinal Label caption = new Label(\"\");\n((Group) scene.getRoot()).getChildren().add(caption); // Add me\ncaption.setTextFill(Color.DARKORANGE);\ncaption.setStyle(\"-fx-font: 24 arial;\");\n\nfor (final PieChart.Data data : chart.getData()) {\n data.getNode().addEventHandler(MouseEvent.MOUSE_PRESSED,\n new EventHandler<MouseEvent>() {\n @Override\n public void handle(MouseEvent e) {\n caption.setTranslateX(e.getSceneX());\n caption.setTranslateY(e.getSceneY());\n caption.setText(String.valueOf(data.getPieValue()) + \"%\");\n }\n });\n}\n\n"
doc_2106
[ { id: 1, name: 'product name', price: '20', }, { id: 3, name: 'Other product', price: '25', }, { id: 1, name: 'product name', price: '20', }, ] Now, at checkout page i need to group products and i used: import * as _ from 'lodash'; const grouped = _.groupBy(cart, (scart) => scart.id); gropued result in an object like: { 1: [{id:1, name,name: 'product name', price: 20}, {id:1, name,name: 'product name', price: 20}] 2: [{id: 2, name:'Other product', price: 25}]} but when i try to use map on the grouped object i got an error (grouped.map is not a function) is there a way to rebuild grouped as an array or should i use foreach in the grouped object? A: The groupBy method returns an object which could be converted to a 2D array using Object.values(grouped), then use two map functions to loop through arrays content : {Object.values(grouped).map((group,i)=>{ return <ul key={i}> {group.map((prod,j)=>{ return <li key={j}>{prod.name}</li> })} </ul> }) } if you want to show only the first item in the nested array you could do : {Object.values(grouped).map((group,i)=>{ return <p key={i}>{group[0].name}</p> }) } A: Lodash's _.map() works can iterate objects: import React from 'react'; import _ as * from 'lodash'; const Checkout = ({ cart }) => { const grouped = _.groupBy(cart, 'id'); return ( <div> <h1 className="uppercase">{cart.length} products in cart</h1> <div> {_.map(grouped, (single) => ( <p> {single[0].name} - {single.length} </p> ))} </div> </div> ); }; Note: It's better to import specific lodash functions, because the newer versions support tree shaking, so I would use import like this: import { groupBy, map } from 'lodash'; A: Finally solved import React from 'react'; import * as _ from 'lodash'; const Checkout = ({ cart }) => { const grouped = _.groupBy(cart, (scart) => scart.id); let cartform = []; Object.entries(grouped).forEach(([key, value]) => { cartform.push(value); }); return ( <div> <h1 className="uppercase">{cart.length} products in cart</h1> <div> {cartform.map((single) => ( <p> {single[0].name} - {single.length} </p> ))} </div> </div> ); };
doc_2107
Function GenerateSampleHashTable() As Object Dim ht As Object Set ht = CreateObject("System.Collections.HashTable") ht.Add "Foo", "Bar" ht.Add "Red", "FF0000" ht.Add "Green", "00FF00" ht.Add "Blue", "0000FF" Set GenerateSampleHashTable = ht End Function Sub TestHashTable() Dim ht As Object '*** PRETEND THIS CAME OUT OF A C# COMPONENT *** Set ht = GenerateSampleHashTable Debug.Print ht.ContainsKey("Foo") Dim oKeys As Object Set oKeys = CreateObject("System.Collections.ArrayList") oKeys.Capacity = ht.Count Dim vKeys() As Variant vKeys() = oKeys.ToArray() Dim col As mscorlib.ICollection Set col = ht.Keys() 'col.CopyTo oKeys, 0 'Runtime error: Type mismatch 'col.CopyTo vKeys(), 0 'Compile Error: Type mismatch Dim vKeyLoop As Variant For Each vKeyLoop In vKeys() Debug.Print vKeyLoop, ht.Item(vKeyLoop) Next End Sub A: I am not surprised that passing a VBA array to a .NET method that expects System.Array (such as CopyTo(System.Array, Integer)) causes incompatibility. I have not achieved much success in directly using the collection returned from .Keys, so copying it to an ArrayList does seem to be a helpful workaround. HashTable.Keys returns an ICollection, and ArrayList can accept an ICollection in its AddRange(), so this should work: Dim ht As Object Set ht = GenerateSampleHashTable() Dim oKeys As Object Set oKeys = CreateObject("System.Collections.ArrayList") oKeys.AddRange ht.Keys() The resulting oKeys can be enumerated directly: Dim i As Long For i = 0 To oKeys.Count - 1 Debug.Print oKeys.Item(i) Next Or it can be enumerated with For Each with the help of a wrapper class described in Wrap .Net ArrayList with custom VBA class get iterator (where all credits go): Dim wr As ThatCollectionWrapperClass Set wr = New ThatCollectionWrapperClass wr.Init oKeys 'Poor man's constructor - add that method to the class and remove its Class_Initialize Dim k As Variant For Each k In wr Debug.Print k Next
doc_2108
From a previous post I've seen on here, I'm trying to do something like this: //in Register class public void submission(View view){ //Call User Constructor based on info received from Registration Activity EditText enteredUser = (EditText)findViewbyId(R.id.enteredUser); //then use the input from this field to do other stuff } However for some reason, i keep getting the error that findViewById(int) is undefined for type Register (the name of the class I'm currently in). Could someone tell me what I'm doing wrong? I'm pretty sure I have the correct import statements at the top (android.widget.EditText). Here is the corresponding xml code: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".Register" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Enter New UserName:" /> <EditText android:id="@+id/enteredUser" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:ems="10" > <requestFocus /> </EditText> ...more input buttons etc... <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/confirmPass" android:layout_alignParentBottom="true" android:layout_marginBottom="64dp" android:onClick = "submission" <----- Used to call the submission function after android:text="Submit" /> all inputs have been filled </RelativeLayout> Sorry for a bit of a long winded question but I would greatly appreciate any help. Thanks! A: Your compile time error is because of a typo: findViewbyId needs to be findViewById Then make sure to call setContentView() after calling super.onCreate(savedInstanceState). I highly recommend following the Building Your First App tutorial, and clearly paying attention to the code. And as usual, familiarize yourself with the documentation. If you have a compile time error, check it first, you may just have a typo!
doc_2109
Maybe someone has experience with this or some related tasks. I'm quite new to programming, and would be very grateful for any advice or thoughts. Thanks! A: The right answer is that for now it is impossible. I have contacted screencast.com support, and they told me that they are going to make a puplic API somewhen in future
doc_2110
The main script: import * as module from 'module.js'; function testUndefined() { console.log(typeof dummyFunction);//writes "undefined" as expected } function main() { testUndefined() module.testUndefinedExport() } module.js export function testUndefinedExport() { console.log(typeof dummyFunction); //throws an error "Reference to undeclared variable 'dummyFunction'" } Why the behaviour is so different?
doc_2111
In general, I am asking how can I make a desktop program in Java which can store data from its users?? A: Sounds like you want SQLite, There is another SO question here about it. A: SQLite as IanNorton mentioned is a good alternative. Other good alternatives are Apache Derby or the H2 database, both providing an embedded (install-free) java database. A: Does MySQL have its own embedded version? Normal "embedded MySQL" is a native code library (libmysqld) that is not really suitable for use with Java. However, there is something called mysql-je that purports to be a Java compatible wrapper. The problem is that it is based on a rather old version of MySQL, and hasn't been updated since 2006. There are also postings on the MySQL forums about using embedded MySQL with Java, but there's no sign that it is supported. So I think you'd be better of going with a one of the alternatives; e.g. SQLite, Derby or H2. A: No need of multiple installations of MYSQL database if all the machines where you want to access are in a LAN. In that case you can have single database installation and access it from multiple systems using the IP address of the database machine. We can access a remote database through Internet as well, using the IP Address of the machine in which database exists..
doc_2112
But the word "Comments" should be displayed under the number and not next to it. Similar to this So far the text is being displayed next to each other. DEMO https://jsfiddle.net/halnex/d5sft5pt/9/ HTML <div class="post-meta-alt"> <div class="social-share-top"> <span class="social-share-top-text">Share</span> <a class="btn btn-social-icon btn-facebook"> <span class="fa fa-facebook"></span> </a> <a class="btn btn-social-icon btn-twitter"> <span class="fa fa-twitter"></span> </a> <a class="btn btn-social-icon btn-google"> <span class="fa fa-google"></span> </a> <a class="btn btn-social-icon btn-pinterest"> <span class="fa fa-pinterest"></span> </a> </div> <div class="comments-top"> <a class="btn btn-social-icon btn-pinterest"> <span class="fa fa-comment"></span> </a> <p>78</p> <p>Comments</p> </div> <div class="author-top"> author name </div> </div> CSS .post-meta-alt { border-top: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; padding: 20px 0; margin-top: 20px; margin-bottom: 20px; display: flex; } .post-meta-alt span.social-share-top-text { text-transform: uppercase; margin-right: 10px; } .post-meta-alt .comments-top, .post-meta-alt .author-top { display: inline-flex; margin-left: 20px; } PS: Is this the correct way of doing it with Bootstrap? Using Flexbox or is there a better conventional way of achieving this? A: You need to wrap the paragraphs in a div: <div class="coment"> <p>78</p> <p>Comments</p> </div> And add style to organize them .coment p { margin: 3px; line-height: 1; } See jsfiddle
doc_2113
subroutine save_vtk integer :: filetype, fh, unit integer(MPI_OFFSET_KIND) :: pos real(RP),allocatable :: buffer(:,:,:) integer :: ie if (master) then open(newunit=unit,file="out.vtk", & access='stream',status='replace',form="unformatted",action="write") ! write the header close(unit) end if call MPI_Barrier(mpi_comm,ie) call MPI_File_open(mpi_comm,"out.vtk", MPI_MODE_APPEND + MPI_MODE_WRONLY, MPI_INFO_NULL, fh, ie) call MPI_Type_create_subarray(3, int(ng), int(nxyz), int(off), & MPI_ORDER_FORTRAN, MPI_RP, filetype, ie) call MPI_type_commit(filetype, ie) call MPI_Barrier(mpi_comm,ie) call MPI_File_get_position(fh, pos, ie) call MPI_Barrier(mpi_comm,ie) call MPI_File_set_view(fh, pos, MPI_RP, filetype, "native", MPI_INFO_NULL, ie) buffer = BigEnd(Phi(1:nx,1:ny,1:nz)) call MPI_File_write_all(fh, buffer, nx*ny*nz, MPI_RP, MPI_STATUS_IGNORE, ie) call MPI_File_close(fh, ie) end subroutine The undefined variables come from host association, some error checking removed. I receive this error when running it on a national academic cluster: *** An error occurred in MPI_Isend *** reported by process [3941400577,18036219417246826496] *** on communicator MPI COMMUNICATOR 20 DUP FROM 0 *** MPI_ERR_BUFFER: invalid buffer pointer *** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort, *** and potentially your MPI job) The error is triggered by the call to MPI_File_write_all. I am suspecting it may be connected with size of the buffer which is the full nx*ny*nz which is in the order of 10^5 to 10^6., but I cannot exclude a programming error on my side, as I have no prior experience with MPI I/O. The MPI implementation used is OpenMPI 1.8.0 with the Intel Fortran 14.0.2. Do you know how to make it work and write the file? --- Edit2 --- Testing a simplified version, the important code remains the same, full source is here. Notice it works with gfortran and fails with different MPI's with Intel. I wasn't able to compile it with PGI. Also I was wrong in that it fails only on different nodes, it fails even in single process run. >module ad gcc-4.8.1 >module ad openmpi-1.8.0-gcc >mpif90 save.f90 >./a.out Trying to decompose in 1 1 1 process grid. >mpirun a.out Trying to decompose in 1 1 2 process grid. >module rm openmpi-1.8.0-gcc >module ad openmpi-1.8.0-intel >mpif90 save.f90 >./a.out Trying to decompose in 1 1 1 process grid. ERROR write_all MPI_ERR_IO: input/output error >module rm openmpi-1.8.0-intel >module ad openmpi-1.6-intel >mpif90 save.f90 >./a.out Trying to decompose in 1 1 1 process grid. ERROR write_all MPI_ERR_IO: input/output error [luna24.fzu.cz:24260] *** An error occurred in MPI_File_set_errhandler [luna24.fzu.cz:24260] *** on a NULL communicator [luna24.fzu.cz:24260] *** Unknown error [luna24.fzu.cz:24260] *** MPI_ERRORS_ARE_FATAL: your MPI job will now abort -------------------------------------------------------------------------- An MPI process is aborting at a time when it cannot guarantee that all of its peer processes in the job will be killed properly. You should double check that everything has shut down cleanly. Reason: After MPI_FINALIZE was invoked Local host: luna24.fzu.cz PID: 24260 -------------------------------------------------------------------------- >module rm openmpi-1.6-intel >module ad mpich2-intel >mpif90 save.f90 >./a.out Trying to decompose in 1 1 1 process grid. ERROR write_all Other I/O error , error stack: ADIOI_NFS_WRITECONTIG(70): Other I/O error Bad a ddress A: In line buffer = BigEnd(Phi(1:nx,1:ny,1:nz)) the array buffer should be allocated automatically to the shape of the right hand side according to the Fortran 2003 standard (not in Fortran 95). Intel Fortran as of version 14 does not do this by default., it requires the option -assume realloc_lhs to do that. This option is included (with other options) in option -standard-semantics Because this option was not in effect when the code in the question was tested the program accessed an unallocated array and undefined behavior leading to a crash followed.
doc_2114
Bizarrely, when I make the same query in the playground (for either my Prisma or Apollo-Server servers) I do get back the array. My query looks like this: const user = await ctx.db.query.user({ where: { id: ctx.userId } }); My type definition looks like this: type User { id: ID! @id name: String! email: String! @unique password: String! club: String! permissions: [Permission!]! @scalarList(strategy: RELATION) createdAt: DateTime! @createdAt updatedAt: DateTime! @updatedAt } permissions looking like enum Permission { ADMIN CLUB_ADMIN USER FRIEND } I haven’t included my query resolver as I have just forwarded that to the DB using “forward-to” But the CL of user is { id: 'cjxm9ohfqvkvh0b5963iy734i', name: 'BERTIE BOBBINS', email: 'BERTIE@DOGS.COM', password: '$2b$10$eLPoBuuenogLabiFb4tRFu0KV7LI4LxARhHecPYVbP0qnt5VvcZ3W', club: 'Dog Club', createdAt: '2019-07-02T20:30:49.670Z', updatedAt: '2019-07-02T20:30:49.670Z' } So not including the Permissions array. A: Introspection system this introspection types * *__Schema *__Type *__TypeKind *__Field *__InputValue *__EnumValue *__Directive To query the enums you need to use the __Type query resolver. enum Permission { ADMIN CLUB_ADMIN USER FRIEND } query for enum query { __type(name: "Permission") { name enumValues { name } } } The __type query resolver requires the name parameter. This parameter allows you to search your schema for items such as objects and enums based on their name. { "data": { "__type": { "name": "Permission", "enumValues" : [ { name: "ADMIN" }, { name: "CLUB_ADMIN" }, { name: "USER" }, { name: "FRIEND" } ] } } } This returns the name of the enum with all of its values. To use these values, store them in a variable when querying the enums. PermissionsList = data.__type.enumValues If you need enum inside user object ref this If you use apollo server then read apollo-server and graphql-tools A: I don't quite understand: you mention you simply used the prisma-binding forwardTo function, but then provide your sample query where you forward to the db from the context using ctx.db.query.user. Did you have the issue in both cases? For the forwardTo instance, I do not know the answer. But for the second case, I also had this issue, and was able to resolve it by passing in the info object from the resolver function signature as the second argument to the query. const user = await ctx.db.query.user( { where: { id: ctx.request.userId } }, info );
doc_2115
Character_Count := Size(Argument(1)); The compiler is telling me that Integer and File_Size don't match up, even though File_Size is a subtype of Integer, I'm pretty sure. How can I convert it? A: Ada.Directories.File_Size is not a subtype of Integer. It's defined in the language reference manual as: type File_Size is range 0 .. *implementation-defined*; If you think about it, it wouldn't make much sense for it to be a subtype; Integer can be as narrow as 16 bits, which is hardly enough to hold the size of an arbitrary file. You can use a conversion to convert to Integer: Character_Count := Integer(Size(Argument(1))); but it would probably be much better to declare Character_Count as a File_Size in the first place.
doc_2116
#include <iostream> #include <fstream> #include <string> using namespace std; const char *path = "/Users/eitangerson/desktop/Finance/ex2.csv"; ofstream file(path); //string filename = "ex2.csv"; int main(int argc, const char * argv[]) { file.open(path,ios::out | ios::app); file <<"A ,"<<"B ,"<< "C"<<flush; file<< "A,B,C\n"; file<<"1,2,3"; file << "1,2,3.456\n"; file.close(); return 0; } A: I was able to get it to work by declaring file object instead of initializing it. Take a look: #include <iostream> #include <fstream> #include <string> using namespace std; const char* path = "ex2.csv"; ofstream file; //string filename = "ex2.csv"; int main(int argc, const char* argv[]) { file.open(path, ios::in | ios::app); file << "A ," << "B ," << "C" << flush; file << "A,B,C\n"; file << "1,2,3"; file << "1,2,3.456\n"; file.close(); return 0; } So you're on the right path. I would also suggest that you don't use global variables. Other than that you should be good to go! EDIT: I changed the path in my version so I can just word in the project folder.
doc_2117
foreach (var column in table.columns) { if (column.Text == "Hello") { table[column].delete(); } } Is there a real world implementation of the above pseudo code? A: Unfortunately, there is no concept of a "column" in a word processing table (DocumentFormat.OpenXml.WordProcessing.Table), only rows and cells. If you can assume the first row contains column names, and all rows contain the same number of cells, you can accomplish your task. One thing you have to be careful of (and one problem in your pseudocode above) is that you can't delete things from the enumeration you're currently iterating over. Here's how I would accomplish this: var rows = table.Elements<TableRow>(); var firstRowCells = rows.ElementAt(0).Elements<TableCell>(); var cellNumbersToDelete = new List<int>(); for( int i=0; i<firstRowCells.Count(); i++ ) if( GetCellText( firstRowCells.ElementAt( i ) ) == "Hello" ) cellNumbersToDelete.Add( i ); foreach( var cellNumberToDelete in cellNumbersToDelete ) { foreach( var row in rows ) { cellToDelete = row.ElementAt( cellNumberToDelete ); row.RemoveChild( cellToDelete ); } } I don't have time right now to test this solution, so it'll probably require some tweaking, but it should give you a general idea about how to accomplish your task. The method GetCellText referenced above would look something like this: string GetCellText( TableCell cell ) { var p = cell.Elements<Paragraph>().First(); var r = p.Elements<Run>().First(); var t = r.Elements<Text>().First(); return t.Text; }
doc_2118
with input, output and expected output below How can we data wrangle 1. When we function and mutate as shown below, there is ambiguity each time based on column name string 2. how can we rbind these once we have unique column names library(tidyverse) # Basically, "." means ",". So, better we remove . and PC and convert to Numeric df1 <- tribble( ~`ABC sales 01.01.2019 - 01.02.2019`, ~code, "1.019 PC", 2000, # Actually, it 1019 (remove . and PC ) "100 PC", 2101, "3.440 PC", 2002 ) df2 <- tribble( ~`ABC sales 01.03.2019 - 01.04.2019`, ~year, "6.019 PC", 2019, "20 PC", 2001, "043.440 PC", 2002 ) df3 <- tribble( ~`ABC sales 01.05.2019 - 01.06.2019`, ~year, "1.019 PC", 2000, "701 PC", 2101, "6.440 PC", 2002 ) # Input data input_df = list(df1,df2,df3) #### function to clean data # str_replace is used twice because # remove PC and dot data_read = function(file){ df_ <- df %>% #glimpse() # Select the column to remove PC, spaces and . # Each time, column name differs so, `ABC sales 01.01.2019 - 01.02.2019` cannot be used mutate_at(sales_dot = str_replace(select(contains('ABC')), "PC",""), sales = str_replace(sales_dot, "\\.",""), # name the new column so that rbind can be applied later sales_dot = NULL, # delete the old column vars(contains("ABC")) = NULL # delete the old column ) df_ } # attempt to resolve # To clean the data from dots and PC output_df1 <- map(input_df, data_read) # or lapply ? # rbind output = map(output_df1, rbind) # or lapply ? expected_output <- df3 <- tribble( ~sales, ~year, "1019", 2000, "100", 2101, "3440", 2002, "6019", 2019, "20", 2001, "043440", 2002, "1019", 2000, "701", 2101, "6440", 2002 ) A: Using purrr, dplyr and stringr, you can do: map_df(.x = input_df, ~ .x %>% set_names(., c("sales", "year"))) %>% mutate(sales = str_remove_all(sales, "[. PC]")) sales year <chr> <dbl> 1 1019 2000 2 100 2101 3 3440 2002 4 6019 2019 5 20 2001 6 043440 2002 7 1019 2000 8 701 2101 9 6440 2002
doc_2119
ThirdPartyService has the following methods that it exposes and which we consume in different places through MyService wrapper. * *MethodToCreate As it is a third party service, I don't know the business logic wrapped inside it. So I can't create a test double for that service directly as it is a library that we use. However the third party library often returns errors when different types of bad things happen, like * *when there is a network problem *when there is a timeout in communicating with any other underlying services *when the third party service is down *many other cases It also returns the actual results when things are working fine. I'd like to create a MyServiceTestDouble class that would help me test every type of interaction with ThirdPartyService cases. So IMyService and MyService would look something like this (just an example, only one method): public interface IMyService { int MethodToCreate(string arg1, string arg2); } public class MyService : IMyService { private readonly ThirdPartyService _thirdPartyService; public MyService() { _thirdPartyService = new ThirdPartyService(); } public int MethodToCreate(string arg1, string arg2) { var thirdPartyServiceTypeArg = ParseStringToThirdPartyServiceArg(arg1); return _thirdPartyService.MethodToCreate(thirdParthyServiceTypeArg, arg2); } } public class MyServiceTestDouble : IMyService { public MyServiceTestDouble() { } public int MethodToCreate(string arg1, string arg2) { return (new Random).Next(); } } public static class MyServiceFactory { public static IMyService GetMyService() { if(!Config.IsTestMode) return new MyService(); return new MyServiceTestDouble(); } } But I'm stuck where I need to make the methods in MyServiceTestDouble return different types of output depending on my unit test. Like when it is a good case that I am testing, I would like it to return proper actual results. When my test case is for testing Exceptions, I would like the methods in MyServiceTestDouble to return appropriate exceptions. What is the best approach to do this? The one approach I think that will work is to create a MyServiceFactory that returns different Test Double Implementations based on the Unit test case scenario. But this would mean I need to have multiple implementations of MyServiceTestDouble like MyServiceTestDoubleGood. MyServiceTestDoubleNetworkExceptions, MyServiceTestOutageExceptions etc. I'm pretty sure that there could be a better way that I'm currently not aware of. I would like to know if there are any unit testing framework that would help with this sort of testing. I would also like to know if this is possible in a more elegant way without using any frameworks. A: A better solution would be to use the moq library, which has shorthand methods for returning data or different kinds of exceptions depending on special input values. So you can say, if input is 1, throw an error; if input is 3, return data, etc., like that. Installation is here The Getting Started has some examples: using Moq; var mockMyService = new Mock<IMyService>(); mockMyService.Setup(o => o.MethodToCreate("arg1", "arg2")).Returns(4); mockMyService.Setup(o => o.MethodToCreate("cut","cable")).Throws(new NetworkException("the network is down")); Or, you can mimic this feature of moq in your dummy class with a switch statement: public int MethodToCreate(string arg1, string arg2) { switch(arg1){ case "a": throw new Exception(); // throw exception case "z": return 4; // good data } }
doc_2120
Everytime I send a request to the backend I get the following error Access to XMLHttpRequest at 'https://playlist-manager-backend.herokuapp.com/user/authenticate' from origin 'https://playlist-manager-admin.herokuapp.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Here is the code of my server.js pushed on the backend app (playlist-manager-backend) const express = require("express"); const { connect: dbconnect } = require("./src/db"); const { apiPort } = require("./src/config"); const routes = require("./src/routes"); const bodyParser = require("body-parser"); // Connect to the database dbconnect(); // Create the server const app = express(); // const cookieParser = require("cookie-parser"); // app.use(cookieParser()); app.use(bodyParser.json({ limit: "5mb" })); // app.get("/", (req, res) => res.send("Hello World")); const cors = require("cors"); /*let whitelist = ["https://playlist-manager-admin.herokuapp.com/","https://playlist- manager-user.herokuapp.com/"];*/ const corsOptions = { origin: ["https://playlist-manager-admin.herokuapp.com/", "https://playlist-manager-user.herokuapp.com/"], preflightContinue:false, credentials: true } app.use(cors(corsOptions)); app.use("/", routes); app.use(express.static("./adverts")); app.listen(apiPort, () => { console.log(`Server is listening on port ${apiPort}`); }); The routes to the backend functions are defined using router in the routes.js file like this. const express = require("express"); const router = express.Router(); const userRoute = require("../user/user.route"); const playlistRoute = require("../playlist/playlist.route"); const videoRoute = require("../video/video.route"); const annonceUploadRoute = require("../annoncesUpload/annoncesUpload.route"); const historyRoute = require("../history/history.route"); const advertiserRoute = require("../advertiser/advertiser.route"); router.use("/user", userRoute); router.use("/playlist", playlistRoute); router.use("/video", videoRoute); router.use("/annoncesUpload", annonceUploadRoute); router.use("/history", historyRoute); router.use("/annonceur", advertiserRoute); module.exports = router; Here is an example of how routes are implemented : router.post("/getById", async function(req, res) { const request = { _id: req.body._id, }; const result = await bo.getById(request); res.send(result); }); The frontend sends a post request to the backend using a service implemented like this : import { Injectable } from '@angular/core'; import {HttpClient} from '@angular/common/http'; import { Observable } from 'rxjs'; import { environment } from 'src/environments/environment'; export interface BackendData { success: string ; data: any ; } @Injectable({ providedIn: 'root' }) export class MessageService { constructor(private http:HttpClient) { } sendMessage(Url:string, data:any): Observable<BackendData> { const serveur = environment.server + Url ; return this.http.post<BackendData>( serveur, data, {withCredentials: true} ); } } I tried every solutions I saw online but I always got the same error or another error related to CORS policy. I need help figuring out this behavior. The app was working fine locally when I specified localhost with cors package like in the documentation. Edit : I removed slashes on the URL's and my server.js is like this : const express = require("express"); const { connect: dbconnect } = require("./src/db"); const { apiPort } = require("./src/config"); const routes = require("./src/routes"); const bodyParser = require("body-parser"); // Connect to the database dbconnect(); // Create the server const app = express(); // const cookieParser = require("cookie-parser"); // app.use(cookieParser()); app.use(bodyParser.json({ limit: "5mb" })); // app.get("/", (req, res) => res.send("Hello World")); const cors = require("cors"); /*let whitelist = ["https://playlist-manager-admin.herokuapp.com/", "https://playlist-manager-user.herokuapp.com/"];*/ const corsOptions = { origin: ["https://playlist-manager-admin.herokuapp.com", "https://playlist-manager-user.herokuapp.com"], credentials: true } app.use(cors(corsOptions)); app.use("/", routes); app.use(express.static("./adverts")); app.listen(apiPort, () => { console.log(`Server is listening on port ${apiPort}`); }); This is the network tab after sending the request This is the xhr request shown in the network tab This is the preflight request in the network tab A: Thanks to jubObs comments I managed to fix this. The source of the problem was that the backend server wasn't starting which was causing a 503 status. I forgot to add the file defining the credentials for the database connections which caused the backend to fail before adding the headers. here is the new server.js code : const express = require("express"); const { connect: dbconnect } = require("./src/db"); const { apiPort } = require("./src/config"); const routes = require("./src/routes"); const bodyParser = require("body-parser"); // Connect to the database dbconnect(); // Create the server const app = express(); // const cookieParser = require("cookie-parser"); // app.use(cookieParser()); app.use(bodyParser.json({ limit: "5mb" })); // app.get("/", (req, res) => res.send("Hello World")); const cors = require("cors"); /*let whitelist = ["https://playlist-manager-admin.herokuapp.com/", "https://playlist-manager-user.herokuapp.com/"];*/ const corsOptions = { origin: ["https://playlist-manager-admin.herokuapp.com", "https://playlist-manager-user.herokuapp.com"], credentials: true } app.use(cors(corsOptions)); app.use("/", routes); app.use(express.static("./adverts")); app.listen(apiPort, () => { console.log(`Server is listening on port ${apiPort}`); }); The database connection was using dotenv and the .env file that was defining the database credentials wasn't present in the main branch so I pushed it. To figure this out I checked the application logs on heroku which are in "more" and "view logs".
doc_2121
public class PDFObject { /** the NULL PDFObject */ public static final PDFObject nullObj = new PDFObject(null, NULL, null); .. } How can I convert this into PHP? Is it possible to create an instance of an object while still declaring it? Source File: http://code.google.com/p/txtreaderpdf/source/browse/trunk/txtReader/src/com/sun/pdfview/PDFObject.java A: This is the workaround you would need in PHP: class PDFObject { /** the NULL PDFObject */ public static $nullObj = NULL; .. } PDFObject::$nullObj = new PDFObject(null, NULL, null); Normally expression assignments are done in the constructor. But since you want a static class attribute, you will need to resort to inline/global code like that.
doc_2122
Would different types of CPUs affect the speedup calculation, or it wouldn't matter as long as I used the same one every time? And if they make a difference. Which one should I use? A: This is an extremely difficult question. You have to understand what gem5 models model, and what real CPU or future CPU you want to model, and if the accuracy is enough. A quick gem5 CPU overview can be found here. But to determine what the real hardware looks like, you have to search for public information on a specific hardware of interest, see also this post.
doc_2123
A: Looking at the JDK 1.8 sources, it looks like it's just a static array which is initialized as part of class initialization - it only caches the values 0 to 10 inclusive, but that's an implementation detail. For example, given dasblinkenlight's post, it looks like earlier versions only cached 0 and 1. For more detail - and to make sure you're getting information about the JDK which you're actually running - look at the source of the JDK you're using for yourself - most IDEs will open the relevant source code automatically, if they detect the source archive has been included in your JDK installation. Of course, if you're using a different JRE at execution time, you'd need to validate that too. It's easy to tell whether or not a value has been cached, based on reference equality. Here's a short but complete program which finds the first non-negative value which isn't cached: import java.math.BigDecimal; public class Test { public static void main(String[] args) { for (long x = 0; x < Long.MAX_VALUE; x++) { if (BigDecimal.valueOf(x) != BigDecimal.valueOf(x)) { System.out.println("Value for " + x + " wasn't cached"); break; } } } } On my machine with Java 8, the output is: Value for 11 wasn't cached Of course, an implementation could always cache the most recently requested value, in which case the above code would run for a very long time and then finish with no output... A: If I m not wrong it caches only zero,one, two and ten, Thats why we have only public static final BigInteger ZERO = new BigInteger(new int[0], 0); public static final BigInteger ONE = valueOf(1); private static final BigInteger TWO = valueOf(2); public static final BigInteger TEN = valueOf(10); That also calls valueOf(x) method.
doc_2124
ab cd ef gh ij kl mn I want to highlight all words at line head: ab ef ij (yes, we have indentations) mn, how to write the regex:? I had a try at http://ace.c9.io/tool/mode_creator.html but /^\s*/ /\n/ was not working as expected. How actually do they work? A: Ace concatenates all the regular expressions in rules in a group. So if you have a group like [{token: .., regex: "regex1"}, {token: .., regex: /regex2/}, {defaultToken: ..}] Resulting regular expression will be /(regex1)(regex2)($)/ (see here) Every line in document is repeatedly matched to the resulting regex and for each match token with the type of corresponding rule is created. For unmatched text defaultToken is used. Since regular expressions are matched line by line /\n/ in rules will not match anything. As for your first question I think {token : "comment", regex : "^\\s*\\w+"} should work. A: Here's my solution, I have to put /^\s*/ before parameter, and it works. this.$rules = { start: [{ token: 'support.function', regex: /[^\(\)\"\s]+/, next: 'line' }], line: [{ token: 'markup.raw', regex: /^\s*/, next: 'start', }, { token: 'variable.parameter', regex: /[^\(\)\"\s]+/ }, { token: 'markup.raw', regex: /^\ */, next: 'start', }] } Full code here: https://github.com/Cirru/ace/blob/master/lib/ace/mode/cirru_highlight_rules.js
doc_2125
Move a view up only when the keyboard covers an input field The scrollview is not being moved from the bottom by the keyboard height as expected. The variable 'keyboardSize!.height' is receiving the correct height value, and if I enter random values to the 'bottom' parameter I get the same result. However, if I add values to the 'top' and 'left' parameters they DO move the scrollview when the keyboardWasShown function is called. let contentInsets : UIEdgeInsets = UIEdgeInsets(top : 0.0, left : 0.0, bottom : keyboardSize!.height, right : 0.0) self.scrollView.contentInset = contentInsets self.scrollView.scrollIndicatorInsets = contentInsets I've had this working fine with a TableViewController but not with the UIScrollView. In this case the UIViewController has a UIView and a UIScrollView layered above it. Any help appreciated. * Edit * The issue was a result of ambiguous contraints in the IB. After resetting them and using suggested constraints, the UIScrollView worked correctly. Originally the top constraint was set in relation to the UINavigationBar and not to the top of the view. A: you need to scroll the textfield up past the keyboard in the scrollview CGRect visibleRect = CGRect(x: self.view.frame.origin.x, y: self.view.frame.origin.y, width: self.view.frame.size.width, height: self.view.frame.size.height - keyboardSize?.height ?? 0); [scrollView setContentOffset:visibleRect.center animated:YES];
doc_2126
Is it possible to open or view the code of the editor inside the editor without opening a modal? Something like this: A: The code plugin that comes with TinyMCE places the HTML code is a separate window - there in no configuration option that will allow the code to appear directly in the editor's main window. TinyMCE has a place to make such feature requests: https://community.tinymce.com/communityIdeasHome ...so if you post something there they may add such a feature in a future release of the editor. When you post your idea there make sure you explain why the current code dialog is insufficient for your use case. A: You should have a look at how TinyMCE is implemented in WordPress. Code Is editable in a text tab. A: I had a similar request (displaying html source in editor) and achieved a pretty simple and (for me) sufficient solution by modifying the initial (open source) code plugin: var e = tinymce.util.Tools.resolve("tinymce.PluginManager"), p = tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"), o = function (o) { var e = o.getContent({source_view: !0}); var b = o.getBody(); if (b.getAttribute("code") === "true") { b.setAttribute("code", "false"); b.style.backgroundColor = "white"; b.style.color = "black"; b.style.fontFamily = "Helvetica"; o.setContent(p.DOM.decode(e)); } else { b.setAttribute("code", "true"); b.style.backgroundColor = "black"; b.style.color = "white"; b.style.fontFamily = "Monaco"; o.setContent(p.DOM.encode(e)); } }; Instead of opening a new window, it just changes the css of the editor (background, color, font) and sets a data-attribute (enables toggling between the initial view and the code view). The p.DOM.encode(e) then allows to display the html tags. I'm not very experienced in javascript, but it works good so far. Anyway, feel free to correct / improve things.
doc_2127
I have tried using the css hover property where I added the related the class inside the hover in scss file. <div class="search-results" *ngFor="let user of extResults"> <div>{{ user.user }}</div> <div class="ext"> <span class="icon-phone icon-font-icon_Phone"></span>{{ user.ext }} <a [href]="'mailto:' + user.email" class="anchor" ><span class="icon-email icon-font-icon_Mail name"></span> <span class="email-text">Email</span></a > </div> </div> .search-results { color: #424242; font-size: 14px; padding: 10px; padding-left: 10px; &:hover { background-color: rgba(#d8d8d8, 0.26); } .ext { color: #979797; font-size: 12px; font-family: colfax-medium; } .icon-phone { font-size: 10px; padding-top: 4px; padding-right: 3px; &:before { color: #d9415c; } } .anchor { float: right; text-decoration: none; } .icon-email { font-size: 13px; padding-top: 4px; padding-right: 3px; &:before { color: #d9415c; } } .email-text { margin-right: 10px; font-size: 14px; color: #d9415c; } } Expected to see the text "Email" and the "icon-font-icon_Mail" on hover of the results but actual output is that I am seeing the "Email" and "Icon" in all of the search-results. A: This can be achieved by adding mouse enter and leave event listeners as: HTML Code <div class="search-results" *ngFor="let user of extResults;let i = index;"> <div (mouseenter)="mouseHovering(i)" (mouseleave)="mouseLeft(i)"> <div>{{ user.user }}</div> <div class="ext"> <span class="icon-phone icon-font-icon_Phone"></span>{{ user.ext }} <div *ngIf="user.isHovering"> <a [href]="'mailto:' + user.email" class="anchor" ><span class="icon-email icon-font-icon_Mail name"></span> <span class="email-text">Email</span></a> </div> </div> </div> </div> TS Code extResults; isHovering = false; mouseHovering(index:any) { this.extResults[index].isHovering = true; } mouseLeft(index:any) { this.extResults[index].isHovering = false; } Hope this will help A: If you can add a property (for now let's call it isHovered) to each element in your extResults it's fairly easy. <div class="search-results" *ngFor="let user of extResults" (mouseenter)="user.isHovered = true" (mouseleave)="user.isHovered = false"> <div>{{ user.user }}</div> <div class="ext"> <span class="icon-phone icon-font-icon_Phone"></span>{{ user.ext }} <a *ngIf="user.isHovered" [href]="'mailto:' + user.email" class="anchor"> <span class="icon-email icon-font-icon_Mail name"></span> <span class="email-text">Email</span> </a> </div> </div> By adding it to each element you ensure that only this element will have its state changed. A: You can use angular directives like ng-mouseover and ng-show. Here's an example of the desired behavior link
doc_2128
Ext.define('Email', { extend: 'Ext.data.Model', idProperty: 'emailid', fields: [ { name: 'emailid', type: 'int' }, { name: 'emailsubject', type: 'string', useNull: true }, { name: 'emailbody', type: 'string', useNull: true }, { name: 'emailto', type: 'string', useNull: true }, { name: 'emailfrom', type: 'string', useNull: true }, ] }); and DataStore: var EmailDataStore = { getDetailStore: function(aid) { var options = { autoLoad: true, autoSync: true, pageSize: 1, remoteFilter: true, remoteGroup: true, remoteSort: true, model: 'Email', proxy: { type: 'ajax', url: 'datastores/datastore-email.asp?action=details&auditid=' + aid, reader: { type: 'json', root: 'emailDetails' } } }; if (typeof (options2) != 'undefined') { options = Ext.merge(options, options2); } var detailStore = Ext.create('Ext.data.Store', options); return detailStore; } } I won't include the ASP because the JSON is returning the data appropriately. But in this next bit of code, ... PortalEmailGrid.prototype.detailStore = null; PortalEmailGrid.prototype.showEmailDetails = function (id) { var self = this; //alert(id); self.detailStore = EmailDataStore.getDetailStore(id); //view store at this state - object appears to exist with the returned record in it console.log(self.detailStore); var firstItem = self.detailStore.first(); //undefined here console.log(firstItem); //count is zero, but i can see the object in the console log above alert('detailStore count: ' + self.detailStore.count()); var win = Ext.create('Ext.window.Window', { title: 'Email Details', store: self.detailStore, height: 400, width: 800, bodyPadding: 4, items: [ { xtype: 'textfield', name: 'tofield', dataIndex: 'emailto', fieldLabel: 'To' }, { xtype: 'textfield', name: 'subjectfield', dataIndex: 'emailsubject', fieldLabel: 'Subject' } ] }); win.show(); } I cannot get the fields to populate with the detailStore's data. But when I log self.detailStore, in Firebug, I can see the object and its details. self.detailStore.count() shows zero, but according to the console, the data should be there. I suspect because of this discrepancy, the fields are not being populated with the dataIndex information. Also the previous code block was called by: var selected = self.grid.selModel.selected; var id = selected.items[0].raw.emailid; //var status = selected.items[0].raw.status; PortalEmailGrid.prototype.showEmailDetails(id); Can you see any reason why the data isn't loading from the datastore? A: Store loading is asynchronous, by the time you're logging the count to the console, the store is yet to be loaded. Firebug always shows the "up to date" status of the object, which is why you can see the data. You need to listen to the load event on the store. So if you remove the autoLoad config, you can do something like this: self.detailStore = EmailDataStore.getDetailStore(id); self.detailStore.load({ callback: function(){ console.log('loaded, do something'); } });
doc_2129
My goals: * *example.com as user space *console.example.com as admin space A: What you are looking for are two different subdomains. You can either accomplish this by setting the corresponding A-records (with different IPs) where you host the DNS for your website. OR the better way is to deploy a reverse proxy (like nginx) and then manage your routing there.
doc_2130
I did managed to change the color, i know that the question already have several replies, anyway those do not satisfy me: with those implementation, the animation of the pickerview is glitchy and i don't like it. This is the code of the current solution func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { var label: UILabel if view == nil { label = UILabel() } else if view is UILabel { label = view as! UILabel } else { label = UILabel() } let title: NSAttributedString if self.model?.selectedValue == row { title = UIPickerView.attributedString(with: .selectedRow, text: "\(model?.years[row] ?? 0)") } else { title = UIPickerView.attributedString(with: .unselectedRow, text: "\(model?.years[row] ?? 0)") } label.attributedText = title return label } And when the user scrolls, I reload the components. But as you can see in the images below, when a user scroll, the green field moves and there is a fraction of seconds in which the green label is below the selector indicator and the selected row is black. What I'd like to have is that everything inside the selector indicator is green while what outside keeps the default shades of grey. How can I implement this? A: You should use attributedTitleForRow for this instead, no need to create your own label with an NSAttributedString. In your didSelectRow your reload all your components to be able to reset all colors and set the new selected one to green. func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? { let color = (row == pickerView.selectedRow(inComponent: component)) ? UIColor.green : UIColor.black return NSAttributedString(string: self.model[row], attributes: [NSForegroundColorAttributeName: color]) } func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { pickerView.reloadAllComponents() } A: You can simply use this code func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { let label = view as? UILabel ?? UILabel() if pickerView.selectedRow(inComponent: component) == row { label.backgroundColor = UIColor.green label.frame = CGRect(x: 0, y: 0, width: 36, height: 36) label.layer.cornerRadius = 18 label.layer.masksToBounds = true label.textColor = .white label.text = String(numbers[row]) label.textAlignment = .center }else { label.layer.cornerRadius = 25 label.frame = CGRect(x: 0, y: 0, width: 36, height: 36) label.layer.cornerRadius = 18 label.layer.masksToBounds = true label.textColor = .white label.text = String(numbers[row]) label.textAlignment = .center } return label } func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { pickerView.reloadAllComponents() } A: Better effects with performance a little bad. extension ViewController: UIPickerViewDelegate{ func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { let info = BeatScalar.generalRates[row] let general = GeneralRateItem(info.cn, info.ita, info.val) // gray every row general.unselected() decorateView(pickerView, row: row) return general } // Here is the logic func decorateView(_ picker: UIPickerView, row: Int){ var frame = picker.frame frame.origin.y = frame.origin.y + frame.size.height * 0.42 frame.size.height = frame.size.height * 0.16 let mini = max(row-1, 0) // 19 is total number let maxi = min(18, row+1) for i in mini...maxi{ if i != row, let item = picker.view(forRow: i, forComponent: 0) as? GeneralRateItem{ let f = item.convert(item.frame, to: picker) if frame.intersects(f) == false{ // highlight the center row item.selected() } } } } func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { return 44 } } extension ViewController: UIPickerViewDataSource{ func numberOfComponents(in pickerView: UIPickerView) -> Int { return 1 } func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { // 19 is total number return 19 } }
doc_2131
I don't want to use jQuery UI at the moment. Any tips and tutorials would be nice. A: You can manually implement it processing the mouse move and down events. * *On mouse down mark object as being dragged *On mouse move calculate the offset from the last cursor position and move the dragged object but checking before that the new position is inside the container box. You can get inspiration from the jquery ui code in case you need. A: ppDrag is a Drag&Drop plugin for jQuery, which mimics the interface of jQuery UI's Draggable. Currently supported is a small subset of its options, but the implementation is different (ppDrag focuses on performance). The speed difference is more visible with slower CPU's. Also, due to JavaScript engine optimizations in the last generation browsers, the speed difference is less than with older browsers. For example, the difference is greater with Firefox 2 than with Firefox 3. All major existing browsers are supported. This includes IE6/7, Firefox1/2/3, Opera, Konqueror, Safari, and probably others. Plug-In
doc_2132
$('#clicked-state') .text('You clicked: '+data.name); if (data.name == "VA") { $('#va').toggle(); } else { $('#va').style.display = 'none'; } } }); I have the above, the idea is if a different state is clicked, div id VA will hide. Currently you click 'VA' and div VA is toggled, but when you click a different state div VA still stays, it needs to hide! A: Wrong! $('#va').style.display = 'none'; try $('#va')[0].style.display = 'none'; or $('#va').get(0).style.display = 'none'; or $('#va').hide(); A: something.style.display = 'none'; ...is the vanilla JavaScript way. $('something').hide(); ...is the jQuery way. If you prefer the vanilla JS way, you can get the first element of the jQuery object which will allow you to use style.display, because it casts it to a DOMElement. $('something')[0].style.display = 'none'; // Cast to DOMElement rather than using a jQuery object
doc_2133
Example of how I want it https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.eztalks.com%2Fhow-to%2Fhow-to-create-a-group-chat-on-iphone.html&psig=AOvVaw04t4JpfAA_3deVRxyTxLqG&ust=1601512477552000&source=images&cd=vfe&ved=0CAIQjRxqFwoTCND10IbRj-wCFQAAAAAdAAAAABAI My Code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> /* ul{ list-style: none; margin: 0; padding: 0; } */ ul li{ display:inline-block; clear: both; padding: 10px; border-radius: 30px; margin-bottom: 2px; font-family: Helvetica, Arial, sans-serif; } .him{ background: #eee; float: left; } .me{ float: right; background: #0084ff; color: #fff; } .him + .me{ border-bottom-right-radius: 5px; } .me + .me{ border-top-right-radius: 5px; border-bottom-right-radius: 5px; } .me:last-of-type { border-bottom-right-radius: 25px; } </style> </head> <body> <ul> <li class="him"><span>Hello World</span></li> <li class="me"><span>Hello World 2</span></li> <li class="me"><span>Hello World 3</span></li> <li class="me"><span>Hello World 4</span></li> <li class="me"><span>Hello World 5</span></li> <li class="me"><span>Hello World 6</span></li> </ul> </body> </html>
doc_2134
Here is my code: self.searchResultsController = [BZDashboardSearchResultsController new]; self.searchController = [[UISearchController alloc] initWithSearchResultsController:self.searchResultsController]; self.searchController.hidesBottomBarWhenPushed = YES; self.searchController.searchResultsUpdater = self; self.searchController.hidesNavigationBarDuringPresentation = YES; self.definesPresentationContext = YES; self.searchController.dimsBackgroundDuringPresentation = NO; self.searchController.view.backgroundColor = [UIColor whiteColor]; self.searchController.delegate = self; self.searchController.searchBar.delegate = self; [self presentViewController:self.searchController animated:YES completion:nil]; I want to hide the tab bar place the search bar under the status bar. My view controller hierarchy looks like this: UITabBarController --UINavigationController ---View Controller where the above code is executed. In my app delegate, I set my UITabBarController subclass as the root view controller: self.window.rootViewController = tabBarViewController; The init method of the subclass is this: -(instancetype)init { self = [super init]; if (self) { UINavigationController *workspaceNavigationController = [[UINavigationController alloc] initWithRootViewController:self.workspaceController]; self.userProfileViewController.showLogoutButton = YES; UINavigationController *userProfileNavigationController = [[UINavigationController alloc] initWithRootViewController:self.userProfileViewController]; self.viewControllers = @[workspaceNavigationController, userProfileNavigationController]; } return self; } self.workspaceController has a search button in its navigation bar the code that presets UiSearchController.
doc_2135
{ private static readonly log4net.ILog Log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); static void Main() { log4net.Config.XmlConfigurator.Configure(); try { MainA().Wait(); } catch (Exception ex) { Log.ErrorFormat("Failed to Delete Data, Error: {0}, Stack Trace {1}, Inner Exception {2}", ex.Message, ex.StackTrace, ex.InnerException); } } public static async Task MainA() { Log.InfoFormat("Service started at {0}", DateTime.UtcNow); WebJobService srv = new WebJobService(); await srv.DeleteData(); Log.InfoFormat("Service ended at {0}", DateTime.UtcNow); } } App.Config <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> Please check above code. It write logs only once when we do deployment on server after that it did not write any logs in MyLogs.txt file. A: It write logs only once when we do deployment on server after that it did not write any logs in MyLogs.txt file. I tested your code and I found my log file under D:\home\site\wwwroot\app_data\jobs\continuous\{WebjobName}\logs in KUDU. Also, if you would use customized path, you could set the file value like this: <file value="D:\home\data\logs\log.log" /> You also could find it in KUDU. The App.config file is as follow, you could refer to it. <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net "/> </configSections> <log4net> <appender name="FileAppender" type="log4net.Appender.FileAppender,log4net"> <file value="./logs/log.log" /> <appendToFile value="true" /> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %level %logger - %message%newline" /> </layout> <filter type="log4net.Filter.LevelRangeFilter"> <levelMin value="INFO" /> <levelMax value="FATAL" /> </filter> </appender> <root> <level value="ALL"/> <appender-ref ref="FileAppender"/> </root> </log4net> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> </startup> </configuration>
doc_2136
In HTML I have various tables with 40 or so different input fields such as these: <tr> <td><input type="text" id="idDescLine15" name="fDescLine15" size="50"> </td> <td><input type="number" id="idQTY15" name="nQTY15" size="5"> </td> <td><input type="number" id="idPrice15" name="nPrice15" size="5"> </td> <td class="Checkbox"><input type="checkbox" id="idTax15" name="nTax1"> </td> <td class="TotalCol"><p class="TotalLine" id="idTotalLine15">0.00</p> </td> </tr> I have the following function that calculates the row total (quantity * price) for each row. This above HTML code is for row 15. All others are setup the same. <script> function Calculate() { var vSTotalTax = 0; for (var i=1;i<16;i++) { var vbuildQTY = 'idQTY' + i; var vbuildPrice = 'idPrice' + i; var vbuildTotalLine = 'idTotalLine' + i; var vQTY=document.getElementById(vbuildQTY).value; var vPrice=document.getElementById(vbuildPrice).value; var vTotalLine = (vQTY * vPrice); document.getElementById(vbuildTotalLine).innerHTML = parseFloat(Math.round(vTotalLine * 100) / 100).toFixed(2); vSTotalTax = vSTotalTax + vTotalLine; } document.getElementById(idSTotalTax).innerHTML = parseFloat(Math.round(vSTotalTax * 100) / 100).toFixed(2); } </script> The first "document.getElementById(vbuildTotalLine)" that is inside the loop works just fine and returns a total for each of the rows. The second one "document.getElementById(idSTotalTax) does not. It is set up just the same in the HTML: <tr> <td><p class="TotalLabel">Sous-total taxable:</p></td> <td class="TotalCol"><p class="TotalLine" id="idSTotalTax">0.00</p></td> </tr> When I click the Calculate button I get an error on the page that says the document.getElementById on line 238 is null or not an object. The only difference between the two is the location in the HTML where it is in a different table. I tried using one of the 'idTotalLine' field that already worked but I continue with the same error. Help. Thanks. A: You have idSTotalTax already the DOM element. Instead, you mean to use it as a string, passing it to getElementById. Wrap it in quotes. Otherwise you are passing the DOM element into document.getElementById. document.getElementById("idSTotalTax").innerHTML -- Thanks to Felix & Pointy for pointing out an earlier issue. A: here is a solution witch let's you don't bother of the id's. var tr=document.getElementsByTagName('tr'),trl=tr.length,total=0; while(trl--){ var td=tr[trl].getElementsByTagName('td'), v=td[1].firstChild.value*td[2].firstChild.value; td[4].firstChild.textContent=v.toFixed(2); total+=v; } totalBox=total.toFixed(2); Note: by using firstChild there have to be no spaces between the <td> and the <input> so you can just write something like that: <tr> <td><input type="text" name="desc[]" size="50"></td> <td><input type="number" name="qty[]" size="5"></td> <td><input type="number" name="price[]" size="5"></td> <td class="Checkbox"><input type="checkbox" name="tax[]"></td> <td class="TotalCol"><p></p></td> </tr> if you post this form you will get an array like this: $_POST={ desc:[ item1,//item1 item2 //item2 ] qty:[ 1,//item1 2//item2 ] price:[ 20,//item1 25//item2 ] tax:[ true,//item1 false//item2 ] } and you can add the calculate function on the form itself. so: document.forms[0].addEventListener('keyup',calculate,false); Example http://jsfiddle.net/gwtmM/ A: The working call getElementById(vbuildTotalLine) looks for the element whose id is the string value of the variable vbuildTotalLine. In this case, that would be "idTotalLineN" for some value of N between 1 and 15, inclusive. You can see in the HTML that there is no element with id="vbuildTotalLine". The non-working call getElementById(idSTotalTax), similarly, looks for the element whose id is the string value of the variable idSTotalTax, but I see no variable idSTotalTax anywhere in your code. If you want to look up the document whose id is the literal string "idSTotalTax", then you need to pass that value as a string, not the name of a variable you don't even declare or assign. You can do that with code like this: getElementById('idSTotalTax') or perhaps, in keeping with the first part, var vbuildTotalTax = 'idSTotalTax'; ... getElementById(vbuildTotalTax);
doc_2137
This is the code for my page. The mysql connection works well, I've just masked the entries. http://pastebin.com/HfbZyVQZ How do I can use the '$playername' with the 'setPlayer()'? A: the better one is: var anyVariable = <?php echo json_encode($anyVariable); ?>; It will handle correctly strings, booleans, numbers and arrays. A: you can echo it var playername = <?php echo $playername;?> then you can use the var playername for your js. Hope this help.
doc_2138
https://youtu.be/h0r5RuOPe9g -> this is a video of the error Here are some snippets of my code. @IBAction func panCard(_ sender: UIPanGestureRecognizer) { let card = sender.view! let point = sender.translation(in: view) let xFromCenter = card.center.x - view.center.x card.center = CGPoint(x: view.center.x + point.x, y: view.center.y + point.y) let scale = min(100/abs(xFromCenter),1) card.transform = CGAffineTransform(rotationAngle: xFromCenter/divisor).scaledBy(x: scale, y: scale) //Rotating the card and scaling the card as it swipes to the left or right. if xFromCenter > 0{ //Sets image to thumbs up if the card is moved right thumbImage.image = #imageLiteral(resourceName: "thisAccept") // This seems to be the section of the code that is causing the issue. the "thisAccept" image is .png and is in my asset file. thumbImage.contentMode = .scaleAspectFit thumbImage.tintColor = UIColor.green }else{ //Sets image to thumbs down if the card is moved left thumbImage.image = #imageLiteral(resourceName: "Decline") thumbImage.contentMode = .scaleAspectFit thumbImage.tintColor = UIColor.red } thumbImage.alpha = abs(xFromCenter) / (view.center.x) // Fading the image as it swipes left or right }
doc_2139
I can now add records. I need to create reports, for example the total number of clients with a certain Ethnicity. The question is how can I know the database table and fields names? I looked in wp-content->civicrm->civicrm->sql but found the basic tables only. A: When you create a new set/group of fields there will be a new entry in the civicrm_custom_group table. The fields themselves are in civicrm_custom_field table. The data for the fields is stored in civicrm_value__ so eg civicrm_value_client_fields_12 you may get better responses in http://civicrm.stackexchange.com/questions?sort=active
doc_2140
In order to isolate the problem, i have created a project with an ADOQuery with 100000 rows as with 5 fields, and another ADOQuery with lookup fields to the first. I insert a row and copy a value to key Field and post the row. I notice that it need around 40ms to complete for Alexandria and 2ms for XE7. Those times scale up if i create more lookup fields, or assign values to the rest of the fields. In my project in some scenarios, load time of 3-4 seconds in XE7 rise up to 12-15 in Alexandria. This is more clear in release I have tried to debug VCL code and compare the files of Ado and dsnap folders of each version, but i haven't figure out what has change. I have google about it, and i haven't find any similar report. I wonder if this is a bug in the newest Delphi, or am i missing something else, maybe a new option. Does anyone have a similar experience? I will appreciate any info about the subject. I will leave the sql script of the Database and the Delphi Code if anyone want to reproduce it. The SQL SCRIPT: CREATE TABLE [dbo].[Persons]( [ID] [int] NOT NULL, [ModifiedDate] [datetime] NULL, [FirstName] [varchar](50) NULL, [LastName] [varchar](50) NULL, [EMail] [varchar](30) NULL, [PhoneNumber] [varchar](15) NULL, PRIMARY KEY CLUSTERED ( [ID] ASC ) ON [PRIMARY] ) ON [PRIMARY] CREATE TABLE [dbo].[Books]( [BookID] [int] NOT NULL, [Title] [nchar](50) NOT NULL, [PersonID] [int] NOT NULL, CONSTRAINT [PK_Books] PRIMARY KEY CLUSTERED ( [BookID] ASC ) ON [PRIMARY] ) ON [PRIMARY] DECLARE @RowCount int = 100000, @Index int = 1 WHILE (@Index <= @RowCount) BEGIN INSERT INTO Persons (ID, ModifiedDate, FirstName, LastName, EMail, PhoneNumber) VALUES (@Index, getdate(), 'FirstName' + CAST(@Index AS varchar(10)), 'LastName' + CAST(@Index AS varchar(10)), 'EMail' + CAST(@Index AS varchar(10)), CAST(@Index AS varchar(10))) SET @Index += 1 END The DFM: object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 177 ClientWidth = 179 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -12 Font.Name = 'Segoe UI' Font.Style = [] OnCreate = FormCreate TextHeight = 15 object BitBtn1: TBitBtn Left = 56 Top = 144 Width = 75 Height = 25 Caption = 'Load' TabOrder = 0 OnClick = BitBtn1Click end object luPersons: TADOQuery Connection = ADOConnection1 CursorType = ctStatic Parameters = <> SQL.Strings = ( 'SELECT *' 'FROM PERSONS') Left = 32 Top = 72 object luPersonsID: TIntegerField FieldName = 'ID' ProviderFlags = [pfInUpdate, pfInWhere, pfInKey] end object luPersonsModifiedDate: TDateTimeField FieldName = 'ModifiedDate' end object luPersonsFirstName: TStringField FieldName = 'FirstName' Size = 50 end object luPersonsLastName: TStringField FieldName = 'LastName' Size = 50 end object luPersonsEMail: TStringField FieldName = 'EMail' Size = 30 end object luPersonsPhoneNumber: TStringField FieldName = 'PhoneNumber' Size = 15 end end object ADOConnection1: TADOConnection ConnectionString = 'Provider=SQLNCLI11.1;Persist Security Info=False;User ID=sa;Pass' + 'word=password;Initial Catalog=testDB;Data Source=DATABASE;' + 'Use Procedure for Prepare=1;Auto Translate=True;Pack' + 'et Size=4096;Workstation ID=Workstation;Initial File Name=""' + ';Use Encryption for Data=False;Tag with column collation when po' + 'ssible=False;MARS Connection=False;DataTypeCompatibility=0;Trust' + ' Server Certificate=False;Server SPN="";Application Intent=READW' + 'RITE' Provider = 'SQLNCLI11.1' Left = 80 Top = 16 end object qBooks: TADOQuery Connection = ADOConnection1 CursorType = ctStatic Parameters = <> SQL.Strings = ( 'SELECT *' 'FROM BOOKS') Left = 128 Top = 72 object qBooksBookID: TIntegerField FieldName = 'BookID' ProviderFlags = [pfInUpdate, pfInWhere, pfInKey] end object qBooksTitle: TWideStringField FieldName = 'Title' FixedChar = True Size = 50 end object qBooksPersonID: TIntegerField FieldName = 'PersonID' end object qBooksModifiedDate: TDateTimeField FieldKind = fkLookup FieldName = 'ModifiedDate' LookupDataSet = luPersons LookupKeyFields = 'ID' LookupResultField = 'ModifiedDate' KeyFields = 'PersonID' Lookup = True end object qBooksFirstName: TStringField FieldKind = fkLookup FieldName = 'FirstName' LookupDataSet = luPersons LookupKeyFields = 'ID' LookupResultField = 'FirstName' KeyFields = 'PersonID' Size = 50 Lookup = True end object qBooksLastName: TStringField FieldKind = fkLookup FieldName = 'LastName' LookupDataSet = luPersons LookupKeyFields = 'ID' LookupResultField = 'LastName' KeyFields = 'PersonID' Size = 50 Lookup = True end object qBooksEMail: TStringField FieldKind = fkLookup FieldName = 'EMail' LookupDataSet = luPersons LookupKeyFields = 'ID' LookupResultField = 'EMail' KeyFields = 'PersonID' Size = 30 Lookup = True end object qBooksPhoneNumber: TStringField FieldKind = fkLookup FieldName = 'PhoneNumber' LookupDataSet = luPersons LookupKeyFields = 'ID' LookupResultField = 'PhoneNumber' KeyFields = 'PersonID' Size = 15 Lookup = True end end end And the PAS source code: unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.Win.ADODB, Vcl.StdCtrls, Vcl.Buttons; type TForm1 = class(TForm) luPersons: TADOQuery; ADOConnection1: TADOConnection; luPersonsID: TIntegerField; luPersonsModifiedDate: TDateTimeField; luPersonsFirstName: TStringField; luPersonsLastName: TStringField; luPersonsEMail: TStringField; luPersonsPhoneNumber: TStringField; qBooks: TADOQuery; qBooksBookID: TIntegerField; qBooksTitle: TWideStringField; qBooksPersonID: TIntegerField; qBooksModifiedDate: TDateTimeField; qBooksFirstName: TStringField; qBooksLastName: TStringField; qBooksEMail: TStringField; qBooksPhoneNumber: TStringField; BitBtn1: TBitBtn; procedure FormCreate(Sender: TObject); procedure BitBtn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} uses System.DateUtils; procedure TForm1.BitBtn1Click(Sender: TObject); var starttime, endtime: TTime; begin starttime := Time; qBooks.Open; qBooks.Insert; qBooksBookID.AsInteger := 1; qBooksPersonID.AsInteger := 1; endtime := Time; ShowMessage(MilliSecondsBetween(endtime, starttime).ToString + ' ' + FormatDateTime('hh:mm:ss.zzz', starttime) + ' ' + FormatDateTime('hh:mm:ss.zzz', endtime)); qBooks.Close; end; procedure TForm1.FormCreate(Sender: TObject); begin luPersons.Open; end; end.
doc_2141
I can't figure out what's wrong with my code: $query = mysql_query("SELECT * FROM cev")or die(mysql_error()); while($row = mysql_fetch_array($query)) { $name = $row['sitecode']; $lat = $row['latitude']; $lon = $row['longitude']; $type = $row['sitetype']; $city = $row['city']; $id = $row['id']; echo("addMarker($lat, $lon,'<b>$name</b><a href="editcev.php?id=' . $row['id'] . '">View</a><br><br/>$type<br/>$city');\n"); A: You have to fix the quotes: echo "addMarker($lat, $lon,'<b>$name</b><a href=\"editcev.php?id={$row['id']}\">View</a><br><br/>$type<br/>$city');\n"; Alternative ways Here document echo <<<EOS addMarker($lat, $lon, '<b>$name</b><a href="editcev.php?id={$row['id']}">View</a><br><br/>$type<br/>$city'); EOS; Concatenation echo "addMarker($lat, $lon, '<b>$name</b>" . "<a href=\"editcev.php?id={$row['id']}\">View</a>" . "<br><br/>$type<br/>$city)"; Using addshashes The addMarker looks like a JavaScript function. You might pre-process the HTML string by means of addslashes: $html = <<<EOS <b>$name</b><a href="editcev.php?id={$row['id']}">View</a><br><br/>$type<br/>$city EOS; $html = addslashes($html); echo "addMarker($lat, $lon, '$html');\n"; Recommendations I recommend using an editor with support of syntax highlighting. Read about PHP strings. Especially the matter of escaping. Finally, I wouldn't recommend writing any HTML/JavaScript within a PHP code. Use template engines such as Smarty or Twig instead. A: It seems like you are trying to use method inside the echo statement. If you want to use methods, variables or some php stuffs you should not use quotes at most case unless it is an eval featured object or method. Try like this echo addmarker($lat, $lon, '<b>'.$name.'</b> <a href="'.editcev.php?id=.' '.$row['id']. ".'>View</a><br><br/>' .$type. '<br/>' .$city.');'."\n"); I don't know your exact situation but i think this works A: echo("addMarker(".$lat.",".$lon.",<b>".$name."</b><a href=ditcev.php?id=" . $row['id'] . ">View</a><br><br/>".$type."<br/>".$city.");\n");
doc_2142
<?php echo "TEST"; echo "<pre>" . print_r($_POST, true) . "</pre>"; if(isset($_POST['SubmitButton'])){ //check if form was submitted $input = $_POST['inputText']; //get input text echo "Success! You entered: ".$input; } ?> <html> <body> <form action="" method="post"> <input type="text" name="inputText"/> <input type="submit" name="SubmitButton"/> </form> </body> </html> When I display the array it shows that it is empty. When I enter something in the input field and click submit, nothing changes. The demo page I would be very grateful if anyone has an idea, thanks. A: 2 things SubmitButton needs a value="something" then change echo "<pre>" . print_r($_POST, true) . "</pre>"; to echo "<pre>" . print_r($_POST) . "</pre>"; You only need the "true" if you want to return that as a var, like $blob = print_r($_POST, true); echo "<pre>" . $blob . "</pre>"; A: If anyone has a similar problem in future (I don't think this is the solution for this specific case): I was debugging an application and php api since the past 4 hours, printing my output everywhere but I couldn't figure out what the issue was. The production system was working fine while our testing environment made was not accepting any of my post arrays. In the end it turned out, that I had a wrong url opened from the application (http:// instead of https://), so a .htaccess file redirected all my requests to https but removed all post information. Hope this helps anyone.
doc_2143
When I run the project everything seems to start up fine in the console. But when I navigate to http://localhost:8080/ in my browser it gives me a 404 error and a page that looks like this: Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Wed Aug 29 07:54:39 MDT 2018 There was an unexpected error (type=Not Found, status=404). No message available Why is it not navigating to the page I created? Main Class: package com.daniel.anderson.demo import ... @SpringBootApplication class DemoApplication fun main(args: Array<String>) { runApplication<DemoApplication>(*args) } The Controller code: package com.daniel.anderson.demo.controlers import ... @Controller class HtmlController { @GetMapping("/") fun blog(model: Model) : String { model.addAttribute("title","Blog") return "blog" } } Mustach Files: blog.mustache {{> header}} <h1>{{title}}</h1> <p>hello world</p> {{> footer}} footer.mustache </body> </html> header.mustache <html> <head> <title>{{title}}</title> </head> <body> Btw, I get the same error in postman. A: The issue was the @Controller in my controller If I changed the annotation to @RestController then it worked. My understanding is that I should be able to use the @Controller annotation but it appears you need the @RestController So I found some really use full info here Spring boot error 404 A: I think the problem is the lack of the annotation @ResponseBody on the method @GetMapping("/") @ResponseBody fun demo(model: Model): String { model["title"] = "Demo" return "Hello world?!" } This must work A: I know this is an old thread and there is also an answer from the creator himself, but this behavior is typical if you have not added the mustache dependency. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mustache</artifactId> </dependency> I'm not 100% sure but if you change the annotation from @Controller to @RestController, the method returns only the string "blog".
doc_2144
val stream = KafkaUtils.createDirectStream[String, String]( ssc, PreferConsistent, Subscribe[String, String](topics, kafkaParams) ) stream.foreachRDD { rdd => if (!rdd.isEmpty()) { val data = rdd.map(record => record.value) val offsetRanges = rdd.asInstanceOf[HasOffsetRanges].offsetRanges val sqlContext: SQLContext = SparkSession.builder.config(rdd.sparkContext.getConf).getOrCreate().sqlContext // json parsing and dataframe operations and after this the below code stream.asInstanceOf[CanCommitOffsets].commitAsync(offsetRanges) Is there any problem with this code? Its giving the below error at org.apache.spark.streaming.dstream.DStream$$anonfun$foreachRDD$1$$anonfun$apply$mcV$sp$3.apply(DStream.scala:628) at org.apache.spark.streaming.dstream.DStream$$anonfun$foreachRDD$1$$anonfun$apply$mcV$sp$3.apply(DStream.scala:628) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(ForEachDStream.scala:51) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1$$anonfun$apply$mcV$sp$1.apply(ForEachDStream.scala:51) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1$$anonfun$apply$mcV$sp$1.apply(ForEachDStream.scala:51) at org.apache.spark.streaming.dstream.DStream.createRDDWithLocalProperties(DStream.scala:416) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1.apply$mcV$sp(ForEachDStream.scala:50) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1.apply(ForEachDStream.scala:50) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1.apply(ForEachDStream.scala:50) at scala.util.Try$.apply(Try.scala:192) at org.apache.spark.streaming.scheduler.Job.run(Job.scala:39) at org.apache.spark.streaming.scheduler.JobScheduler$JobHandler$$anonfun$run$1.apply$mcV$sp(JobScheduler.scala:257) at org.apache.spark.streaming.scheduler.JobScheduler$JobHandler$$anonfun$run$1.apply(JobScheduler.scala:257) at org.apache.spark.streaming.scheduler.JobScheduler$JobHandler$$anonfun$run$1.apply(JobScheduler.scala:257) at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58) at org.apache.spark.streaming.scheduler.JobScheduler$JobHandler.run(JobScheduler.scala:256) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Caused by: java.io.NotSerializableException: Object of org.apache.spark.streaming.kafka010.DirectKafkaInputDStream is being serialized possibly as a part of closure of an RDD operation. This is because the DStream object is being referred to from within the closure. Please rewrite the RDD operation inside this DStream to avoid this. This has been enforced to avoid bloating of Spark tasks with unnecessary objects. Serialization stack: at org.apache.spark.serializer.SerializationDebugger$.improveException(SerializationDebugger.scala:40) at org.apache.spark.serializer.JavaSerializationStream.writeObject(JavaSerializer.scala:46) at org.apache.spark.serializer.JavaSerializerInstance.serialize(JavaSerializer.scala:100) at org.apache.spark.util.ClosureCleaner$.ensureSerializable(ClosureCleaner.scala:413) ... 44 more
doc_2145
<HorizontalScrollView android:id="@+id/yearScrollView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/white" android:layout_gravity="center"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/currentYear" android:tag="01" android:text="2015" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:height="24dp" android:textSize="18sp" android:textColor="#333333" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/white" > </Button> </LinearLayout> </HorizontalScrollView> Then I have the following code private List<Button> yearButtons; private static final int[] YEAR_BUTTON_IDS = { R.id.currentYear, }; Then I must find out what year it is and overwrite my current button int firstYear = Integer.parseInt(year); yearButtons.get(0).setText(String.valueOf(CurrentYear)); then in my init class I substantiate the buttons, I understand I do not need a loop for only 1 button but leaving it like this for consistency with how the months buttons work for(int id : YEAR_BUTTON_IDS) { Button button = (Button)findViewById(id); button.setOnClickListener(this); yearButtons.add(button); } Then I have some logic to find out the first year they started called yearsOfTransactions Then I have the following loop where I try create the buttons for (int i =0; i< yearsOfTransactions; i++){ int yearToAdd = CurrentYear-i-1; Button myButton = new Button(this); myButton.setText(String.valueOf(yearToAdd)); yearButtons.add(myButton); } However this is not working.. Thanks for any help A: I am making slight modification in your code : <HorizontalScrollView android:id="@+id/yearScrollView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/white" android:layout_gravity="center"> <LinearLayout android:id="@+id/button_parent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/currentYear" android:tag="01" android:text="2015" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:height="24dp" android:textSize="18sp" android:textColor="#333333" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/white" > </Button> </LinearLayout> </HorizontalScrollView> Now make an array of years to add (in onCreate()) int[] yearToAdd = {2000, 2001, 2002, 2003}; LinearLayout parentLayout = (LinearLayout)findViewById(R.id.button_parent); for (int i =0; i< yearToAdd.lenght; i++){ int yearToAdd = yearToAdd[i]; Button myButton = new Button(this); myButton.setText(String.valueOf(yearToAdd)); yearButtons.add(myButton); yearButtons.setOnClickListener(this); parentLayout.addView(myButton); } Let me know in case of more clearation you need, hope it will help :) A: you have to add button to a linear layout. This is a function i use to add dynamic buttons in a linear layout. public Button createButton(String label) { Button button = new Button(mContext); button.setText(label); mDynamicLayout.addView(button, mLayoutParam); return button; } A: You should add every button you create to the LinearLayout. First set and id in xml to LinearLayout. Find the view in your class and, finally, add the buttons. LinearLayout container = findViewById(R.id.container); //... for (int i =0; i< yearsOfTransactions; i++){ int yearToAdd = CurrentYear-i-1; Button myButton = new Button(this); myButton.setText(String.valueOf(yearToAdd)); yearButtons.add(myButton); // you missed that container.addView(myButton); } A: please try this inside your for loop LinearLayout layout = (LinearLayout) findViewById(R.id.linear_layout_tags); //set the properties for button Button btnTag = new Button(this); btnTag.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); btnTag.setText("Button"); btnTag.setId(some_random_id); //add button to the layout layout.addView(btnTag);
doc_2146
DATABASE=myDB;DESCRIPTION=myDB;DSN=myDB-dsn;OPTION=0;PORT=3306;SERVER=myServer;UID=user1; This works satisfactorily as long as it is from multiple tables but from a single DB. Is it possible to get data in an Excel sheet by having a query from 2 databases? I can create 2 separate DSNs, 2 separate queries, but the challenge is: if there is a common field (unrelated) on these 2 DBs, can we have 1 query and 1 data returned? can the whole of it done without any manual copy-paste involved? If it was Oracle I heard DBLinks could help , but doesn't seem to be available in MySQL. Update I was looking for more like: SELECT A.*, B.* FROM db1.table1 A LEFT JOIN db2.table1 B ON A.id = B.id Not sure if this kind of references are possible. Even though by query it will work, I am not sure how to define a DSN for this. A: You can access table of another db like SELECT cols FROM DBNAME.TABLE_NAME Have this as a procedure in myDB and call it from myDB
doc_2147
/((\s|&nbsp;){2,}|&nbsp;)/g I would like to alter this pattern so that if two or more whitespace characters are only comprised of the tab \t character, then they are ignored. How would I do this? Examples: '\t\t' needs to be ignored ' \t' needs to be captured '\t ' needs to be captured ' ' needs to be ignored '\t' needs to be ignored '&nbsp;\t' needs to be captured ' &nbsp;' needs to be captured '&nbsp;' needs to be captured A: You may use this regex: (( |\t|&nbsp;)*(?:&nbsp;)+[ \t]*| +[ \t]+|\t+ +[ \t]*) RegEx Demo RegEx Details: * *[ \t]*(?:&nbsp;)+[ \t]*: Match 1+ &nbsp; surrounded by 0 or more space/tab characters *+[ \t]+: Match 1+ space followed by 1+ space or tabs *\t+ +[ \t]*: Match 1+ tabs followed by 1+ space and then 0 or more space/tabs
doc_2148
Also, what is the most strict error reporting PHP5.3 has to offer? I want my code to as up-to-date and future-proof as possible. A: You also need to make sure you have your php.ini file include the following set or errors will go only to the log that is set by default or specified in the virtual host's configuration. display_errors = On The php.ini file is where base settings for all PHP on your server, however these can easily be overridden and altered any place in the PHP code and effect everything following that change. A good check is to add the display_errors directive to your php.ini file. If you don't see an error, but one is being logged, insert this at the top of the file causing the error: ini_set('display_errors', 1); error_reporting(E_ALL); If this works then something earlier in your code is disabling error display. A: I had the same problem on my virtual server with Parallels Plesk Panel 10.4.4. The solution was (thanks to Zappa for the idea) setting error_reporting value to 32767 instead of E_ALL. In Plesk: Home > Subscriptions > (Select domain) > Customize > PHP Settings > error_reporting - Enter custom value - 32767 A: When you update the configuration in the php.ini file, you might have to restart apache. Try running apachectl restart or apache2ctl restart, or something like that. Also, in you ini file, make sure you have display_errors = on, but only in a development environment, never in a production machine. Also, the strictest error reporting is exactly what you have cited, E_ALL | E_STRICT. You can find more information on error levels at the php docs. A: Check the error_reporting flag, must be E_ALL, but in some release of Plesk there are quotes ("E_ALL") instead of (E_ALL) I solved this issue deleting the quotes (") in php.ini from this: error_reporting = "E_ALL" to this: error_reporting = E_ALL A: Although this is old post... i had similar situation that gave me headache. Finally, i figured that i was including sub pages in index.php with "@include ..." "@" hides all errors even if display_errors is ON A: I had the same issue and finally solved it. My mistake was that I tried to change /etc/php5/cli/php.ini, but then I found another php.ini here: /etc/php5/apache2/php.ini, changed display_errors = On, restarted the web-server and it worked! May be it would be helpful for someone absent-minded like me. A: Make sure the php.ini that you're modifying is on the /etc/php5/apache2 folder, or else it won't have any efect... A: Just want to add another pitfall here in case someone finds this question with a problem similar to mine. When you are using Chrome (Or Chromium) and PHP triggers an error in PHP code which is located inside of a HTML attribute then Chrome removes the whole HTML element so you can't see the PHP error in your browser. Here is an example: <p> <a href="<?=missingFunc()?>">test</a> </p> When calling this code in Chrome you only get a HTML document with the starting <p> tag. The rest is missing. No error message and no other HTML code after this <p>. This is not a PHP issue. When you open this page in Firefox then you can see the error message (When viewing the HTML code). So this is a Chrome issue. Don't know if there is a workaround somewhere. When this happens to you then you have to test the page in Firefox or check the Apache error log. A: I had the same problem but I used ini_set('display_errors', '1'); inside the faulty script itself so it never fires on fatal / syntax errors. Finally I solved it by adding this to my .htaccess: php_value auto_prepend_file /usr/www/{YOUR_PATH}/display_errors.php display_errors.php: <?php ini_set('display_errors', 1); error_reporting(-1); ?> By that I was not forced to change the php.ini, use it for specific subfolders and could easily disable it again. A: I have encountered also the problem. Finally I found the solution. I am using UBUNTU 16.04 LTS. 1) Open the /ect/php/7.0/apache2/php.ini file (under the /etc/php one might have different version of PHP but apache2/php.ini will be under the version file), find ERROR HANDLING AND LOGGING section and set the following value {display_error = On, error_reporting = E_ALL}. NOTE - Under the QUICK REFERENCE section also one can find these values directives but don't change there just change in Section I told. 2) Restart Apache server sudo systemctl restart apache2 A: I know this thread is old but I just solved a similar problem with my Ubuntu server and thought I would add a note here to help others as this thread was first page in Google for the topic of PHP not displaying errors. I tried several configuration settings for the error_reporting value in php.ini. From E_ALL | E_STRICT to E_ALL & E_NOTICE and none worked. I was not getting any syntax errors displayed in the browser (which is rather annoying on a development server). After changing the error_reporting setting to "E_ALL" it all started working. Not sure if it is an Ubuntu Oneric specific issue but after restarting Apache errors started showing in the HTML pages the server was serving. Seems the extra options confusing things and all error reporting stops. HTH somone else. A: I just experienced this same problem and it turned out that my problem was not in the php.ini files, but simply, that I was starting the apache server as a regular user. As soon as i did a "sudo /etc/init.d/apache2 restart", my errors were shown. A: I had the same problem with Apache and PHP 5.5. In php.ini, I had the following lines: error_reporting E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT display_errors Off instead of the following: error_reporting=E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT display_errors=Off (the =sign was missing) A: Though this thread is old but still, I feel I should post a good answer from this stackoverflow answer. ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); This sure saved me after hours of trying to get things to work. I hope this helps someone. A: When running PHP on windows with ISS there are some configuration settings in ISS that need to be set to prevent generic default pages from being shown. 1) Double click on FastCGISettings, click on PHP then Edit. Set StandardErrorMode to ReturnStdErrLn500. StandardErrorMode 2) Go the the site, double click on the Error Pages, click on the 500 status, click Edit Feature Settings, Change Error Responses to Detailed Errors, click ok Change Error Responses to Detailed Errors A: For me I solved it by deleting the file of php_errors.txt in the relative folder. Then the file is created automatically again when the code runs next time, and with the errors printed this time. A: I also face the same issue, I have the following settings in my php.inni file display_errors = On error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT But still, PHP errors are not displaying on the webpage. I just restart my apache server and this problem was fixed.
doc_2149
What can i do ? MCOSMTPSession *smtpSession = [[MCOSMTPSession alloc] init]; smtpSession.hostname = @"smpt.office365.com"; //smtpSession.hostname = @"smpt.outlook.office365.com"; //smtpSession.port = 587; smtpSession.port = 25; smtpSession.username = @""; smtpSession.password = @""; smtpSession.authType = MCOAuthTypeSASLPlain; //smtpSession.connectionType = MCOConnectionTypeTLS; smtpSession.connectionType = MCOConnectionTypeStartTLS; MCOMessageBuilder *builder = [[MCOMessageBuilder alloc] init]; MCOAddress *from = [MCOAddress addressWithDisplayName:@"" mailbox:@""]; MCOAddress *to = [MCOAddress addressWithDisplayName:nil mailbox:@""]; [[builder header] setFrom:from]; [[builder header] setTo:@[to]]; [[builder header] setSubject:@"My message"]; [builder setHTMLBody:@"This is a test message!"]; NSData * rfc822Data = [builder data]; MCOSMTPSendOperation *sendOperation = [smtpSession sendOperationWithData:rfc822Data]; [sendOperation start:^(NSError *error) { if(error) { NSLog(@"Error sending email: %@", error); } else { NSLog(@"Successfully sent email!"); } }]; A: smtpSession.hostname = @"smpt.office365.com"; ^^^^ Typo? Should it be smtp?
doc_2150
Here my CSS: body { color: #555; font-family: 'Open Sans'; } th { text-align: left; } table { background-color: transparent; width: 100%; max-width: 100%; margin-bottom: 20px; border-collapse: separate; border-spacing: 0 7px; } table > thead > tr > th, table > tbody > tr > th, table > tfoot > tr > th, table > thead > tr > td, table > tbody > tr > td, table > tfoot > tr > td { padding: 13px; line-height: 20px; } table th { font-weight: 700; font-size: 13px; color: #868686; vertical-align: bottom; padding: 0 13px !important; } table td { vertical-align: middle; background: #fff; border: 1px solid #eaeaea; border-right: 0; box-shadow: 0 3px 2px rgba(0, 0, 0, 0.1); transition: all .2s ease; font-size: 13px; } table td:last-child { border-right: 1px solid #eaeaea; border-radius: 0 2px 2px 0; } table td:first-child { border-radius: 2px 0 0 2px; } table > thead > tr > th { vertical-align: bottom; } table > caption + thead > tr:first-child > th, table > colgroup + thead > tr:first-child > th, table > thead:first-child > tr:first-child > th, table > caption + thead > tr:first-child > td, table > colgroup + thead > tr:first-child > td, table > thead:first-child > tr:first-child > td { border: 0; } table > tbody > tr:hover > td, table > tbody > tr:hover > th { background-color: #f7f8fb; } Here my HTML: <table> <thead> <tr> <th></th> <th>Name</th> <th>Email</th> <th>Comment</th> </tr> </thead> <tbody> <tr> <td width="20">1</td> <td>Obcasyn Maruszczak</td> <td>obcasyn@example.com</td> <td>No comment</td> </tr> <tr> <td>2</td> <td>Obcasyn Maruszczakowy</td> <td>maruszczak@example.com</td> <td>No comment</td> </tr> <tr> <td>3</td> <td>Obcasyn Maruszczakowy</td> <td>maruszczak@example.com</td> <td>No comment</td> </tr> </tbody> </table> A: Give them the same class (say "tables") and different ids (say "tableOne" and "tableTwo") Declare the common css for them using their class, like table.tables{ }. For different css use their ids; like this : table.tables#tableOne th { color:green; } table.tables#tableTwo th { color: red; } Here's a wokring snippet in which I give their headings different colors using their ids. body { color: #555; font-family: 'Open Sans'; } th { text-align: left; } table.tables { background-color: transparent; width: 100%; max-width: 100%; margin-bottom: 20px; border-collapse: separate; border-spacing: 0 7px; } table.tables > thead > tr > th, table.tables > tbody > tr > th, table.tables > tfoot > tr > th, table.tables > thead > tr > td, table.tables > tbody > tr > td, table.tables > tfoot > tr > td { padding: 13px; line-height: 20px; } table.tables th { font-weight: 700; font-size: 13px; color: #868686; vertical-align: bottom; padding: 0 13px !important; } table.tables td { vertical-align: middle; background: #fff; border: 1px solid #eaeaea; border-right: 0; box-shadow: 0 3px 2px rgba(0, 0, 0, 0.1); transition: all .2s ease; font-size: 13px; } table.tables td:last-child { border-right: 1px solid #eaeaea; border-radius: 0 2px 2px 0; } table.tables td:first-child { border-radius: 2px 0 0 2px; } table.tables > thead > tr > th { vertical-align: bottom; } table.tables > caption + thead > tr:first-child > th, table.tables > colgroup + thead > tr:first-child > th, table.tables > thead:first-child > tr:first-child > th, table.tables > caption + thead > tr:first-child > td, table.tables > colgroup + thead > tr:first-child > td, table.tables > thead:first-child > tr:first-child > td { border: 0; } table.tables > tbody > tr:hover > td, table.tables > tbody > tr:hover > th { background-color: #f7f8fb; } table.tables#tableOne th { color:green; } table.tables#tableTwo th { color: red; } <table class="tables" id="tableOne"> <thead> <tr> <th></th> <th>Name</th> <th>Email</th> <th>Comment</th> </tr> </thead> <tbody> <tr> <td width="20">1</td> <td>Obcasyn Maruszczak</td> <td>obcasyn@example.com</td> <td>No comment</td> </tr> </tbody> </table> <table class="tables" id="tableTwo"> <thead> <tr> <th></th> <th>Name</th> <th>Email</th> <th>Comment</th> </tr> </thead> <tbody> <tr> <td width="20">1</td> <td>Obcasyn Maruszczak</td> <td>obcasyn@example.com</td> <td>No comment</td> </tr> </tbody> </table>
doc_2151
std::list<Point> item; .... //fill the list somewhere else .... for(Point p : item) { p.lowerY(); } To work only one time (that is lowerY() does what it's supposed to do only once but the next time this loop is reached, it doesn't do anything), but this: list<Point>::iterator it; for (it = item.begin();it != item.end();++it) { it->lowerY(); } Works perfectly every time. What's the difference? A: In your former code, the line for(Point p : item) { creates copies of the point every time you access the next item. To make sure that your calling of method lowerY() works, you need to redefine it as for(Point & p : item) {
doc_2152
I have a select-option form with list of tags. I want to display articles from database depending on chosen tag. I have a div "showArticles", in my index.jsp, where I want to show articles. I am using jquery and ajax for that purpose. I wrote Servlet called test where I just output a simple string, but I cant even receive the text, seems that my servlet is never called. servlet is in package called "servlets", I am using NetBeans. This is the form: <select id="b_sub_tag" name="b_sub_tag"> <option value='${0}'>Subject</option> <c:forEach var="item" items="${subtagList}"> <option value='${item}'>${item}</option> <c:set var="i" value='${i+1}'> </c:set> </c:forEach> </select> This is the jquery: $(document).ready(function(){ $("#b_sub_tag").change(function(){ var option_value = $(this).children('option:selected').val(); $.ajax({            type: "POST",            url: "test",            data :"value="+option_value,            success: function(html) {                    $("#showArticles").html(html);            }        }); });   }); This is the Servlet: @WebServlet(name = "test", urlPatterns = {"/test"}) public class test extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* TODO output your page here. You may use following sample code. */ //response.getWriter().write("Omething"); } finally { out.close(); } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); response.getWriter().write("Smething"); } @Override public String getServletInfo() { return "Short description"; }// </editor-fold> } Ihave tried PrintWriter out = response.getWriter(); out.println("Something"); as well, nothing. I am writing output in doPost(), I tried to write in in doGet and processRequest, but no luck. Anyone have any idea why this does not work? Problem is resolved. I ve changed the code as follows: $.ajax({ url : "test", type: 'GET', ***data: {value:option_value},*** error : function(jqXHR, textStatus, errorThrown) { alert(textStatus); }, success : function(html){ $("#showArticles").html(html); } } }); Servlet: @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { final InitialContext context = new InitialContext(); statefulb = (StatefulBeanRemote) context.lookup("java:comp/env/StatefulBeanRemote"); response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); response.getWriter().write("A text"); } catch (NamingException ex) { Logger.getLogger(LoadArticlesByTag.class.getName()).log(Level.SEVERE, null, ex); } } A: Problem is resolved. I ve changed the code as follows: $.ajax({ url : "test", type: 'GET', *data: {value:option_value},* error : function(jqXHR, textStatus, errorThrown) { alert(textStatus); }, success : function(html){ $("#showArticles").html(html); } } }); Servlet: @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { final InitialContext context = new InitialContext(); statefulb = (StatefulBeanRemote) context.lookup("java:comp/env/StatefulBeanRemote"); response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); response.getWriter().write("A text"); } catch (NamingException ex) { Logger.getLogger(LoadArticlesByTag.class.getName()).log(Level.SEVERE, null, ex); } } A: Try change your url to /test: $.ajax({ type: "POST", url: "/test", data :"value="+option_value, datatype : "html", success: function(html) { $("#showArticles").html(html); } });
doc_2153
A: ClientScript.RegisterStartupScript() is for passing in a block of script which is automatically run at startup. ClientScript.RegisterClientScriptBlock() is just for registering a general method. I think the technical difference is that the startup script is placed just before the </body> so that it is executed as soon as possible after the page is loaded? Update I have double checked this and it is is what I said. http://msdn.microsoft.com/en-us/library/asz8zsxy.aspx ClientScript.RegisterStartupScript() "The script block added by the RegisterStartupScript method executes when the page finishes loading but before the page's OnLoad event is raised." http://msdn.microsoft.com/en-us/library/btf44dc9.aspx ClientScript.RegisterClientScriptBlock() "The RegisterClientScriptBlock method adds a script block to the top of the rendered page." A: ClientScript.RegisterStartupScript places the script just before the closing </body> tag while ClientScript.RegisterClientScriptBlock places it in the beginning, just after the viewstate hidden fields. A: MSDN: The script block added by the RegisterStartupScript method executes when the page finishes loading but before the page's OnLoad event is raised. The RegisterClientScriptBlock method adds a script block to the top of the rendered page. etc
doc_2154
List A: a list of words (ex. ['Hello','world']) List B: a 2D list of words (ex. [['hi','how'],['are','you'], ...] I also have a very large graph (over 1,000,000 nodes) of words that connect to each other. The goal of my program is to find the list in B that contains the shortest path to all elements in A. Looking at the example above, this means I'm looking to see dist(hi,hello) + dist(hi,world) + dist(how, hello) + dist(how, world) is less than dist(are,hello) + dist(are,world) + dist(you, hello) + dist(you, world). I am using networkx in Python. Any suggestions would be appreciated. Thank you for your help. EDIT: the graph is unweighted and undirected. It is a very sparse graph
doc_2155
Most solutions require you to know the illegal characters. A solution to find those filenames often ends with something like: find . -name "*[\+\;\"\\\=\?\~\<\>\&\*\|\$\'\,\{\}\%\^\#\:\(\)]*" This is already quite good, but sometimes there are cryptic characters (e.g. h͔͉̝e̻̦l̝͍͓l̢͚̻o͇̝̘w̙͇͜o͔̼͚r̝͇̞l̘̘d̪͔̝.̟͔̠t͉͖̼x̟̞t̢̝̦ or ʇxʇ.pʅɹoʍoʅʅǝɥ or © or €), symbols, or characters from other character sets in my file names. I can not trace these files this way. Inverse lookarounds or the find command with regex is probably the right approach, but I don't get anywhere. In other words: Find all filenames which do NOT match the following pattern [^a-zA-Z0-9 ._-] would be perfect. Mostly [:alnum:] but with regex the command would be more flexibel. find . ! -name [^a-zA-Z0-9 ._-] does not do the job. Any idea? I use bash or zsh on OSX. A: You can try find . -name '*[!a-zA-Z0-9 ._-]*'
doc_2156
I want to change the image's color with the following RGB values: rgb(197, 140, 133); rgb(236, 188, 180); rgb(209, 163, 164); rgb(161, 102, 94); rgb(80, 51, 53); rgb(89, 47, 42); After the color is changed I need to make the white background transparent. I suppose this is done via alpha channel=0, but it's unclear to me how. How do I do this? I'd like to understand the way RGB->HSV->BGR conversions works, I'll need it in the future. So far, I've been testing in Python & CV2 and I managed to change the Hue to a random value, but it's not the solution I need. P.S. I do NOT own this picture, it's used just for the demo.
doc_2157
However, I am not sure how can I keep the documentation and implementation in Sync ? e.g. When I add a new API then I have to make sure that the model (to represent the Response) used in the API documentation should be same as the model created in the REST implementation. Similarly, the resource name given in the documentation should match the resource name in the implementation. Is there a way to generate just the resource interface and model classes from the documentation produced using swagger 2.0 spec ? A: You can generate server source with these tools (they can also generate client source) : * *http://studio.restlet.com: online editor, generate server skeleton code for java (Jax-RS and Restlet) and Node.js *http://editor.swagger.io: online editor, generate server skeleton code for java (Jax-RS), Node.js, Scalatra and Java Spring MVC *https://github.com/swagger-api/swagger-codegen: swagger code generator, you can try to implement your own generator module (personally, I'm currently trying to use this one)
doc_2158
A: Why would you disable a label? Labels are only for viewing purposes. The user cannot interact with them anyway. EDIT: It looks like Robin Dunn answered a similar question (maybe yours?) on the wxPython mailing list today: https://groups.google.com/forum/?fromgroups#!topic/wxpython-users/eO9GXO8R6eM He gave the following example: toolbar.EnableTool(toolId, True) # or False to disable Which is the code you would use to Enable / Disable any tool bar widget
doc_2159
So far, I was able to divide them into 3x3 chunks. However, I'm not sure how to use the pixels that i got and make them into a object. So later it can be called easily and use it to scramble into different positions. so it would look something like this but the chunks are scrambled dividedPicture So, is it possible to get some hints or ideas? Thanks and appreciate the help. This is the code I got so far public void extracredit(Picture originPic) { Picture [] picture = new Picture[9]; boolean [] checkFilled = new boolean[9]; int w = originPic.getWidth(); int h = originPic.getHeight(); Pixel pixels; for ( int i = 0; i < picture.length; i++) { int xIndex = i % 3; for ( int x = w/3 * xIndex; x < w/3 * (xIndex + 1); x++) { for ( int y = h/3 * xIndex; y < h/3 * (xIndex + 1); y++) { pixels = origin.getPixel(x,y); } } } } A: You have your source pixel matrix. Create a target pixel matrix of the same pixel rectangular dimensions. Keep a linked list of what 3x3 target pixel groups remain to be assigned. Iterating through each 3x3 source pixel group, generate a random integer >= 0 and < the length of the linked list to pick the next 3x3 target pixel group, copy to it, and delete the corresponding entry from the linked list until it is empty.
doc_2160
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Body> <SVARCHAR2-RMTO_WEB_SERVICESInput xmlns="http://xmlns.oracle.com/orawsv/TR_PUBLIC_WS/PKG_RMTO_WS"> <IN_USERNAME-VARCHAR2-IN>test</IN_USERNAME-VARCHAR2-IN> <IN_SERVICEID-NUMBER-IN>2</IN_SERVICEID-NUMBER-IN> <IN_PASSWORD-VARCHAR2-IN>test123</IN_PASSWORD-VARCHAR2-IN> <IN_PARAM_9-VARCHAR2-IN>""</IN_PARAM_9-VARCHAR2-IN> <IN_PARAM_8-VARCHAR2-IN>""</IN_PARAM_8-VARCHAR2-IN> <IN_PARAM_7-VARCHAR2-IN>""</IN_PARAM_7-VARCHAR2-IN> <IN_PARAM_6-VARCHAR2-IN>""</IN_PARAM_6-VARCHAR2-IN> <IN_PARAM_5-VARCHAR2-IN>""</IN_PARAM_5-VARCHAR2-IN> <IN_PARAM_4-VARCHAR2-IN>""</IN_PARAM_4-VARCHAR2-IN> <IN_PARAM_3-VARCHAR2-IN>""</IN_PARAM_3-VARCHAR2-IN> <IN_PARAM_2-VARCHAR2-IN>""</IN_PARAM_2-VARCHAR2-IN> <IN_PARAM_10-VARCHAR2-IN>""</IN_PARAM_10-VARCHAR2-IN> <IN_PARAM_1-VARCHAR2-IN>111100002</IN_PARAM_1-VARCHAR2-IN> </SVARCHAR2-RMTO_WEB_SERVICESInput> </Body> </Envelope> I wrote this function and it doesn't return anything: public function sendP($params = array() , $debug = false ){ error_reporting(0); $client = new SoapClient("http://smartcard.rmto.ir:9090/orawsv/TR_PUBLIC_WS/PKG_RMTO_WS?wsdl"); $parameters['USERNAME'] = 'test' ; $parameters['SERVICEID'] = 2; $parameters['PASSWORD'] = 'test123'; $parameters['PARAM_1'] = '111100002'; //$parameters['text'] = iconv("UTF-8", 'UTF-8//TRANSLIT',$params['title']); try{ $status = $client->RETURN($parameters);} catch(SoapFault $e){ 1; } if($debug) return $status; } sendP(array()): where is my problem? I don't know RETURN function is correct or not. A: As I see in WSDL file, you must call the name of "xsd:element": SVARCHAR2-RMTO_WEB_SERVICESInput (it is a method you must call to send needed information). There is no "RETURN" method, you've mentioned in the code. And also don't forget to copy exact names of parameters to send. Try this example, I think it should work. Good luck :) public function sendP($params = array() , $debug = false ){ $client = new SoapClient("http://smartcard.rmto.ir:9090/orawsv/TR_PUBLIC_WS/PKG_RMTO_WS?wsdl"); $parameters['IN_USERNAME-VARCHAR2-IN'] = 'test' ; $parameters['IN_SERVICEID-NUMBER-IN'] = 2; $parameters['IN_PASSWORD-VARCHAR2-IN'] = 'test123'; $parameters['IN_PARAM_1-VARCHAR2-IN'] = '111100002'; try{ $status = $client->SVARCHAR2-RMTO_WEB_SERVICESInput($parameters);} catch(SoapFault $e){ 1; } if($debug) return $status; A: If you don't know your functions there is a really helpful function called __getFunctions - you will see an output like 0 => string 'RMTO_WEB_SERVICESOutput RMTO_WEB_SERVICES(SVARCHAR2-RMTO_WEB_SERVICESInput $parameters)' (length=87) Basically you need to try to do something like that try { $client = new SoapClient("http://smartcard.rmto.ir:9090/orawsv/TR_PUBLIC_WS/PKG_RMTO_WS?wsdl", ['trace' => 1]); var_dump($client->__getFunctions()); $parameters = []; //two alternatives here $client->__soapCall('RMTO_WEB_SERVICES', $parameters); //or $client->RMTO_WEB_SERVICES($parameters); } catch (SoapFault $e) { echo '<h2>Exception Error</h2>'; echo $e->getMessage(); }
doc_2161
<assign> -> <id> = <exp> <id> -> A | B | C <exp> -> <term> + <exp> | <temp> <term> -> <factor> * <term> | <factor> <factor> -> ( <exp> ) | <id> This is Left Recursion Grammar: <assign> -> <id> = <exp> <id> -> A | B | C <exp> -> <exp> + <term> | <term> <term> -> <term> * <factor> | <factor> <factor> -> ( <exp> ) | <id> Will those grammar produce the same parse tree for String B + C + A? The following picture is for Left Recursion. However, i draw the parse tree for the Right Recursion, it is a bit different between position of nodes. I dont know if what i am doing is correct. So I wonder that Left Recursion and Right Recursion produce two different parse tree or should be same parse tree. Please help to clarify this problem. Thanks. A: Left and right recursion will not produce identical trees. You can see easily from the grammars that A+B+C will at the "top-level' have <term> <op> <exp> or <exp> <op> <term> ("exp" being "B+C" in one case and "A+B" in the other. The trees will only be identical in trivial cases where all productions yield a direct match. (E.g. A (skipping assign) would be <exp> --> <term> --> <factor> --> <id> A: Since both grammars are different I would expect different parse trees. The right recursion would swap the addition and the single expansion on the node at the top that is labeled <expr> = <expr> + <term>. The right recursion grammar would expand to <expr> = <term> + <expr> so both children would be swapped. If you are trying to write a compiler for mathematical expressions a thing that matters more is operator precedence, but not sure what you are up to.
doc_2162
throw:The connection attempt failed because the connection side did not respond properly after a period of time or the host of the connection did not respond. This is the code in uwp: const string serverPort = "38885"; const string socketId = BgTaskConfig.TaskName; var sockets = SocketActivityInformation.AllSockets; if (!sockets.Keys.Contains(socketId)) { var socket = new StreamSocketListener(); socket.EnableTransferOwnership(_taskId, SocketActivityConnectedStandbyAction.DoNotWake); await socket.BindServiceNameAsync(serverPort); await Task.Delay(500); await socket.CancelIOAsync(); socket.TransferOwnership(socketId); BgTaskConfig.ServerStatus = "Running"; } This is the code in WinForm: IPAddress ip = IPAddress.Parse("127.0.0.1"); Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { clientSocket.Connect(new IPEndPoint(ip, 38885)); Console.WriteLine("OK"); } catch(Exception ex) { Console.WriteLine(ex.Message.ToString()); return; }
doc_2163
Issue Snapshot Module not found: Error: Can't resolve 'faker' in 'C:\Gowtham\micro-frontend-training\products\src' resolve 'faker' in 'C:\Gowtham\micro-frontend-training\products\src' Parsed request is a module using description file: C:\Gowtham\micro-frontend-training\products\package.json (relative path: ./src) Field 'browser' doesn't contain a valid alias configuration resolve as module C:\Gowtham\micro-frontend-training\products\src\node_modules doesn't exist or is not a directory looking for modules in C:\Gowtham\micro-frontend-training\products\node_modules single file module using description file: C:\Gowtham\micro-frontend-training\products\package.json (relative path: ./node_modules/faker) no extension Field 'browser' doesn't contain a valid alias configuration C:\Gowtham\micro-frontend-training\products\node_modules\faker is not a file .js Folder Structure folder structure webpack.config.js module.exports = { mode: "development", }; package.json { "name": "products", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "start": "webpack" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "faker": "^6.6.6", "webpack": "^5.67.0", "webpack-cli": "^4.9.2" } } src/index.js import faker from "faker"; let products = ""; for (let i = 0; i < 3; i++) { const name = faker.commerce.productName(); products += `<div>${name}</div>`; } console.log(products); A: Try with following package.json... { "name": "products", "version": "1.0.0", "description": "", "main": "dist/main.js", "scripts": { "prestart": "webpack", "start": "node ." }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "faker": "^5.5.3", "webpack": "^5.67.0", "webpack-cli": "^4.9.2" } } Do a fresh install and run npm start...
doc_2164
In common CSS there will be addictional "wgag.css" file which determines site appearance for such situations like: grayscale mode, high contrast, bigger text size, text only and so on. But how to resolve this with Tailwind CSS? How do you deal with it? A: There is no magic silver-bullet that will make your site accessible with Tailwind or any other framework, and it can't be accomplished with CSS alone. You need to implement a combination of accessible HTML, CSS and JavaScript to do the job right. Accessibility is a discipline unto itself and one worth learning as a developer. Although Tailwind claims to be accessible, I believe that a major shortcoming of the product is that there's no JS included, which means that you'll have to self-manage things like accessible keyboard navigation, dropdown menus, flyout menus, aria-expanded state, closing of modals, pagination, accordions, and anything else that relies on an event listener. I wouldn't recommend anyone trying to do all of those things on a big complex website unless you really have some years of experience under your belt implementing WCAG and making accessible websites. Presumably as a response to this limitation, Tailwind is now selling access to "UI components" that have React/Vue JS support. Bootstrap has historically been very good about producing reasonably accessible components with JS built-in. If you really just have no idea of where to start, try WebAIM. You can also use automated checking tools like WAVE or LightHouse, but I'd proceed with caution on those. Many less-experienced developers interpret a lack of errors in an automated checker as evidence of an accessible webpage, however that's often not true.
doc_2165
Please see the problem: A: I had the same problem and after a deep search I found the reason. You have to use a different stdlib.jar file. Download this stdlib-package and add import edu.princeton.cs.introcs.StdDraw;on the top of your .java file. (you can change StdDraw, Draw, StdIn, etc on top, your compiler will probably help you to import the right libraries) A: You’ve done most things right, you added stdlib to the build path, and @Ralf Kleberhoff is right, you shouldn’t need an import. But the class you’re trying to use is called draw, not StdDraw. Try using Draw instead of StdDraw, and eclipse will probably do the rest automatically.
doc_2166
var ref = window.lastref.child("Offers").push(); ref.setWithPriority(spaceof.data, Firebase.ServerValue.TIMESTAMP,function (data) { $("body").prepend(data); } This appears to work, setting the priority correctly. However, I am adding a rule to ensure the timestamp is not set to a future time. Using this code:- ,"Offers" : { ".read" : "true" ,"$offerid" : { ".write" : "now >= newData.getPriority()" This always fails. I have tried ".write": "true" // this works and ".write" : "newData.getPriority()>=0" // this fails and ".write" : "newData.getPriority()<0" // this fails So I am starting to suspect the priority hasn't been resolved from the placeholder to a number yet? Any suggestions??
doc_2167
Below is my error message Unhandled Error in Silverlight Application Load operation failed for query 'Login'. The remote server returned an error: NotFound. at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error) at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.End(IAsyncResult result) at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.c__DisplayClass1.b__0(Object state) at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.RunInSynchronizationContext(SendOrPostCallback callback, Object state) at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.HandleAsyncCompleted(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.AsyncResultBase.Complete() at System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService.HandleOperationComplete(OperationBase operation) at System.ServiceModel.DomainServices.Client.LoadOperation.c__DisplayClass4`1.b__0(LoadOperation`1 arg) at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction() at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error) at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error) at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainContext.c__DisplayClass1b.b__17(Object ) and this is my connection string <connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="server=.;data source=PC15\SQLEXPRESS;Initial Catalog=LodeSuiteDB;Integrated Security=True;" /> <add name="LodeSuiteDB1Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=PC15\SQLEXPRESS;initial catalog=LodeSuiteDB;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> </connectionStrings> Does anyone have the same problem? I'm using Visual Studio 2010 Ultimate Edition and SQL Server 2008 for my development (both running on Windows 7) whereas my IIS server (IIS 5.1) is running on Windows XP Professional I've been trying to solve this problem for days with no avail. Your help is greatly appreciated! A: The problem will be that the ASPNET_WP process (which hosts the ASP.NET code on IIS5.1) will run under the identity of the ComputerName/ASPNET account. Since you are using Integrated Security in you connection strings that account will need to have been granted access to the SQL databases being accessed. Alternatively, you need to enable impersonation in the web.config and specify the username and password of an account that does have access to the databases. A: I don't think this is a database connection issue. The issue here looks more like the Silverlight application can't talk to the application server over WCF RIA Services. Take a look at some of the RIA service calls using Fiddler and see if any of them are showing errors. This link has more help about how to fix an RIA Services NotFound error.
doc_2168
ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; } li { float: left; } .list { border-style: ridge; border-color: green; border-width: 25px; } I want more of a space between the image and the name, now it is about a centimeter or two apart. A: Use 'margin' properties to create space around elements, outside of any defined borders. There are properties for setting the margin for each side of an element (margin-top, margin-right, margin-bottom, and margin-left). Sample Code div { margin-top: 100px; margin-bottom: 100px; margin-right: 150px; margin-left: 100px; } If you want to generate space around an element's content or inside of any defined borders, use 'padding'. Sample Code li a { display: block; color: white; text-align: center; padding: 16px; text-decoration: none; } Refer the below link for more details. https://www.w3schools.com/css/tryit.asp?filename=trycss_margin_sides https://www.w3schools.com/html/tryit.asp?filename=tryhtml_lists_menu A: You can always use margin-right and apply that to your logo. Remember, however, to not have it mess up your layout on smaller screens. A: use margin : 0 15px; (for side margin) or, margin : 15px 0: ( for top and bottom margin) but if you want the space between border and content use padding instead.
doc_2169
there is the code i used: NSMutableArray *returnedArray=[[[NSMutableArray alloc]init] autorelease]; NSManagedObjectContext *context = [self managedObjectContext]; NSEntityDescription *objEntity = [NSEntityDescription entityForName:@"Note" inManagedObjectContext:context]; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; [fetchRequest setEntity:objEntity]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"When" ascending:YES]; NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor]; [fetchRequest setSortDescriptors:sortDescriptors]; [sortDescriptor release]; NSPredicate *predicate1 = [NSPredicate predicateWithFormat: @"self.Reunion==%@",reunion]; NSNumber *endOfEtape=[NSNumber numberWithInt:[etape.positionDepart intValue]+[etape.duree intValue]]; NSExpression *s1 = [ NSExpression expressionForConstantValue: etape.positionDepart ]; NSExpression *s2 = [ NSExpression expressionForConstantValue: endOfEtape ]; NSArray *limits = [ NSArray arrayWithObjects: s1, s2, nil ]; NSPredicate *predicate2=[NSPredicate predicateWithFormat: @"self.When BETWEEN %@",limits]; NSPredicate *predicate=[NSCompoundPredicate andPredicateWithSubpredicates: [NSArray arrayWithObjects:predicate1,predicate2,nil]]; [fetchRequest setPredicate:predicate]; NSArray *notes; notes=[context executeFetchRequest:fetchRequest error:nil]; [fetchRequest release]; and i had an 'objc_exception_throw' at the line on which i call "executeFetchRequest:" method. I will be happy if you can help me. Thanks. A: Unfortunately, the BETWEEN operand is considered an aggregate function & these aren't supported by CoreData. See Apple's Documentation ... consider the BETWEEN operator (NSBetweenPredicateOperatorType); its right hand side is a collection containing two elements. Using just the Mac OS X v10.4 API, these elements must be constants, as there is no way to populate them using variable expressions. On Mac OS X v10.4, it is not possible to create a predicate template to the effect of date between {$YESTERDAY, $TOMORROW}; instead you must create a new predicate each time. Aggregate expressions are not supported by Core Data. So you'll need to use a predicate like: NSPredicate *predicate2 = [NSPredicate predicateWithFormat: @"self.When >= %@ AND self.When <= %@", etape.positionDepart, endOfEtape]; (assuming positionDepart and endOfEtape are of type NSString)
doc_2170
When indentation level is set to 0, the child items are requested and I get child items displayed and the top level items have the expanders to hide or show the children. So what could be the problem with setting the indentation level to 1? EDIT: The problem was my assumption that an indentation level of 1 represented an indentation of one tree view column. Actually it is the number of pixels to indent. Low indentations cause the text to be displayed over the expansion widget, so it looks like there are no children. I had also assumed the default indentation level was 0, which is why I assumed it worked. The default is 20. A: The problem was my assumption that an indentation level of 1 represented an indentation of one tree view column. Actually it is the number of pixels to indent. Low indentations cause the text to be displayed over the expansion widget, so it looks like there are no children. The default indentation is 20.
doc_2171
val document = Jsoup.connect(theURL).get(); I'd like to only get the first few KB of a given page, and stop trying to download beyond that. If there's a really large page (or theURL is a link that isn't html, and is a large file), I'd like to not have to spend time downloading the rest. My usecase is a page title snarfer for an IRC bot. Bonus question: Is there any reason why Jsoup.connect(theURL).timeout(3000).get(); isn't timing out on large files? It ends up causing the bot to ping out if someone pastes something like a never-ending audio stream or a large ISO (which can be solved by fetching URL titles in a different thread (or using Scala actors and timing out there), but that seems like overkill for a very simple bot when I think timeout() is supposed to accomplish the same end result). A: Now you can limit the max body size with version 1.7.2 using maxBodySize() method. http://jsoup.org/apidocs/org/jsoup/Connection.Request.html#maxBodySize() By default is limited to 1MB and this will prevent from memory leaks. A: Bonus answer to your bonus question: the timeout is defined as the connect and socket transfer timeouts. So if the connection takes less time than the timeout, and you're receiving packets from the server more frequently than the timeout, the timeout will never trigger. I understand that's not fantastically intuitive and would like to move it to a total elapsed wallclock timeout. But for backwards compatibility I probably need to make it a different method (opinions solicited). The never-ending audio stream should be prevented now in 1.7.2+ with the max body size. But without the wallclock timeout, it can still get caught with deliberately slow servers which eke out a response bit by bit with 3 second delays. A: Don't think you can do it with JSoup. JSoup has no streaming mode (The InputStream will then be transformed into a String). If you want to download few KB of data, I suggest you to use Apache HTTPClient or Ning AsyncHttpClient to play with the response stream. You can stop retrieving data anytime with that.
doc_2172
i tried couple of console codes but in didn't work with i want! I tried in console: cake bake all admin and it made: cake/src/controller/Admin/AdminController.php but I want to make some thing like that: cake/src/controller/Adminstrator/Admin/DashbordController.php what should I do? A: Code Generation with Bake Create Administrator plugin: cake bake plugin Administrator Create Admin prefixed Dashboard inside Administrator plugin: cake bake controller Dashboard -p Administrator --prefix Admin
doc_2173
cat dummy_file Cat Felix 3 Cat Garfield 2 Cat Tom 1 Dog Snoopy 5 Dog Spike 4 awk '{max[$1] =!($1 in max) ? $3 : ($3 > max[$1]) ? $3 : max[$1]} \ END {for (i in max) print i,max[i]}' dummy_file Cat 3 Dog 5 Additionally to extracted maximum value and arrays element I need corresponding $2. For the output like this: Cat Felix 3 Dog Snoopy 5 My question is - how to print wanted field after selecting arrays element? A: You can try: { if ($1 in max) { if ($3> max[$1]) { max[$1]=$3 type[$1]=$2 } } else { max[$1] = $3 type[$1]=$2 } } END { for (i in max) print i,type[i],max[i] }
doc_2174
undefined reference to uncompress I included zlib.h & zconf.h and here is my CMakeList.txt cmake_minimum_required(VERSION 3.4.1) add_library(core SHARED foo1.c foo2.c) # Include libraries needed for core lib target_link_libraries(core android zlib) Can anyone please tell me what's going on? Thank you ! A: Resolved by including z in target_link_libraries in CMakeList It's like this now : cmake_minimum_required(VERSION 3.4.1) add_library(core SHARED foo1.c foo2.c) # Include libraries needed for core lib target_link_libraries(core android z)
doc_2175
I have created a stored procedure as follows (DDL from IBEXPERT):- SET TERM ^ ; create or alter procedure GETNEWROWID returns ( ROWID ROWID) as begin /* Procedure Text */ rowid = (select gen_uuid() from rdb$database); suspend; end ^ SET TERM ; ^ /* Existing privileges on this procedure */ GRANT EXECUTE ON PROCEDURE GETNEWROWID TO SYSDBA; When I try and update my model, the SP is listed but when I select it, it does not get added to the model. There is no trace of it. I have tried to add it as a function import but it does not appear in the dropdown list. What am I doing wrong? Regards
doc_2176
You can do that with the class TimeZone but it's deprecated and it only returns the timezone of the computer/server. You don't have these information in the class TimeZoneInfo, so how to get them ? Ex: var tzi = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); Console.WriteLine(tzi.DaylightName); // I have the name but no info var tz = TimeZone.CurrentTimeZone; DaylightTime dst = tz.GetDaylightChanges(DateTime.UtcNow.Year); Console.WriteLine($"DST: start {dst.Start} - end {dst.End}"); // that's what I need but for a given timezone A: As you've observed, TimeZoneInfo doesn't really expose much directly other than conversions of a single instant in time. The rules for any particular time zone are available (via TimeZoneInfo.GetAdjustmentRules, but they're hard to work with accurately. The Noda Time project does expose this information: you ask a time zone for the sequence of "zone intervals" used between a start point and an end point (via DateTimeZone.ZoneIntervals). There can be transitions other than into and out of DST; a time zone's standard offset can change, for example. The zone intervals returned cover the interval of time you ask for. Noda Time is mostly designed to work with the IANA time zones, but you can use the Windows time zones too in the full .NET framework version (not in the .NET Core version at the moment). Let me know if you'd like a code example - if you can't use Noda Time, it doesn't make much sense to work up the example.
doc_2177
I have a User table with a column "agence" like this agence varchar(255) CHARACTER SET latin1 NOT NULL, In local mode, when i save a new user without specified the "agence" field i have this error message (which seems normal to me) Error: SQLSTATE[HY000]: General error: 1364 Field 'agence' doesn't have a default value But when i save the same things in production, i can save without error. The columns are declared in same way in local and production. The only difference i see is the version of libmysql * *libmysql - mysqlnd 5.0.12-dev (in local mode) *libmysql - 5.6.43 (in production mode) This is the result of EXPLAIN users in local Field Type Null Key Default Extra id int(11) NO PRI NULL auto_increment nom varchar(100) NO NULL prenom varchar(100) NO NULL agence varchar(255) NO NULL And in production Field Type Null Key Default Extra id int(11) NO PRI NULL auto_increment nom varchar(100) NO NULL prenom varchar(100) NO NULL agence varchar(255) NO NULL This is the request SQL Query: INSERT INTO `db`.`users` (`nom`, `prenom`) VALUES ('AAAAPETIT', 'robert' ) I don't understand why in production server, mysql seems to be more permissive ? is there an adjustment to be made ? A: The difference was the sql_mode. I showed the sql_mode like this SELECT @@sql_mode And to modify like this: SET GLOBAL sql_mode = ''; Thanks for you help
doc_2178
The problem is that, after getting outside the query, the array when I put the data of characters, says that length is 0, but it show the correct info. This photo you can see that the array above says it has more than 5 houndred items (this come from another version of the project with others techs), but the line under it, the console.log of the lenght, say it is 0 https://i.stack.imgur.com/6go8C.png This is the code of the query connection.query("SELECT * FROM persona", function (error, rows) { if (error) { throw error; } else { obtenerPersonas(rows); } }) function obtenerPersonas(rows) { rows.forEach(row => { /*I try to not introduce the data directly, but using local variables that I previusly create. It doesn't work*/ auxPer = new Persona( row.NombreClave, row.NombreMostrar, row.Apodo, row.Localizacion, row.Genero, row.Sexualidad, row.ActDep, row.ComePrimero, row.ActPreHombres, row.ActPreMujeres, row.Prota ); listaPersonas.push(auxPer); }); } /*This are the console.log of the picture, if I put them inside the connection query, they show all perfecty, the array content and length*/ console.log(listaPersonas); console.log(listaPersonas.length); If you need more info, tell me, please. I need to solve this. Without the length, I can't advance more A: connection.query is asynchronous function so it's being called after console.log(listaPersonas); console.log(listaPersonas.length);. However listaPersonas fills up after time, so console.log(listaPersonas) shows like this. If you need length then you have to write code after calling the obtenerPersonas function. connection.query("SELECT * FROM persona", function (error, rows) { if (error) { throw error; } else { obtenerPersonas(rows); // write code here } })
doc_2179
> http://localhost:8983/solr/myCore/select?q=lastName%3AHarris*&fq=filterQueryField%3Ared&wt=json&indent=true&facet=true&facet.field=state In other words, how do I add FilterParameters to a SimpleFacetQuery? Any/all replies welcome, thanks in advance, -- Griff A: I assume you're using Spring Data Solr, from your reference to SimpleFacetQuery. Based on your sample query, the code would look something like this: // creates query with facet SimpleFacetQuery query = new SimpleFacetQuery( new Criteria("lastName").startsWith("Harris")) .setFacetOptions(new FacetOptions() .addFacetOnField("state")); // filter parameters on query query.addFilterQuery(new SimpleFilterQuery( Criteria.where("filterQueryField").is("red"))); // using query with solrTemplate solrTemplate.queryForFacetPage(query, YourDocumentClass.class)
doc_2180
Thank You(In Advance) Swetha Kaulwar. A: i do this in my onActivityResult... i get the pic from the capture intent decrease its size and add it to a list which is later added to a custom listView... i hope this helps with your problen if (resultCode == Activity.RESULT_OK) { Bundle extras = intent.getExtras(); Bitmap bitmap = (Bitmap) extras.get("data"); int width = bitmap.getWidth(); Log.i("size width:", String.valueOf(width)); int height = bitmap.getHeight(); Log.i("size height:", String.valueOf(height)); float widthPercent = (float) 0.8; float heightPercent = (float) 0.8; float newWidth = bitmap.getWidth() * widthPercent; float newHeight = bitmap.getHeight() * heightPercent; while (newWidth > 250 || newHeight > 250) { newWidth = newWidth * widthPercent; Log.i("size width:", String.valueOf(newWidth)); newHeight = newHeight * heightPercent; Log.i("size height:", String.valueOf(newHeight)); } // calculate the scale - in this case = 0.4f float scaleWidth = ((float) newWidth) / width; Log.i("new size width:", String.valueOf(scaleWidth)); float scaleHeight = ((float) newHeight) / height; Log.i("new size height:", String.valueOf(scaleHeight)); Matrix matrix = new Matrix(); // resize the bit map matrix.postScale(scaleWidth, scaleHeight); // recreate the new Bitmap Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true); Log.i("new bitmap width:", String.valueOf(resizedBitmap.getWidth())); Log.i("new bitmap height:", String.valueOf(resizedBitmap.getHeight())); App.serviceCallImages.add(resizedBitmap); Adapter.notifyDataSetChanged(); break; } heres my camera intent code public void OnCameraOpen(View v) { if (App.serviceCallImages.size() < 2) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, CAPTURE_PICTURE_INTENT); } else { Toast.makeText(getApplicationContext(), getString(R.string.MaxPics), Toast.LENGTH_SHORT).show(); } }
doc_2181
* *Timer + TimerTask - Once the timer is pause, you have to re-new another one. So do the TimerTask. *ScheduledThreadPoolExecutor + Runnable - The same as the previous combination. But somebody say this is a enhanced one. But it still don't provide the functions I mentioned before. Now, I'm looking for a elegant method to solove this problem. Maybe I should focus on the locks? A: I would use the ScheduledExecutorService and use Future.cancel() to suspend. and scheduleAtFixedRate to start it again. If you want to change the period, cancel is and add it again with the new period, assuming its not suspended. If you want to hide this detail you can create a wrapper with a suspend(), resume() and setPeriod() methods.
doc_2182
//resize and crop image by center function resize_crop_image($max_width, $max_height, $source_file, $dst_dir, $quality = 80){ $imgsize = getimagesize($source_file); $width = $imgsize[0]; $height = $imgsize[1]; $mime = $imgsize['mime']; switch($mime){ case 'image/gif': $image_create = "imagecreatefromgif"; $image = "imagegif"; break; case 'image/png': $image_create = "imagecreatefrompng"; $image = "imagepng"; $quality = 7; break; case 'image/jpeg': $image_create = "imagecreatefromjpeg"; $image = "imagejpeg"; $quality = 80; break; default: return false; break; } $dst_img = imagecreatetruecolor($max_width, $max_height); $src_img = $image_create($source_file); $width_new = $height * $max_width / $max_height; $height_new = $width * $max_height / $max_width; //if the new width is greater than the actual width of the image, then the height is too large and the rest cut off, or vice versa if($width_new > $width){ //cut point by height $h_point = (($height - $height_new) / 2); //copy image imagecopyresampled($dst_img, $src_img, 0, 0, 0, $h_point, $max_width, $max_height, $width, $height_new); }else{ //cut point by width $w_point = (($width - $width_new) / 2); imagecopyresampled($dst_img, $src_img, 0, 0, $w_point, 0, $max_width, $max_height, $width_new, $height); } $image($dst_img, $dst_dir, $quality); if($dst_img)imagedestroy($dst_img); if($src_img)imagedestroy($src_img); } And this will do the resize: resize_crop_image($width, $height, $image_URL, $save_URL) This code works fine for me but i want to ONLY send the output to user's browser, since saving thousands of extra images isn't possible. There are libraries i can use, but i don't want to use a third party snippet. Is there a way to alter this code in the way i desire? Thanks. A: For your $image function , do not specify a destination directory (null) and an image stream will be created. header("Content-type:{$mime}"); That should send the image to the user A: You just need to set the proper headers and echo the output. Every PHP request "downloads a file" to the browser, more or less. You just need to specify how the browser handles it. So try something like: header("Content-Type: $mime"); header("Content-Disposition: attachment; filename=$dst_img"); echo $dst_img; That should do it for you.
doc_2183
from flask import Flask, render_template, request, redirect import dill app = Flask(__name__) @app.route('/',methods=['GET','POST']) def main(): return redirect('/index') @app.route('/index',methods=['GET','POST']) def index(): message = ' ' if request.method == 'GET': return render_template('index.html',output=message) elif request.method == 'POST': gender = request.form.get('sex') poverty = request.form.get('poverty') school = request.form.get('school') marital = request.form.get("marital") race = request.form.get("race") orient = request.form.get("orient") phys = request.form.get("phys") drinks = request.form.get("drinks") age = request.form.get("age") message = ' ' output = get_risk([phys,orient,school,drinks,race,poverty,marital,gender,age]) if output ==0: message = "Not At Risk" elif output == 1: message = "At Risk!" return render_template('index.html',output=message) def get_risk(features): forest = dill.load(open('forest.pkd','rb')) return forest.predict(features) Any suggestions? A: "Method not allowed" in the browser is common and doesn't really tell you much- it's a way to hide the details of the error from users who shouldn't see your code or know about the details your app. Try heroku logs to get a more detailed report. I have been getting the same error even though the heroku logs say my app is running on heroku A: Seeing this 3 years and 8 months later. I had simply created the app first and tested the default page heroku creates but I was getting this Method Not Allowed. My issue was using the wrong link. The git.heroku.com/yourapp.git gives this error. But the yourapp.herokuapp.com/ link worked. Again, this was just with the default page. If you deployed your app and errors exist at the correct URL, you will probably be getting an Application Error page and as mentioned before, you need to utilize the heroku logs on their dashboard to resolve those.
doc_2184
I would then like to add a stop command which Name property as a parameter but when i write CommandParameter= {Binding Name}, my button is disable. I try to set CommandParameter with a random string and that's working, so the probleme comes from the binding. <DataGrid.Columns> <DataGridTextColumn Header="Name" Binding="{ Binding Name }"/> <DataGridTextColumn Header="Source" Binding="{ Binding Source }"/> <DataGridTextColumn Header="Target" Binding="{ Binding Target }"/> <DataGridTemplateColumn Header="Stop"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Content="Stop" Command="{ Binding DataContext.StopCommand, RelativeSource = { RelativeSource FindAncestor,AncestorType={ x:Type DataGrid } } }" CommandParameter="{ Binding Name }"/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> Thanks you ! A: I think that this problem is in your code-behind code. I have created an example for you and in this example, I'm using your XAML code. In this example, I'm using Prism.WPF NuGet package. XAML code: <DataGrid ItemsSource="{Binding Items}" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="Name" Binding="{Binding Name}"/> <DataGridTextColumn Header="Source" Binding="{Binding Source}"/> <DataGridTextColumn Header="Target" Binding="{Binding Target}"/> <DataGridTemplateColumn Header="Stop"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Content="Stop" Command="{Binding DataContext.StopCommand, RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding Name}"/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid> Code-behind: public partial class MainWindow : MetroWindow { public MainWindow() { InitializeComponent(); DataContext = new FooViewModel(); } } public class Foo { public string Name { get; set; } } public class FooViewModel : BindableBase { public FooViewModel() { for (int i = 0; i < 100; i++) Items.Add(new Foo() { Name = $"name_{i}" }); StopCommand = new DelegateCommand<string>(OnStopCommand); } public ICommand StopCommand { get; private set; } public ObservableCollection<Foo> Items { get; set; } = new ObservableCollection<Foo>(); private void OnStopCommand(string name) => Console.WriteLine(name); }
doc_2185
import {useState, useEffect, useContext} from 'react'; import L from 'leaflet'; import styles from './styles.module.scss'; import { MapContext } from './../../../../context/MapProvider'; const ZonesBar2 = () => { const [definingZone, setDefiningZone] = useState(false); const [markerInput, setMarkerInput] = useState({lat: '', lng: ''}); // const [] = useState(); const [markers, setMarkers] = useState([]); const {contextData, setContextData} = useContext(MapContext); const {mapRef, clickLocation} = contextData; useEffect(()=>{ if(clickLocation.lat) { // Add markert to map let newMarker = L.marker([clickLocation.lat, clickLocation.lng], {draggable: true}) .on('dragend', console.log('Marker dragged')) .addTo(mapRef); // Add to list of markers setMarkers((m)=>([...m, newMarker])); console.log(newMarker.getLatLng()); } }, [clickLocation]) return ( <div className={styles.zonesbar}> <button onClick={()=>{setDefiningZone((p)=>(!p))}}>Nueva Zona</button> <div className={`${styles.newMarkerPanel} ${definingZone && styles.visible}`}> <label> <span>Nombre:</span> <input type="text" /> </label> <label> <span>Latitud:</span> <input type="text" id='lat' /> </label> <label> <span>Longitud:</span> <input type="text" /> </label> <button>+ Marcador</button> </div> </div> ) } export default ZonesBar2; I honestly can't figure out what's going on... I do need your expert's hands help please. This is a screenshot of the error: A: There's a lot of stuff going on there, but what I see is this: let newMarker = L.marker([clickLocation.lat, clickLocation.lng], {draggable: true}) .on('dragend', console.log('Marker dragged')) // <-- bad times right here .addTo(mapRef); When you write console.log('something'), that expression is immediately evaluated. And console.log returns undefined...so leaflet is trying to fire a function which is undefined. You need this: let newMarker = L.marker([clickLocation.lat, clickLocation.lng], {draggable: true}) .on('dragend', () => { console.log('Marker dragged') }) // <-- callback .addTo(mapRef); Now you're passing a proper callback, which is a function, not the return value of console.log(). A: You must pass a function reference: let newMarker = L.marker([clickLocation.lat, clickLocation.lng], {draggable: true}) .on('dragend', console.log('Marker dragged')) .addTo(mapRef); Also dispose of the handler at the end: return ()=> { newMarker.off('dragend'); }
doc_2186
But if you look at the java client, i dont see an option to set it other than millis. https://cloud.google.com/bigtable/docs/reference/admin/rpc/google.bigtable.admin.v2#google.bigtable.admin.v2.Table.TimestampGranularity Same for Ruby client https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-bigtable/lib/google/cloud/bigtable/instance.rb#L548 Does anyone know if it is possible to set the granularity to micros? A: I reached out to google and they confirmed that they only support setting cell timestamp by millis granularity even though the timestamp internally seems to be stored as micros. This is what their C++ library says Cloud Bigtable currently supports only millisecond granularity in the cell timestamps, both TIMESTAMP_GRANULARITY_UNSPECIFIED and MILLIS have the same effect. Creating cells with higher granularity than the supported value is rejected by the server. https://googleapis.github.io/google-cloud-cpp/latest/bigtable/classgoogle_1_1cloud_1_1bigtable_1_1v1_1_1TableConfig.html#a4ee0e2162c04b1e67bbac98605d165fd A: As mentioned in the Google API Documentation: If unspecified at creation time, the value will be set to MILLIS It seems that you need to set the granularity when creating your BigTable to micros, unless, it will be set to default to milliseconds. Besides that, as mentioned in the Package google.bigtable.v2 documentation, there is the function TimestampRangeFilterMicros that you can use with values in micros - more information in this BigTable documentation here. Let me know if the information helped you!
doc_2187
settings.py from decouple import config "SECRET_KEY" = config("MY_SECRET_KEY") requirements.txt python-decouple==3.7 .env MY_SECRET_KEY = "THISISMYSECRETKEY-THISISMYSECRETKEY-THISISMYSECRETKEY" Since I've include .env inside my .gitignore file, the .env is not being pushed to Github. When I try to deploy my project I keep getting an error: "web: decouple.UndefinedValueError: SECRET_KEY not found". The project runs fine on a local server. A: With Ashwini's help I was able to figure it out. You can store environment variables in AWS by using the cli: https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-pass-variables/ Additionally, you can view and add environment variables through the AWS dashboard: Elastic Beanstalk / Click on your environment hyperlink / Click "Configuration" (on the left side of the page) / Click the "Edit" button under the software section.
doc_2188
for (int i=0; i < NUM_STREETS; i++) { Process process = runtime.exec("java -classpath \\bin trafficcircle.Street 1 2"); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null && !line.isEmpty()) { System.out.println(line); System.out.flush(); } InputStream es = process.getErrorStream(); InputStreamReader esr = new InputStreamReader(es); BufferedReader br2 = new BufferedReader(esr); while ((line = br2.readLine()) != null && !line.isEmpty()) { System.out.println(line); System.out.flush(); } int exitVal = process.waitFor(); System.out.println("Process exitValue: " + exitVal); } Where 'Street' is: public class Street { /** * @param args * 0 - Simulation run time * 1 - Flow time interval */ public static void main(String[] args) { System.out.println(args[0]); System.out.println(args[1]); System.out.flush(); } } Prints out: Error: Could not find or load main class trafficcircle.Street Process exitValue: 1 Error: Could not find or load main class trafficcircle.Street Process exitValue: 1 Error: Could not find or load main class trafficcircle.Street Process exitValue: 1 Error: Could not find or load main class trafficcircle.Street Process exitValue: 1 'Street.class' in my Eclipse project is under \bin in package trafficcircle. I thought Runtime.exec would complain first if it wasn't found...what's up with this? A: I assume you are getting an error which you are discarding. Try using ProcessBuilder.redirectErrorStream(true); When you try to run a command it is not run in a shell, and may be getting an error which you don't see on the command line. I would explicitly use "java","-classpath","bin","trafficcircle.Street","1","2"` and make sure you are getting any error messages. another option is to use a shell like "/bin/bash", "-c", "java -classpath bin trafficcircle.Street 1 2" A: Use ./bin (with a dot) to use relative paths.
doc_2189
MPMoviePlayerController *moviePlayer; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://127.0.0.1:8080/m3u8/test.ts"]]; It can not work, and I segment it by m3u8-segmenter to test.m3u8, it can play. I want to know , How to play ts stream on ios?
doc_2190
* *Table 1 contains sales data on 'Financial year to date last year' (FYTD LY) *Table 2 contains sales data on 'Full financial year last year' (FULL FY LY) Using Power Query: I want to append these tables into one table, with a column indicating which of the two tables the data came from. I don't want duplicate values in the appended table -So I want to keep all the data from 'FYTD LY' and only combining it with the data from 'FULL FY LY' that doesn't already exists inside the 'FYTD LY' table. Unfortunately my tables don't contain an ID column and I can't create one (that I can be certain will stay unique) from the columns available. Is this even possible in Power Query -and how would I go about it? A: See if this helps you Simplest method .... load in your first table to powerquery, file close and load. Load in your second table to powerquery. Add column ... custom column .. with formula ="Second table" Home .. append queries .. append the other table Click select all the columns except the custom column, right click and remove duplicates done. Full code for Table2 (assuming you already created query Table1 with data from Table1) : let Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content], #"Added Custom" = Table.AddColumn(Source, "From", each "Second Table"), #"Added Index" = Table.Combine({#"Added Custom",Table1}), #"Removed Duplicates" = Table.Distinct(#"Added Index", {"a", "b", "c"}) in #"Removed Duplicates" If you want to get fancy, change the formula to replace Table1 so = Table.Combine({#"Added Custom",Table1}), becomes = Table.Combine({#"Added Custom",Table.AddColumn(Table1, "From", each "First Table")}),
doc_2191
Suppose I have modules of code A, B, C and D. A depends on B,C,D; B depends on C; C, D don't depend on other modules. (I use the term "modules" loosely, so no nitpicking here please). Additionally, in all of A,B,C,D, a few identical header files are used, and perhaps even a compiled object, and it doesn't make sense to put these together and form a fifth module because it would be too small and useless. Let's have foo.h be one of the files in that category. While all of these modules are kept within a single monolithic code repository, all is good. There's exactly one copy of everything; no linker conflicts between objects compiled with the same functions etc. The question is: How do I make each of B, C, D into a version-managed repository, so that: * *Each of them can be built with only the presence of the modules it depends on (either as submodules/subrepositories or some other way); and *I do not need to make sure and manually maintain/update separate versions of the same files, or make carry-over commits from one library to the next (except perhaps changing the pointed-to revision); and *When everything is built together (i.e. when building A), the build does not involve qudaruple copies of foo.h and a double copy of C (once for A and once for B) - which I would probably always have to make sure and keep perfectly synchronized. Note that when I have a bit more time I'll edit this to make the question more concrete (even though I kind of like the broad question). I will say that in my specific case the code is modern C++, CUDA, some bash scripts and CMake modules. So a Java-oriented solution would not do. A: VERY BRIEFLY, you might want to explore an artifact repository (Artifactory) and dependency management solutions (Ivy, Maven, Gradle). Then as shared-base-module is built, you stick it in the artifact repo. When you want to build the top-modules that depend on shared-base-module; the build script simply pulls down the last version of shared-base-module and links/compiles top-module against what it pulled down .
doc_2192
ID Col1 Col2 Col3 Col4 001 A 001 B 001 C 001 D 002 X 002 Y I want the result like the following: ID Col1 Col2 Col3 Col4 001 A B C D 002 X Y The challenge is the number of columns is unknown, maybe this it has a Col5 or even Col10. Any thoughts? Much appreciated. A: You can do this with aggregation: select id, max(col1) as col1, max(col2) as col2, max(col3) as col3, max(col4) as col4 from t group by id; This assumes that there are no duplicates within a column for an id. For additional columns, you would need to add additional clauses to the select statement.
doc_2193
If I havedf: Mule Creek Saddle Mtn. Calvert Creek Date 2011-05-01 23.400000 35.599998 8.6 2011-05-02 23.400000 35.599998 8.0 2011-05-03 23.400000 35.700001 7.6 2011-05-04 23.400000 50.000000 7.1 2011-05-05 23.100000 35.799999 6.4 2011-05-06 23.000000 35.799999 5.7 2011-05-07 40.000000 35.900002 4.7 2011-05-08 23.100000 36.500000 12.0 2011-05-09 23.299999 37.500000 4.4 2011-05-10 23.200001 37.500000 3.6 and I find where the maximum of each column occurs with: max = df.idxmax() I want to make values before the identified maximums max all np.nan Desired result: Mule Creek Saddle Mtn. Calvert Creek Date 2011-05-01 NaN NaN NaN 2011-05-02 NaN NaN NaN 2011-05-03 NaN NaN NaN 2011-05-04 NaN 50.000000 NaN 2011-05-05 NaN 35.799999 NaN 2011-05-06 NaN 35.799999 NaN 2011-05-07 40.000000 35.900002 NaN 2011-05-08 23.100000 36.500000 12.0 2011-05-09 23.299999 37.500000 4.4 2011-05-10 23.200001 37.500000 3.6 A: Can check where the cumulative max is the same as the max: df.where(df.cummax() == df.max()) Mule Creek Saddle Mtn. Calvert Creek Date 2011-05-01 NaN NaN NaN 2011-05-02 NaN NaN NaN 2011-05-03 NaN NaN NaN 2011-05-04 NaN 50.000000 NaN 2011-05-05 NaN 35.799999 NaN 2011-05-06 NaN 35.799999 NaN 2011-05-07 40.000000 35.900002 NaN 2011-05-08 23.100000 36.500000 12.0 2011-05-09 23.299999 37.500000 4.4 2011-05-10 23.200001 37.500000 3.6 A: I would use max and cumprod. df[(df < df.max()).cumprod().ne(1)] Mule Creek Saddle Mtn. Calvert Creek Date 2011-05-01 NaN NaN NaN 2011-05-02 NaN NaN NaN 2011-05-03 NaN NaN NaN 2011-05-04 NaN 50.000000 NaN 2011-05-05 NaN 35.799999 NaN 2011-05-06 NaN 35.799999 NaN 2011-05-07 40.000000 35.900002 NaN 2011-05-08 23.100000 36.500000 12.0 2011-05-09 23.299999 37.500000 4.4 2011-05-10 23.200001 37.500000 3.6 But perhaps there are other ways. A: Simple but probably inefficient method: for c in df.columns: df[c].loc[df[c].index[0]: df[c].idxmax()] = np.nan
doc_2194
In my opinion, It should include; * *appropriate rendering of UI components in the form. *enabling/Disabling of components based on user actions (password can not be empty message when password is not entered and form is submitted). Are there any guidelines/rule of thumbs which should be used while devising unit test cases for UI application? Should an application behavior considered in unit testing? A: In general, testing UI components is not an easy task - you need a good architecture on the tested code, quite some tools (which may come with some license costs...), and at least one virtual machine. The most important part is to have some 'Model-View-younameit' architecture in place, because only this allows you to isolate the UI stuff from the rest of the application. A test for the login form can then be as follows: * *A tool (e.g. White or Ranorex) mimics a user typing in some user/password combination. *The test verifies (by the help of e.g. a mocking framework or Typemock), that the correct methods are called (or not called under certain circumstances). What you have to avoid for UI testing in any case is calling some business logic underneath. If you can't isolate the UI this way (which is often the case especially for legacy projects...), then automating UI testing may not be beneficial at all, because it often comes with way too much effort in such a situation. Sometimes you better go with manual testing... HTH! Thomas A: UI testing is not unit testing in the strict sense, however there are tools/frameworks to help that. I assume you mean a web UI - for this you can try e.g. Selenium or HttpUnit. Note that "appropriate rendering of UI components" is a very loose term - it can mean things which can not be verified automatically, only by human eye. Testing functionality via the UI is always more cumbersome than testing the code directly via classic unit tests. Hence it is always recommended to separate the business logic from the UI as much as possible - then you can thoroughly test all the nooks and crannies of the logic itself via unit tests, and need only integration tests on the UI to verify that the app as a whole works as expected. In your example, ideally the input validation and the authentication would be separated from the GUI, so you could unit test these (preferably by mocking out the DB). Thus you could verify that the login works as expected for all sorts of normal/abnormal inputs (empty userid/password, strange characters, very long input, logging in the same user twice, ...). Then in the UI tests you need only test a few common test cases to verify that the app indeed is functional. A: If your UI is a native graphical application, you may want to consider AutoIt (Windows only), which allows you to programmatically click any place on the screen and simulate text typed into an widget or just keyboard presses. It also has the ability to read the color of pixels at specified positions. Or you can use it to take screen shots and do an image comparison. If it's web based, you may also want to consider using xpath to determine (non-graphically) whether elements exist in your generated HTML. It doesn't help you with how pages are rendered though. AutoIt may help with that as well, but you won't be able to perform the same type of test on a different platform, assuming you would like all users from all platforms to be able to reasonably access your page. If your UI is console based, consider using Expect. I prefer the Perl based expect, which is based on the TCL Expect. I know I'm not answering directly about rules or guidelines, but I think knowing what tools are available out there will open up the possibilities that you think may not exist or had not considered. Just as an example, you can use AutoIt to determine whether a component is disabled or enabled because usually the widget is of a different color from the enabled version when it is disabled. So by using AutoIt to obtain the color of a pixel or region of the screen, you can programmatically test whether that widget is enabled or not.
doc_2195
Here's what I'm trying to do: I am launching a sprite with an initial velocity in both x and y directions. The sprite should start near the screen's bottom left corner (portrait mode) and leave near the bottom right corner. Another sprite should appear somewhere on the previous sprite's trajectory. This sprite is static. The blue frame is the screen boundary, the black curve is the first sprite's trajectory and the red circle is the static sprite. Now using the screen as 640 x 960. In my SKScene's didMoveToView: method I set the gravity as such: self.physicsWorld.gravity = CGVectorMake(0.0f, -2.0f); Then I make the necessary calculations for velocity and position: "t" is time from left corner to right; "y" is the maximum height of the trajectory; "a" is the acceleration; "vx" is velocity in the x direction; "vy" is velocity in the y direction; and "Tstatic" is the time at which the dynamic sprite will be at the static sprite's position; "Xstatic" is the static sprite's x-position; "Ystatic" is the static sprite's y-position; -(void)addSpritePair { float vx, vy, t, Tstatic, a, Xstatic, Ystatic, y; a = -2.0; t = 5.0; y = 800.0; vx = 640.0/t; vy = (y/t) - (1/8)*a*t; Tstatic = 1.0; Xstatic = vx*Tstatic; Ystatic = vy*Tmark + 0.5*a*Tstatic*Tstatic; [self spriteWithVel:CGVectorMake(vx, vy) andPoint:CGPointMake(xmark, ymark)]; } -(void)spriteWithVel:(CGVector)velocity andPoint:(CGPoint)point{ SKSpriteNode *staticSprite = [SKSpriteNode spriteNodeWithImageNamed:@"ball1"]; staticSprite.anchorPoint = CGPointMake(.5, .5); staticSprite.position = point; staticSprite.name = @"markerNode"; staticSprite.zPosition = 1.0; SKSpriteNode *dynamicSprite = [SKSpriteNode spriteNodeWithImageNamed:@"ball2"]; dynamicSprite.anchorPoint = CGPointMake(.5, .5); dynamicSprite.position = CGPointMake(1 ,1); dynamicSprite.zPosition = 2.0; dynamicSprite.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:hoop.size.width/2]; dynamicSprite.physicsBody.allowsRotation = NO; dynamicSprite.physicsBody.velocity = velocity; dynamicSprite.physicsBody.affectedByGravity = YES; dynamicSprite.physicsBody.dynamic = YES; dynamicSprite.physicsBody.mass = 1.0f; dynamicSprite.markerPoint = point; dynamicSprite.physicsBody.restitution = 1.0f; dynamicSprite.physicsBody.friction = 0.0f; dynamicSprite.physicsBody.angularDamping = 0.0f; dynamicSprite.physicsBody.linearDamping = 0.0f; [self addChild:hoop]; [self addChild:marker]; } When I execute the code, the following happens: Can someone please help me out?
doc_2196
var pkg=JavaImporter(org.openqa.selenium) //import java selenium package var support_ui=JavaImporter(org.openqa.selenium.support.ui.WebDriverWait) //import WebDriverWait Package var ui=JavaImporter(org.openqa.selenium.support.ui) //import Selenium Support UI package var wait=new support_ui.WebDriverWait(WDS.browser,180) WDS.sampleResult.sampleStart() //sample starting point WDS.browser.get('${__P(application.url)}') wait.until(ui.ExpectedConditions.visibilityOfElementLocated(pkg.By.id('pmj-login-btns'))) WDS.sampleResult.sampleEnd() A: I think it is not possible without modifying the JPGC_ChromeDriverConfig plugin code. Atleast, I am not aware of it. But, there is an option to use JSR223. Please check the below code:- import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.chrome.ChromeDriver; ChromeOptions options = new ChromeOptions(); options.addArguments("--start-maximized") options.addArguments("--incognito"); System.setProperty("webdriver.chrome.driver", "D:\\Path\\chromedriver.exe"); WebDriver driver = new ChromeDriver(options); driver.get('http://jmeter-plugins.org') Above will launch the browser in incognito and maximized mode. Hope this help.
doc_2197
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script> <div class="container"> <ul id="dropdown" class="dropdown-content"> <li><a href="#accueil">Accueil</a></li> <li><a href="#entreprise">Notre entreprise</a></li> <li><a href="#réalisations">Nos réalisations</a></li> <li><a href="#contact">Contact</a></li> </ul> <a class = "btn dropdown-button" href = "#" data-activates = "dropdown">Mail Box <i class = "mdi-navigation-arrow-drop-down right"></i></a> </div> Here is what i have : https://codepen.io/anon/pen/pWpRRz A: Just add the following css .container { position: fixed; top: 5%; right: 0; left: 0; } .btn{ float: right; } You can also check the Updated Codepen.
doc_2198
My version return all DataFrames equals. df_positions_snapshots.sort_values('timestamp', inplace=True, ascending=False) df_positions_snapshots.reset_index(drop=True, inplace=True) latest_state = df_positions_snapshots.drop_duplicates('POS_id') df_positions_snapshots_last = df_positions_snapshots.drop(index=latest_state.index) next_state = latest_state.copy() states[next_state['timestamp'].max()] = next_state.copy() ind_copy = df_positions_snapshots_last.index states = {} for ind in ind_copy: row = df_positions_snapshots_last.loc[ind, :].copy() if row['POS_id'] in next_state['POS_id']: next_state.replace(to_replace=next_state[next_state['POS_id'] == row['POS_id']], value=row, inplace=True) else: next_state.append(row) states[row['timestamp']] = next_state.copy() A: Is there a specific reason you need the DataFrame to be saved as a dictionary? Would another method of serializing work (i.e CSV, Pickle, etc.)? There is the pandas method pd.to_dict that I would suggest you use. If this is not what you are looking for, could you give more detail or provide a dummy input and output dataset? df = pd.DataFrame({'col1': [1, 2], 'col2': [0.5, 0.75]}, index=['row1', 'row2']) df.to_dict() Output: {'col1': {'row1': 1, 'row2': 2}, 'col2': {'row1': 0.5, 'row2': 0.75}} A: I found the problem what you are trying to express. use import copy copy.deepcopy This will allocate the unique DF elements that you are expecting, wont return the duplicates
doc_2199
"The report parameter 'StartDate' has a DefaultValue or a ValidDate that depends on the report parameter "StartDate". Forward dependencies are not valid. I have written tons of reports using the same database and same parameters and this has always worked. I worked for a different company now that uses the same ERP software as my previous employer, so I'm not sure what the difference is. I'm using Visual Studio 2015, and SQL 2014 WHERE (invoicedate BETWEEN @StartDate AND @Enddate) My parameter settings are set to use Date/Time under General, and Get values from a query under Available values. There are no default values indicated. A: I believe it is a cascading-related problem. Make sure the type of the variables match, as they both should be date, datetime or string. Also, please do: 1- Ensure the order of the parameters in your report completely matches with the order in your SQL Script. Example: If @param1=startDate and @param2=EndDate in the report, then make sure the Script takes startDate first as @param1 and then EndDate as @param2. 2- If EndDate is based on StartDate (like EndDate=DateAdd(month,2,StartDate), then make sure you take StartDate before then EndDate. 3- Remove default values (if any) defined in SSRS, but set it in your SQL Script. Also, if you are using "cascading parameters", this is a good source: https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/aa337169(v=sql.105)