on-internet

Can't canonicalize query: BadValue $or/$and/$nor entries need to be full objects - Doctrine

I am trying to covert this query db.getCollection('queues').find({ $and:[ {queue: 'testo'}, {$or: [ {$and: [{reserved_at: null}, {available_at:{'$lte':1490323024}}]}, {reserved_at:{'$lte':1490323024}} ]} ] }); to doctrine but I am getting this error. Can't canonicalize query: BadValue $or/$and/$nor entries need to be full objects. This is what I tried. $builder = $this->get('doctrine_mongodb')->getManager()->createQueryBuilder('AppBundle:Ticket'); $builder->findAndUpdate()->addAnd([ $builder->field('queue')->equals($queue), $builder->addOr([ $builder->addAnd([ $builder->field('reservedAt')->eq

Join the discussion →

Running Spark-Shell on Windows

I have downloaded spark, sbt, scala, and git onto my Windows computer. When I try and run spark-shell in my command prompt, I get "Failed to find Spark assembly JAR. You need to build Spark with sbt\sbt assembly before running this program." I tried to follow this guide: https://x86x64.wordpress.com/2015/04/29/installing-spark-on-windows/ ,but I don't have a build subfolder so I am not sure if that is the problem. Any help would be appreciated.

Join the discussion →

How do you delete a remote annotated tag? [duplicate]

Suppose I have committed an annotated tag and pushed it. Can I delete it from the remote (& if so how)? What are the safety implications of deleting it - i.e. in what situations will it break stuff? Is any of that changed if I have already committed other normal commits after it (are annotated commits leaf nodes or do they have children?). From git docs: Annotated tags, however, are stored as full objects in the Git database. They’re checksummed; contain the tagger name, email, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG). It’s generally recomme

Join the discussion →

Running UPDATE statement inside a WHILE loop in SQL takes forever to run

I have table which contains about 10 Million records. I am trying to update this table inside a while Loop in 1000 chunks as below: DECLARE @totalRecordCount INT DECLARE @midCount INT DECLARE @Chunksize INT set @totalRecordCount = (SELECT COUNT(*) FROM Tabletemp) set @ChunkSize = CEILING(@totalRecordCount/1000)+1 -- Divide the total into 1000 chunks set @midcount = @totalRecordcount while @midcount > 0 BEGIN UPDATE top(@Chunksize) a set a.x = b.x FROM TableTemp a INNER JOIN TableTemp2 b on a.id = b.id WHERE a.x is Null SET @midCount=@@ROWCOUNT END I tried putting a select statement before @@RO

Join the discussion →

Trilateration different approaches and issues

Although there exists several posts about (multi)lateration, i would like to summarize some approaches and present some issues/questions to better clarify the approach. It seems that are two ways to detect the target location; using geometric/analytic approach (solving directly the equations with some trick) and fitting approach converting from non-linear to linear system. With respect to the first one i would like to ask few questions. Suppose in the presence of perfect range measurements,considering 2D case, the exact solution is a unique point at three circles intersection. Can anyone point

Join the discussion →

reshape a pandas dataframe

suppose a dataframe like this one: df = pd.DataFrame([[1,2,3,4],[5,6,7,8],[9,10,11,12]], columns = ['A', 'B', 'A1', 'B1']) I would like to have a dataframe which looks like: what does not work: new_rows = int(df.shape[1]/2) * df.shape[0] new_cols = 2 df.values.reshape(new_rows, new_cols, order='F') of course I could loop over the data and make a new list of list but there must be a better way. Any ideas ?

Join the discussion →

How to set headers in Soap Request Java

I am facing issue in forming a SOAP request. In that request i am supposed to add username , password and some other info in header part not the part of payload. Below the Entry in wsdl <wsdl:message name="InputUploadCustomerDocument_Headers"> <wsdl:part name="DocumentType" element="tns:DocumentType"/> <wsdl:part name="FileName" element="tns:FileName"/> <wsdl:part name="Password" element="tns:Password"/> <wsdl:part name="PinNo" element="tns:PinNo"/> <wsdl:part name="UserName" element="tns:UserName"/> </wsdl:message> <wsdl:message name="ReturnUploadCustomerDocument"> <wsdl:part name="parameters

Join the discussion →

Why do I get "Call to a member function on null ..." on a variable that my class initializes in its constructor? [closed]

I have done all sorts of things to understand what is actually wrong with the code, but I just couldn't figure out what was causing this error. Below is class called Topic: class Topic { // Init DB variables private $db; /* * Constructor */ public function __contruct() { $this->db = new Database(); } /* * Get All Topics */ public function getAllTopics() { $this->db->query("SELECT topics.*, users.username, users.avatar, categories.name FROM topics INNER JOIN users ON topics.user_id = users.id INNER JOIN categories ON topics.category_id = categories.id ORDER BY create_date DESC"); // Assign the

Join the discussion →

Why do I get "Call to a member function on null ..." when declaring a new __construct function? [closed]

I have done all sorts of things to understand what is actually wrong with the code, but I just couldn't figure out what was causing this error. Below is class called Topic: class Topic { // Init DB variables private $db; /* * Constructor */ public function __contruct() { $this->db = new Database(); } /* * Get All Topics */ public function getAllTopics() { $this->db->query("SELECT topics.*, users.username, users.avatar, categories.name FROM topics INNER JOIN users ON topics.user_id = users.id INNER JOIN categories ON topics.category_id = categories.id ORDER BY create_date DESC"); // Assign the

Join the discussion →

Android implement Parcelable objects with hashmap that contains another hashmap

This is an extension for Android implement Parcelable object which has hashmap but mine is a little different. I have these classes public class EventDetails implements Parcelable { Private String id; Private String eventName; Private Long eventUnixTime; Private HashMap <String, User> pickedUser = null; } and public class User implements Parcelable { private String email; private String userName; private String userPicture; private Boolean hasLoggedInWithPassword; private HashMap<String, Object> dateJoined = null; public User() { } public User(String email, String userName, String userPicture,

Join the discussion →

java.sql.SQLException: Listener refused the connection with the following error: ORA-12505

Hi i am beginner and present I have installed Oracle 10g Express Edition Release 2 in my windows 7 64 bit OS and tried to execute Hibernate program but i am getting below exceptions can some one help me please WARNING: Could not obtain connection metadata java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor The Connection descriptor used by the client was: localhost:1521:xe at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseErro

Join the discussion →

String encoding issue in Spark SQL/DataFrame

So I have this csv file which has two columns: id (int), name(string). When I read the file into pyspark throught the following code: schema = StructType([ StructField("id", IntegerType(), True), StructField("name", StringType(), True)]) df = sqlContext.read.csv("file.csv", header=False, schema = schema) On executing df.first() I get the following output: Row(artistid=1240105, artistname=u'Andr\xe9 Visior') This is the original row from the file: 1240105,André Visior How do I go about displaying the name as it is?

Join the discussion →

Serialize and deserialize a collection to JSON Delphi

I've searched a lot, but cannot find a working solution. Most likely because I'm pretty new to Delphi (and coming from C#). I have a unit with the following class declaration: TReplaceField = class public Key: string; Value: string; constructor Create; overload; constructor Create(strKey, strValue: string); overload; end; Class can also be record, like suggested in the comment. I want to create a collection of it, be it an array, TList<T>, or whatever suits best in this case, and then serialize it to JSON (to store it) and later deserialze it to loop over the fields. I've found REST.JSON and T

Join the discussion →

Algumas das reais soluções para o erro de bloqueio de renderização e melhora na performance

Bom, ultimamente tenho visto, em artigos sobre performance, alguns hangouts, e também nos grupos em redes sociais, sobre um tal de "bloqueio de renderização do conteúdo acima da borda". Mas o que é esse erro ? Bom, em resumo, esse erro é causado, porque ao carregar arquivos no header da página html, como de costume para o CSS, a renderização do código pode ser interrompida para baixar os arquivos requisitados (caso sejam mais do que 2 arquivos, isso já começa a atrasar um pouco), isso é dado pois o protocolo HTTP só consegue processar 2 conexões de cada vez, então se você carrega o seu HTML, c

Join the discussion →

org.springframework.orm.jpa.JpaSystemException: null id generated for:class oneToOne

As the title,I got the following exception when I try to save Datas using Spring Data jpa.Please help me out to solve this problem because I still couldn't solve though searching familiar problems. Class Activity: @Entity @Table(name = "activity") @Access(AccessType.FIELD) public class Activity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String activityName; private String startTime; private String endTime; @OneToOne(fetch = FetchType.LAZY, mappedBy = "activity", cascade = CascadeType.ALL, optional = false) private ActivityContent

Join the discussion →

set windowlightstatusbar property programmatically

As you know we can set the windowLightStatusBar from xml by following codes. <item name="android:windowLightStatusBar">true</item> i need to change this attribute true to false or false to true by programmatically. Is there a way to achive it?

Join the discussion →

What does a Head do in html?

I'm working on a HTML project. And I'm new to HTML and CSS, I'm happy with what I have now. So my question is: What does a <head> do in a HTML code. Thanks already cheers.

Join the discussion →

Handling External Links in android WebView like Gmail App does

I'm a web developer. I'm currently developing android application on Android Studio using WebView which access my website as an android application. One of my webpage contains many external links. My goal is to make the android application can handle external links like Gmail App does (also like facebook and Line do). Below is the example of gmail app. An email contains external link Link clicked, then application open a new activity acts like a browser without leaving Gmail application Any idea how to make it?

Join the discussion →

Why is my imported module grayed out in PyCharm but still needed to run?

I am very new to programming and I don't understand why the module I imported from mpl_toolkits.mplot3d import Axes3D is grayed out in PyCharm. If I run the program without it, I get errors. I'm sure there are plenty of things wrong with what I'm doing in this program. I'm just trying to get a contour graph of a specific function and a surface plot. Any suggestions would be much appreciated. from mpl_toolkits.mplot3d import Axes3D # <-- Gray import numpy as np from numpy import arange from pylab import meshgrid, imshow, contour, colorbar, show from matplotlib import cm from matplotlib.ticker i

Join the discussion →

Getting InvalidArgumentError in Tensorflow

I created a CNN for predicting the labels of an image. I trained it. Now i want to use my model for predicting the labels for new image. My code for CNN is this:- def LeNet(x): # Arguments used for tf.truncated_normal, randomly defines variables for the weights and biases for each layer mu = 0 sigma = 0.1 # SOLUTION: Layer 1: Convolutional. Input = 32x32x3. Output = 28x28x6. conv1_W = tf.Variable(tf.truncated_normal(shape=(5, 5, 3, 6), mean = mu, stddev = sigma)) conv1_b = tf.Variable(tf.zeros(6)) conv1 = tf.nn.conv2d(x, conv1_W, strides=[1, 1, 1, 1], padding='VALID') + conv1_b # SOLUTION: Act

Join the discussion →

About tarjan algorithm, why can't we take low[v] instead of disc[v] when considering the backward edge?

I read an article about Tarjan's algorithm, blog. In this article, the author asks a question: In case two, can we take low[v] instead of disc[v] ?? . Answer is NO. If you can think why answer is NO, you probably understood the Low and Disc concept. I don't know why. When I am reading the similar article in wiki, I found that the code can be like that: else if (w.onStack) then // Successor w is in stack S and hence in the current SCC v.lowlink := min(v.lowlink, w.lowlink) I wanna know why the author say the answer is NO. Thanks for answering my question. Have a good day.

Join the discussion →

Redirect user to another PHP page with parameters [duplicate]

I'm trying to redirect user to another PHP page to edit a SQL table, when a button is clicked. This is the code: $("#modificaDipinto").click(function(){ var tipo = <?php echo json_encode($tipo_opera); ?>; var codice = <?php echo json_encode($cod); ?>; var titolo = <?php echo json_encode($titolo); ?>; var annoCreaz = <?php echo json_encode($annoCreaz); ?>; var museo = <?php echo json_encode($museo); ?>; var dimensioni = <?php echo json_encode($dim); ?>; var tipoPittura = <?php echo json_encode($tipo_pittura); ?>; window.location.href = "modifica.php?codice="+codice+"&tipo="+tipo+"&titolo="+tito

Join the discussion →

Storing content along with special characters in PHP [duplicate]

I have an add_post form which include post_title, post_content and date. post_content may contain special_characters and HTML elements There is a problem to store into post_content Example string: gyms revolve around this unique factor called “Community.” If I try to insert that string into the database table the following string is inserted for instance: gyms revolve around this unique factor called Because of the symbols (“ ” ’) I am not able to insert the all data I just want to remove these symbols so that I would be able to add all post_content data This is what I have tried: $post_conten

Join the discussion →

Javascript Prompt Box Loops

Something is wrong with this code but I can't figure out what it is. The page does not work properly or do what it's supposed to. I need a code that prompts for a password and that limits the attempts to 3. After the third attempt, it needs to have an alert box. <script> var attempts = 3; var answer = prompt("Password: "); while (attempts != 0) { if (answer == "Psycho") { document.write("These are pictures of my kitten and her things."); } else { answer = prompt("Password: "); attempts--; } } if (attempts = 0) { alert("Incorrect Password"); } </script>

Join the discussion →

How to access the instantiated object after loading a custom library in CodeIgniter

An Error Was Encountered Unable to load the requested class: Plugin_update_checker I am using custom library which create a dynamic php file with 740 line code controller function: public function create() { // ... irrelevant, working code ... // Can't Load this Library ------------------- $this->load->library('Plugin_update_checker'); // ------------------------------------------- $php_code = new plugin_update_checker(); $dir = 'api/' . $repo->sum($userId, 1548) . '-' . $repo->slug($userName) . '/plugins/'; $file_name = 'WinnRepo' . $repo->slug_space($data['title']) . 'PluginUpdater_'.$key; $

Join the discussion →

Group-Object is showing a hashtable when using calculated properties

Background From list of predefined servernames, I'm searching in config files and trying to group for each server all the files where it's found. A filename can be mapped to an application. Problem The grouping part is giving me problems. It keeps returning a hashlist where I just want the filename returned. SSCCE note: grouping is on filename in the sscce but the gist of the problem is the same This example is showing the entire line where the match is found instead of just the match @("A test", "Another test") | sls -pattern "\btest\b" | group filename | select name, group Trying to adjust f

Join the discussion →

Spring Data MongoDB findById not returning results

I have a Snozberry object that looks like this: { "id":"3cbdb746-561d-4e21-82e0-b7cfcad3a094", "thingId":"7cbfb7a6-763d-6ef1-271b-b2a0cfc2fa43", "stuffId":81, "bits":"WooHoo" } Java class (constructor, getter & setters omitted for brevity): @Document(collection="Snozberry") public class Snozberry { @Id private UUID id; private UUID thingId; private Long stuffId; private String bits; } The repository looks like: public interface SnozberryRepository extends MongoRepository<Snozberry,UUID>{ Snozberry findByThingId(UUID Id); Snozberry findById(UUID id); } In the MongoDB collection, the _id & thing

Join the discussion →

Split dataset based on column values in spark

I am trying to split the Dataset into different Datasets based on Manufacturer column contents. It is very slow Please suggest a way to improve the code, so that it can execute faster and reduce the usage of Java code. List<Row> lsts= countsByAge.collectAsList(); for(Row lst:lsts) { String man = lst.toString(); man = man.replaceAll("[\\p{Ps}\\p{Pe}]", ""); Dataset<Row> DF = src.filter("Manufacturer='" + man + "'"); DF.show(); } The Code, Input and Output Datasets are as shown below. package org.sparkexample; import org.apache.parquet.filter2.predicate.Operators.Column; import org.apache.spark.

Join the discussion →

Python: How to compare two binary files?

In python I need to print a diff of two binary files. I was looking at difflib.Differ which does a lot. However differ assumes lines of text and so the output does not list the byte index and the hex value difference. What I need is output that has what byte is different, how the byte is different, the actual hex values of the two bytes. In Python, how do you compare two binary files (output: the byte diff index, the hex values of the two bytes)? I was doing something like: # /usr/bin/env python2 import difflib x = open('/path/to/file1', 'r').read() y = open('/path/to/file2', 'r').read() print

Join the discussion →
Older stories