خرید بک لینک
Recent Questions - Stack OverflowDeserializtion retus a field of a class instead of the classStacking table columns of unknown width to fit container and contentApache Nifi on QNXNotice: Trying to get property of non-object while posting data to dbCan't send e-mail with attachementHow to find aotation properties of an Owl ontology using Java Jena?NSURLProtocol stops loading after trying to inject responseBasic protection of PHP scriptsHow to remove multiple columns that end with same text in Pandas?jquery overlay after menu hoverBuilding a URL with JSON data as a query string parameter valueevent handler not working properly in loopCan't populate data to TableView in javafxHow can i do this using list comprehension?Python -- Issues with method as parameter?SQL statement to retu data aggregated by one coloumn id and data-aligned to another column id of the queried tableInserting values from FOR loop into dataframe RUnicode chars convert to UTF-8 phpDeserialize JSON with "random" keyCreateObject("Access.Application") doesn't workI can't understand this? (Ruby on Rails)Jenkins Branch Specifier Not Being ObeyedHow to create a dynamic property value in an OSGi DS service registrationjavascript get value of Mongo field already rendered - MeteorHow to make JWT cookie authentication in LaravelCompilation errors with CImgng-model inside $ionicPopup templateUrl is not working with scopeCSS id's not working [duplicate]Spark app unable to write to elasticsearch cluster ruing in dockerToggle Checkboxes on/off

most recent 30 from stackoverflow.com 2016-07-17T21:41:14Z http://stackoverflow.com/feeds/ http://www.creativecommons.org/licenses/by-sa/3.0/rdf http://stackoverflow.com/q/38426199 0 Xyag http://stackoverflow.com/users/6601091 2016-07-17T21:40:48Z 2016-07-17T21:40:48Z <p>I have a class, named Schematic, that stores a structure of blocks for use in my game. I'm trying to get a way to save and load them using the BinaryFormatter, however I have an issue with the deserialization. When I deserialize, I caot cast to my source type, instead it only lets me get one field, a two dimensional array of integers.</p> <p>Here's the code for the schematic class:</p> <pre><code>[Serializable] public class Schematic { public static Schematic BlankSchematic = new Schematic("BLANK"); public int[,] Blocks; public V2Int Size; public V2Int Location = V2Int.zero; public string Name; //---PROPERTIES--- //lower is more rare public int Rarity = 100; //---END PROPERTIES--- public Schematic(string name) { Name = name; } public Schematic(string name, int[,] blocks) { Name = name; ModifyBlockArray(blocks); } public void ModifyBlockArray(int[,] newBlocks) { Blocks = newBlocks; Size = new V2Int(newBlocks.GetLength(0), newBlocks.GetLength(1)); } } </code></pre> <p>And my methods in a separate class for serialization and deserialization:</p> <pre><code>public void SaveSchematic(Schematic schem) { using (Stream stream = new FileStream(SchematicsDirectory + "/" + schem.Name + ".schem", FileMode.Create, FileAccess.Write, FileShare.None)) { BinaryFormatter bf = new BinaryFormatter(); Debug.Log(schem.GetType()); bf.Serialize(stream, schem); } } public void LoadSchematics(string dir) { BinaryFormatter bf = new BinaryFormatter(); DirectoryInfo info = new DirectoryInfo(dir); FileInfo[] fileinfo = info.GetFiles("*.schem"); for (int i = 0; i &lt; fileinfo.Length; i++) { FileStream fs = new FileStream(dir + fileinfo[i].Name, FileMode.Open); object tempO = bf.Deserialize(fs); Debug.Log(tempO + ", " + tempO.GetType()); Schematic temp = (Schematic)tempO; SchematicsByName.Add(temp.Name, temp); Schematics.Add(temp); print("Loaded Schematic: " + temp.Name); fs.Close(); fs.Dispose(); } } </code></pre> <p>It's very strange because when I look into a serialized file, I see the other fields and the class name "Schematic." Here is a small little example file:</p> <pre><code> ÿÿÿÿ Assembly-CSharp Schematic BlocksSizeLocationNameRarity System.Int32[,]V2Int V2Int V2Int xy TestSavingd </code></pre> <p>V2Int is marked as Serializable as well. It's really weird that when I deserialize I get back the Blocks array and not the whole class. Any help would be much appreciated.</p> <p>This is my first post on here, so sorry if I made any mistakes.</p> http://stackoverflow.com/q/38426198 0 Carvo Loco http://stackoverflow.com/users/6600502 2016-07-17T21:40:47Z 2016-07-17T21:40:47Z <p>I have a layout in mind but I caot figure out how to describe it in terms that an html renderer will understand :-(</p> <p>I would like to have a rectangular structure of unknown width displaying a set of name/description pairs, each with an unknown content, laid side by side each pair in a single line if all rows can fit without breaking (and with both columns aligned, as in a table), or stacked alteating names and descriptions if any of the cells needs wrapping. Once stacked, I do not mind if the cell contents wrap to uneven heights.</p> <p>Something like this... <div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-css lang-css prettyprint-override"><code>ul { display:table; padding-left:0; list-style-type:none; } li { display:table-row; } span { display:table-cell; } span:first-child { font-weight:600; } span:last-child { padding-left:1em; } @media (max-width:730px) { ul, li, span { display:block; } span:last-child { padding-left:0; margin-bottom:.75em; } }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ul&gt; &lt;li&gt; &lt;span&gt;Something&lt;/span&gt; &lt;span&gt;Some description about something that could, conceivebly, span multiple lines.&lt;/span&gt; &lt;/li&gt; &lt;li&gt; &lt;span&gt;Something else&lt;/span&gt; &lt;span&gt;Another description about something that might also span multiple lines.&lt;/span&gt; &lt;/li&gt; &lt;li&gt; &lt;span&gt;Something else even longer&lt;/span&gt; &lt;span&gt;Short description&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt;</code></pre> </div> </div> </p> <p>... although this example uses a <code>max-width:730px</code> media query because I have manually checked the number of pixels the longest cell requires to fit in one line and rounded up to the nearest multiple of 10px, but in reality I do not know the width required because a) the actual values displayed depend on several factors evaluated at runtime, and b) the width of the container is also unknown; it is not necessarily the viewport width. It will be the viewport width minus an unknown horizontal distance greater than or equal to zero.</p> <p>Considering that this will most likely be displayed within a hybrid mobile application, and thus the underlying browser can probably be chosen for the task, to some extent, is there a hopefully scriptless way of constructing a table with wrappable columns within each row, so that the columns will wrap if necessary before their contents do?</p> <p>I hope I have expressed the question correctly; I am afraid that English is not my first language. In any case, thanks to anyone who even reads it.</p> http://stackoverflow.com/q/38426194 0 FCR http://stackoverflow.com/users/3848107 2016-07-17T21:39:01Z 2016-07-17T21:39:01Z <p>I have been reading about the possibilities of Apache Nifi. In this article <a href="http://www.zdnet.com/article/hortonworks-cto-on-apache-nifi-what-is-it-and-why-does-it-matter-to-iot/" rel="nofollow">http://www.zdnet.com/article/hortonworks-cto-on-apache-nifi-what-is-it-and-why-does-it-matter-to-iot/</a> </p> <p>and in Hortonworks website there are examples of using Nifi while simulating trucks events (speed, etc). <a href="http://hortonworks.com/hadoop-tutorial/realtime-event-processing-nifi-kafka-storm/#section_3" rel="nofollow">http://hortonworks.com/hadoop-tutorial/realtime-event-processing-nifi-kafka-storm/#section_3</a></p> <p>How come they suggest the scenario of vehicle sensor collection and filtering with Nifi when the main OS in cars is QNX and it does not support Java? Being JVM a main requirement for installing Apache Nifi. It is just some PR marketing?</p> http://stackoverflow.com/q/38426193 0 Manavalan Mavan http://stackoverflow.com/users/6542673 2016-07-17T21:38:58Z 2016-07-17T21:38:58Z <p>so I have a simple code to post data to database</p> <pre><code>&lt;?php $data = json_decode(file_get_contents("php://input")); $review = mysql_real_escape_string($data-&gt;review); mysql_coect("localhost", "root", ""); mysql_select_db("reherse"); mysql_query("INSERT INTO reviews('review') VALUES('".$review."')"); ?&gt; </code></pre> <p>But it's getting me to an error 'Trying to get property of non-object'. I'm new in PHP so It might be some stupid mistake. Will be really thankful for help!</p> http://stackoverflow.com/q/38426192 0 pythonic http://stackoverflow.com/users/1018562 2016-07-17T21:38:56Z 2016-07-17T21:38:56Z <p>According to <a href="http://naelshiab.com/tutorial-send-email-python/" rel="nofollow">this article (section #V To send an email with attachment)</a>, I should be able to send an e-mail with attachement. However, I get the error, </p> <pre><code> line 6, in &lt;module&gt; from email.MIMEMultipart import MIMEMultipart ImportError: No module named 'email.MIMEMultipart' </code></pre> <p>Any idea, how to solve this?</p> http://stackoverflow.com/q/38426191 0 Jhutan Debnath http://stackoverflow.com/users/6007765 2016-07-17T21:38:49Z 2016-07-17T21:38:49Z <p>I am developing a project on ontology using Java Jena and that needs aotation properties like 'sameAs', level, comment etc.</p> http://stackoverflow.com/q/38426189 0 CombatWombat http://stackoverflow.com/users/5285524 2016-07-17T21:38:28Z 2016-07-17T21:38:28Z <p>I am interrupting a request form a web view and trying to find inject my own response with a local epub file. The problem is that the file actually doesn't seem to be injected, I think it may have something to do with my MIMEType but I don't really know. The <code>startLoading</code> method is called properly but the <code>stopLoading</code> method is called directly afterward. And the webpage doesn't proceed. </p> <pre><code> + (BOOL)canInitWithRequest:(NSURLRequest*)request { if ([request.URL.path containsString:@"/content"]) { retu YES; } retu NO; } + (NSURLRequest*)canonicalRequestForRequest:(NSURLRequest*)request { retu request; } - (void)startLoading { NSData *fileData = [NSData dataWithContentsOfFile:[[NSUserDefaults standardUserDefaults] URLForKey:@"please work"].path]; NSURLResponse *response = [[NSURLResponse alloc] initWithURL:self.request.URL MIMEType:@"application/octet-stream" expectedContentLength:fileData.length textEncodingName:@"UTF-8"]; [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageAllowed]; [[self client] URLProtocol:self didLoadData:fileData]; [[self client] URLProtocolDidFinishLoading:self]; } - (void)stopLoading { NSLog(@"request cancelled."); } </code></pre> <p>The android equivalent that is working is </p> <pre><code>File epubFile = new File(courseDir, mItem.downloadFile); InputStream stream = new BufferedInputStream(new FileInputStream(epubFile)); WebResourceResponse response = new WebResourceResponse("application/octet-stream", "UTF-8", stream); ArrayMap&lt;String, String&gt; headers = new ArrayMap&lt;&gt;(); headers.put("Access-Control-Allow-Headers", "X-Custom-Header, X-Requested-With, Authorization, Content-Type, Accept, Requestor"); headers.put("Access-Control-Allow-Methods", "POST, GET, PUT, OPTIONS, DELETE"); headers.put("Access-Control-Allow-Origin", "*"); response.setResponseHeaders(headers) </code></pre> <p>I have also tried this </p> <pre><code>NSDictionary *headers = @{@"Content-Type" : @"application/octet-stream", @"Access-Control-Allow-Origin" : @"*", @"Access-Control-Allow-Headers": @"X-Custom-Header, X-Requested-With, Authorization, Content-Type, Accept, Requestor", @"Access-Control-Allow-Methods": @"POST, GET, PUT, OPTIONS, DELETE"}; NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.request.URL statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:headers]; </code></pre> http://stackoverflow.com/q/38426186 0 user6227447 http://stackoverflow.com/users/6227447 2016-07-17T21:37:59Z 2016-07-17T21:37:59Z <p>I'm in the process of leaing more PHP. I've not really done any PHP before, only enough for basic emailing on contact forms. In the past when I've made such forms I've occasionally had spam emails come through via that script. From the frequency of the emails and the content it is very much apparent that it isn't someone coming on the website and spamming via the form but rather they know the url of the php file and are submitting data to it via that in some way; what is the best way to prevent this sort of thing happening. </p> http://stackoverflow.com/q/38426168 0 Tanya http://stackoverflow.com/users/6601072 2016-07-17T21:35:43Z 2016-07-17T21:40:32Z <p>I'm trying to remove a group of columns from a dataset. All of the variables to remove end with the text "prefix".</p> <p>I did manage to "collect' them into a group using the following: <a href="http://i.stack.imgur.com/eSrav.jpg" rel="nofollow">enter image description here</a></p> <p>and then tried a series of ways to drop that group that resulted in a variety of errors. Can anyone please, propose a way to remove these columns?</p> http://stackoverflow.com/q/38426155 0 Lubos Belan http://stackoverflow.com/users/3994350 2016-07-17T21:33:44Z 2016-07-17T21:40:20Z <p>i have a problem with overlayer under dropdown menu (<a href="http://tanecnetopanky.sk" rel="nofollow">www.tanecnetopanky.sk</a>)</p> <p>html:</p> <pre><code>&lt;div class="top-menu"&gt; &lt;ul class="top-menu"&gt; &lt;li&gt; // ul li content level 2... // ul li content level 3 &lt;/li&gt; &lt;/ul&gt; &lt;div class="overlay"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>jquery</p> <pre><code>$("ul.top-menu &gt; li").hover(function () { if ($(".top-menu &gt; .overlay").hasClass('activate')) { retu; } $(".top-menu &gt; .overlay").addClass('activate'); $(".top-menu &gt; .overlay").stop(false, true).fadeIn('fast'); }, function () { $(".top-menu &gt; .overlay").stop(false, true).fadeOut('fast'); $(".top-menu &gt; .overlay").removeClass('activate'); }); </code></pre> <p>what I want... When I go through the first level LI items, I want to be the active overlayer. Overlayer should be a hidden after dropdown menu is hide. in opera is all ok, but in the firefox starts animation on the begiing of each item (blink effect).</p> <p>please help me with this. thx</p> http://stackoverflow.com/q/38426142 1 Marth http://stackoverflow.com/users/4285831 2016-07-17T21:32:51Z 2016-07-17T21:41:02Z <p>I have this data</p> <pre><code>$data = array('useame' =&gt; 'myname', 'password' =&gt; 'mypass' ); $json = json_encode($data); </code></pre> <p>How can i pass the json as a variable to a url that looks like this</p> <pre><code>'http://example.com/login/?data=' </code></pre> http://stackoverflow.com/q/38426116 0 ZenKurd http://stackoverflow.com/users/3291261 2016-07-17T21:29:55Z 2016-07-17T21:38:08Z <p>I am trying to apply some classes to html elements via foor loop. The problem is that the loop variable doesn't work correctly.</p> <pre class="lang-js prettyprint-override"><code>'use strict' window.onload = function(){ var elements = document.getElementsByTagName("div") for(var i = 0; i &lt; elements.length; i++){ elements[i].addEventListener("click", a(this, i), false) } function a(e, x){ if(!e.className){ e.className = "class".concat(x) } else { e.classList.remove(e.className) } } } </code></pre> <pre class="lang-css prettyprint-override"><code> div{ background-color: red; } .class0{ background-color: blue; } .class1{ background-color: purple; } </code></pre> http://stackoverflow.com/q/38426045 0 andrew http://stackoverflow.com/users/3287617 2016-07-17T21:21:24Z 2016-07-17T21:39:54Z <p>I am a newcomer to javafx, I'm developing a small app for a library that should show some data in a table, but data aren't showed in the table anyway !, I've searched and made it exactly as its supposed to be, still not populating at all.</p> <p>note : <code>DBCoection</code> is a class that coects to the database, I could read data from it without any problem.</p> <p>main class :</p> <pre><code>package app; import Coector.DBCoection; import javafx.application.Application; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.layout.GridPane; import javafx.scene.layout.VBox; import javafx.stage.Stage; import java.io.IOException; import java.sql.Coection; public class Main extends Application { private Coection coection; private Parent root; @Override public void start(Stage primaryStage) throws Exception{ primaryStage.getIcons().add(new Image(String.valueOf(this.getClass().getResource("icon.png")))); /* if(!logIn()) retu;*/ coection = DBCoection.getActiveCoection(); FXMLLoader loader = new FXMLLoader(getClass().getResource("main_screen.fxml")); // loader.setLocation(getClass().getResource("main_screen.fxml")); Parent root = (VBox) loader.load(); MainMenuController menuController = loader.getController(); menuController.setCoection(coection); menuController.init(); menuController.fillTable(); // Parent root = FXMLLoader.load(getClass().getResource("main_screen.fxml")); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } </code></pre> <p>controller class : </p> <pre><code>package app; import com.sun.org.omg.CORBA.Initializer; import javafx.collections.FXCollections; import javafx.collections.ObservableArray; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; import models.Book; import models.Borrower; import models.History; import java.net.URL; import java.sql.*; import java.util.ResourceBundle; public class MainMenuController { private Coection coection; private final int BOOK_VEIW_COLUMN_COUNT = 9; private ObservableList&lt;Book&gt; bookData; @FXML private TableView&lt;Book&gt; bookView; @FXML private TableView&lt;History&gt; historyView; @FXML private TableView&lt;Borrower&gt; borrowerView; @FXML private TableColumn&lt;Book, Integer&gt; first; @FXML private TableColumn&lt;Book, String&gt; second; @FXML private TableColumn&lt;Book, String&gt; third; @FXML private TableColumn&lt;Book, String&gt; forth; @FXML private TableColumn&lt;Book, String&gt; fifth; @FXML private TableColumn&lt;Book, String&gt; sixth; @FXML private TableColumn&lt;Book, Integer&gt; seventh; @FXML private TableColumn&lt;Book, Integer&gt; eighth; @FXML private TableColumn&lt;Book, Integer&gt; ninth; public void init(){ bookData = FXCollections.observableArrayList(); bookView = new TableView&lt;&gt;(); first.setCellValueFactory(cellData -&gt; cellData.getValue().numberProperty().asObject()); second.setCellValueFactory(cellData -&gt; cellData.getValue().nameProperty()); third.setCellValueFactory(cellData -&gt; cellData.getValue().authorProperty()); forth.setCellValueFactory(cellData -&gt; cellData.getValue().mainTopicProperty()); fifth.setCellValueFactory(cellData -&gt; cellData.getValue().secondaryTopicProperty()); sixth.setCellValueFactory(cellData -&gt; cellData.getValue().divisionProperty()); seventh.setCellValueFactory(cellData -&gt; cellData.getValue().codeNumberProperty().asObject()); eighth.setCellValueFactory(cellData -&gt; cellData.getValue().copiesProperty().asObject()); ninth.setCellValueFactory(cellData -&gt; cellData.getValue().availCopiesProperty().asObject()); } public void setCoection(Coection coection){ this.coection = coection; } public void fillTable(){ try { String sql = "select * from books"; PreparedStatement statement = coection.prepareStatement(sql); ResultSet set = statement.executeQuery(); int currNumber = 1; while(set.next()){ Book book = new Book.BookBuilder() .setAuthor(set.getString("author")) .setAvailCopies(set.getInt("available copies")) .setDivision(set.getString("division")) // .setHistory(set.getString("")) .setSecondaryTopic(set.getString("secondary topic")) .setCopies(set.getInt("copies")) .setID(set.getInt("id")) .setNumber(currNumber++) .setName(set.getString("name")) .setMainTopic(set.getString("main topic")) .setCodeNumber(set.getInt("code number")) .build(); bookData.add(book); } // bookView.getColumns().addAll(first, second, third, forth, fifth, sixth, seventh, eighth, ninth); bookView.setItems(bookData); // bookView.getColumns().addAll(first, second, third, forth, fifth, sixth, seventh, eighth, ninth); }catch (Exception e){ e.printStackTrace(); } } } </code></pre> <p>fxml file : </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?import javafx.geometry.Insets?&gt; &lt;?import javafx.scene.control.Button?&gt; &lt;?import javafx.scene.control.CheckBox?&gt; &lt;?import javafx.scene.control.Label?&gt; &lt;?import javafx.scene.control.Menu?&gt; &lt;?import javafx.scene.control.MenuBar?&gt; &lt;?import javafx.scene.control.MenuItem?&gt; &lt;?import javafx.scene.control.Separator?&gt; &lt;?import javafx.scene.control.Tab?&gt; &lt;?import javafx.scene.control.TabPane?&gt; &lt;?import javafx.scene.control.TableColumn?&gt; &lt;?import javafx.scene.control.TableView?&gt; &lt;?import javafx.scene.control.TextField?&gt; &lt;?import javafx.scene.layout.AnchorPane?&gt; &lt;?import javafx.scene.layout.HBox?&gt; &lt;?import javafx.scene.layout.Region?&gt; &lt;?import javafx.scene.layout.VBox?&gt; &lt;?import javafx.scene.control.cell.PropertyValueFactory?&gt; &lt;VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="619.0" prefWidth="1019.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="app.MainMenuController"&gt; &lt;children&gt; &lt;AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="150.0" prefWidth="600.0"&gt; &lt;children&gt; &lt;TableView fx:id="bookView" editable="true" layoutX="200.0" layoutY="-40.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="302.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"&gt; &lt;columns&gt; &lt;TableColumn fx:id="first" prefWidth="65.0" text="عدد" /&gt; &lt;TableColumn fx:id="second" prefWidth="175.0" text="الاسم" /&gt; &lt;TableColumn fx:id="third" prefWidth="61.0" text="المؤلف" /&gt; &lt;TableColumn fx:id="forth" prefWidth="75.0" text="الموضوع الرئيسى" /&gt; &lt;TableColumn fx:id="fifth" prefWidth="75.0" text="الموضوع الفرعى" /&gt; &lt;TableColumn fx:id="sixth" prefWidth="75.0" text="رقم التقسيم" /&gt; &lt;TableColumn fx:id="seventh" prefWidth="75.0" text="الرقم الكودى" /&gt; &lt;TableColumn fx:id="eighth" prefWidth="75.0" text="عدد النسخ" /&gt; &lt;TableColumn fx:id="ninth" prefWidth="339.0" text="النسخ المتوفره" /&gt; &lt;/columns&gt; &lt;columnResizePolicy&gt; &lt;TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /&gt; &lt;/columnResizePolicy&gt; &lt;/TableView&gt; &lt;/children&gt; &lt;/AnchorPane&gt; &lt;/children&gt; &lt;/VBox&gt; </code></pre> <p>Book class: "using builder patte"</p> <pre><code>package models; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; /** * Created by Andy on 6/21/2016. */ public class Book { private IntegerProperty number; private StringProperty name; private StringProperty author; private StringProperty mainTopic; private StringProperty secondaryTopic; private StringProperty division; private IntegerProperty codeNumber; private IntegerProperty ID; private IntegerProperty copies; private IntegerProperty availCopies; private ObservableList&lt;History&gt; history = FXCollections.observableArrayList(); public Book(IntegerProperty number, StringProperty name, StringProperty author, StringProperty mainTopic, StringProperty secondaryTopic, StringProperty division, IntegerProperty codeNumber, IntegerProperty ID, IntegerProperty copies, IntegerProperty availCopies, ObservableList&lt;History&gt; history) { this.number = number; this.name = name; this.author = author; this.mainTopic = mainTopic; this.secondaryTopic = secondaryTopic; this.division = division; this.codeNumber = codeNumber; this.ID = ID; this.copies = copies; this.availCopies = availCopies; this.history = history; } public int getNumber() { retu number.get(); } public IntegerProperty numberProperty() { retu number; } public void setNumber(int number) { this.number.set(number); } public String getName() { retu name.get(); } public StringProperty nameProperty() { retu name; } public void setName(String name) { this.name.set(name); } public String getAuthor() { retu author.get(); } public StringProperty authorProperty() { retu author; } public void setAuthor(String author) { this.author.set(author); } public String getMainTopic() { retu mainTopic.get(); } public StringProperty mainTopicProperty() { retu mainTopic; } public void setMainTopic(String mainTopic) { this.mainTopic.set(mainTopic); } public String getSecondaryTopic() { retu secondaryTopic.get(); } public StringProperty secondaryTopicProperty() { retu secondaryTopic; } public void setSecondaryTopic(String secondaryTopic) { this.secondaryTopic.set(secondaryTopic); } public String getDivision() { retu division.get(); } public StringProperty divisionProperty() { retu division; } public void setDivision(String division) { this.division.set(division); } public int getCodeNumber() { retu codeNumber.get(); } public IntegerProperty codeNumberProperty() { retu codeNumber; } public void setCodeNumber(int codeNumber) { this.codeNumber.set(codeNumber); } public int getID() { retu ID.get(); } public IntegerProperty IDProperty() { retu ID; } public void setID(int ID) { this.ID.set(ID); } public int getCopies() { retu copies.get(); } public IntegerProperty copiesProperty() { retu copies; } public void setCopies(int copies) { this.copies.set(copies); } public int getAvailCopies() { retu availCopies.get(); } public IntegerProperty availCopiesProperty() { retu availCopies; } public void setAvailCopies(int availCopies) { this.availCopies.set(availCopies); } public ObservableList&lt;History&gt; getHistory() { retu history; } public void setHistory(ObservableList&lt;History&gt; history) { this.history = history; } public static class BookBuilder{ private IntegerProperty number; private StringProperty name; private StringProperty author; private StringProperty mainTopic; private StringProperty secondaryTopic; private StringProperty division; private IntegerProperty codeNumber; private IntegerProperty ID; private IntegerProperty copies; private IntegerProperty availCopies; private ObservableList&lt;History&gt; history = FXCollections.observableArrayList(); private final Integer DEFAULT_COPIES_NUMBER = 1; public BookBuilder(){ name = new SimpleStringProperty(""); author = new SimpleStringProperty(""); mainTopic = new SimpleStringProperty(""); secondaryTopic = new SimpleStringProperty(""); division = new SimpleStringProperty(); codeNumber = new SimpleIntegerProperty(); ID = new SimpleIntegerProperty(); copies = new SimpleIntegerProperty(DEFAULT_COPIES_NUMBER); availCopies = new SimpleIntegerProperty(DEFAULT_COPIES_NUMBER); number = new SimpleIntegerProperty(DEFAULT_COPIES_NUMBER); } public BookBuilder setNumber(int number) { this.number.set(number); retu this; } public BookBuilder setName(String name) { this.name.set(name); retu this; } public BookBuilder setAuthor(String author) { this.author.set(author); retu this; } public BookBuilder setMainTopic(String mainTopic) { this.mainTopic.set(mainTopic); retu this; } public BookBuilder setSecondaryTopic(String secondaryTopic) { this.secondaryTopic.set(secondaryTopic); retu this; } public BookBuilder setDivision(String division) { this.division.set(division); retu this; } public BookBuilder setCodeNumber(int codeNumber) { this.codeNumber.set(codeNumber); retu this; } public BookBuilder setID(int ID) { this.ID.set(ID); retu this; } public BookBuilder setCopies(int copies) { this.copies.set(copies); retu this; } public BookBuilder setAvailCopies(int availCopies) { this.availCopies.set(availCopies); retu this; } public BookBuilder setHistory(ObservableList&lt;History&gt; history) { this.history = history; retu this; } public Book build(){ retu new Book(number, name, author, mainTopic, secondaryTopic, division, codeNumber, ID, copies, availCopies, history); } } } </code></pre> http://stackoverflow.com/q/38426019 0 Automa Sha http://stackoverflow.com/users/6568393 2016-07-17T21:18:17Z 2016-07-17T21:40:50Z <pre><code>a='abcdcdc' list_=[x*3 for x in a] print list_ </code></pre> <p>This is printing this OK!!!! :</p> <pre><code>['aaa', 'bbb', 'ccc', 'ddd', 'ccc', 'ddd', 'ccc'] </code></pre> <p>But How can i print this ? :</p> <pre><code>['abc','cdc','cdc'] </code></pre> http://stackoverflow.com/q/38426011 1 kjames http://stackoverflow.com/users/6388251 2016-07-17T21:17:37Z 2016-07-17T21:40:22Z <p>I am making a "Choose Your Adventure" game in Python. As you will see in the code below, I have a method temporarily called uamedMethod that has three parameters: a method, m; a string, ans1; and another string, ans2. </p> <p>This method is supposed to handle the user's input derived from m and check to see if it equals one of two words. If it doesn't equal either word, then it should print a simple error message ("Please submit a valid response.") and call the method m again. However, I get the error message "str is not callable" with my current code. </p> <p>Here is my project so far:</p> <pre><code>class player: def __init__(self, n): self.name = n self.inventory = [] self.health = 10.0 def getName(self): retu self.name def printName(self): print("Your name is: " + self.name) def printInventory(self): print(self.inventory) class game: def __init__(self): print("Welcome to Choose Your Adventure.") name = input("Please enter your name to begin: ") p = player(name) def intro(self): print("n.....n") ans = input("You awaken in a field skirted by a dense pine forest.n" + "A rickety ba and its adjoining house lie a few hundredn" + "feet ahead of you. Do you enter the forest or explore then" + "property? Type 'property' or 'forest': ") retu ans def property(self): print("n.....n") print("You walked towards the property") def forest(self): print("n.....n") print("You walked into the forest") ### def uamedMethod(self, m, ans1, ans2): ans = m() #where the error message occurs while ans.lower() != ans1 and ans.lower() != ans2: print("Please submit a valid response.") print("n.....") ans = m() if ans.lower() == ans1: retu ans1 else: retu ans2 class run: def __init__(self): g = game() print(g.uamedMethod(g.intro(), "property", "forest")) r = run() </code></pre> <p>If my code is ruing properly, it will loop through intro() until the user inputs "property" or "forest," and then it will print the corresponding word. I would greatly appreciate it if someone could help me find the issue with my code.</p> http://stackoverflow.com/q/38426007 0 Paul http://stackoverflow.com/users/6598168 2016-07-17T21:16:51Z 2016-07-17T21:38:18Z <p>I have a table (which is large - millions of rows) like this:</p> <pre><code>TABLE mytable ( row_id bigint, col_id bigint, value double precision, timestamp timestamp ); </code></pre> <p>Given:</p> <ol> <li><code>list_row</code> = a list of <code>row_id</code>s (can be ordered if needed)</li> <li><code>list_col</code> = a list of <code>col_id</code>s (again, can be ordered if needed)</li> <li>Both lists may be very large (maybe 10s of thousands)</li> <li>The table above may have many millions of entries</li> </ol> <p>How do I (efficiently) retu a resource where:</p> <ol> <li>Columns are all the <code>col_id</code>s present in <code>list_col</code> and occur in the same order that the <code>col_id</code>s occur in <code>list_col</code></li> <li>Rows are all the <code>row_id</code>s present in <code>list_row</code> (they need not occur in the same order)</li> <li>Each column contains the <code>value</code>s of the given <code>row_id</code> and <code>col_id</code>s.</li> <li>We are only interested in the most recently recorded <code>value</code>s for any <code>row_id:col_id</code> pair i.e. use <code>MAX(timestamp</code>) or something similar as a filter</li> <li>In the result, if there is no recorded <code>value</code> for a given <code>row_id:col_id</code> co-ordinate then that column should be <code>null</code>.</li> </ol> <p>A visual example to clarify:</p> <p>Initial table</p> <pre><code>+--------+--------+-------+-----------+ | row_id | col_id | value | timestamp | +========+========+=======+===========+ | 10 | 20 | 100 | 2016-0... | | 10 | 21 | 200 | 2015-0... | | 11 | 20 | 300 | 2016-1... | | 11 | 22 | 400 | 2016-0... | +--------+--------+-------+-----------+ </code></pre> <p>becomes:</p> <pre><code> col_id → +-----------------+ | 20 | 21 | 22 | +=====+=====+=====+ row_id (10) | 100 | 200 | | ↓ +-----+-----+-----+ (11) | 300 | | 400 | +-----+-----+-----+ </code></pre> <p>I suspect that the correct answer is to start by creating a temporary table with the target <code>col_id</code>s as columns and then do some sort of join. I caot work out how to do this efficiently (is it possible to do this without needing a temporary table for each <code>row_id</code>?)</p> <p>Any pointers given would be much appreciated! </p> http://stackoverflow.com/q/38425585 -1 piyush chopra http://stackoverflow.com/users/6558109 2016-07-17T20:19:43Z 2016-07-17T21:38:55Z <p>While executing this code the following error was obtained: I want to rbind the results to a dataframe from the for loop. The problem is in the object "y.1", the resulting dataframe has 3/4/5 values. I want a dataframe with 5 columns and substitute zeros with values else, keep it as zeros. </p> <p>model_reactants is a list of reactants from the sbml.model which is a rsbml object of class "Model".</p> <pre><code>model_reactants=sapply(reactions(sbml.model), function(x) x@reactants) x.1&lt;- data.frame(matrix(0,ncol = 1, nrow = 4155)) y.1&lt;- data.frame(matrix(0,ncol = 5, nrow = 4155)) for (r in 1:length(model_reactants)){ x=names(model_reactants[r]) y=names(model_reactants[[r]]) x.1[r,]=c(x) y.1[r,]=c(y) } Error in `[&lt;-.data.frame`(`*tmp*`, r, , value = c("M_13dampp_c", "M_h2o_c", : replacement has 3 items, need 5 </code></pre> <p>We have 4155 reactions as entries in the model. We hope to put the reactants into a dataframe as separate columns. Some reactions have from 2, 3, 4, 5, to 6 reactants and they vary in the different reaction entries. But the code we use currently repeats the values from the first and second column in entries where there are only 2 reactants. </p> <pre><code>eg: model: reaction1: a+b-&gt; c+d reaction2: e+f+g-&gt;h+i+j expected output: col 1 col 2 col 3 row 1 a b NA row 2 e f g </code></pre> http://stackoverflow.com/q/38425565 0 Vladyslav Havrylenko http://stackoverflow.com/users/5449642 2016-07-17T20:17:12Z 2016-07-17T21:40:59Z <p><a href="http://www.xe.com/symbols.php" rel="nofollow">http://www.xe.com/symbols.php</a></p> <p>I need to get this symbols in UTF-8 code format, is it possible? Maybe not all - but just valid for UTF-8.</p> <p>I tried convert information in columns: Unicode: Decimal, Unicode: Hex</p> <p>But i don't know ho to do this with php.</p> <p>chr() - for ANSII</p> <p>UPD: I need convert it and for storing in MySQL DB utf-8 like a symbols.</p> <p>Which php function will do this convert '20ac' to '€' symbol?</p> http://stackoverflow.com/q/38425460 0 Kyore http://stackoverflow.com/users/1179274 2016-07-17T20:05:08Z 2016-07-17T21:40:05Z <p>I'm trying to Deserialize this Json code:</p> <pre><code>"hotkeyOptions": { "autoSwitchHotkeyPreset": true, "currentHotkeySetName": "Paladin", "hotkeySets": { "Newbie": { "F10": { "useObject": 5645, "useType": "SelectUseTarget" }, "F11": { "useObject": 5456, "useType": "SelectUseTarget" }, "F12": { "useObject": 7565, "useType": "Use" }, "F8": { "useObject": 7547, "useType": "UseOnYourself" }, "F9": { "useObject": 4214, "useType": "SelectUseTarget" } }, "Mega Mage": { "Ctrl+F1": { "chatText": "heal friend", "sendAutomatically": true }, "Ctrl+F4": { "chatText": "mega haste", "sendAutomatically": true }, "F1": { "chatText": "haste", "sendAutomatically": true }, "F10": { "useObject": 3412, "useType": "SelectUseTarget" }, "F11": { "useObject": 5343, "useType": "SelectUseTarget" }, }, "Paladin": { "F1": { "useObject": 4643, "useType": "UseOnYourself" }, "F2": { "useObject": 6433, "useType": "UseOnYourself" }, "F3": { "chatText": "haste", "sendAutomatically": true }, "F5": { "chatText": "heal", "sendAutomatically": true } }, "Mage": { "F1": { "chatText": "explosion", "sendAutomatically": true }, "F12": { "useObject": 3003, "useType": "SelectUseTarget" } }, "Knight": { "Ctrl+F1": { "chatText": "poke go", "sendAutomatically": true }, "F1": { "chatText": "haste", "sendAutomatically": true }, } } } </code></pre> <p>I'm having problems trying to read their properties and values, but I can't get the Name property like the "Newbie", "Mega Mage", "Paladin", etc.</p> <p>This is what I got for now:</p> <pre><code>JToken token = JObject.Parse(json); JToken hotkeyConfig = token.SelectToken("hotkeyOptions"); JToken activeHotkey = hotkeyConfig.SelectToken("currentHotkeySetName"); this.ActiveHotkeySet = activeHotkey.Value&lt;string&gt;(); //This is working, retuing the "Paladin" string JToken hotkeysSet = hotkeyConfig.SelectToken("hotkeySets"); foreach (var set in hotkeysSet.Children()) { foreach (JObject obj in set.Children&lt;JObject&gt;()) { foreach(JProperty prop in obj.Properties()) { var teste = prop.Name; } } } </code></pre> <p>With the code above I'm reaching the keyboard shortcut like "F10", "Ctrl+F1", but can't get the "Parent Name" (Newbie).</p> <p>There is a easy way to read this kind of JSON structure?</p> http://stackoverflow.com/q/38424168 0 Asaf Cohen http://stackoverflow.com/users/5841524 2016-07-17T17:45:43Z 2016-07-17T21:38:20Z <p>I am trying to import an XML into an MS Access DB using ASP (3.0).</p> <p>I'm using IIS 7.5 (OS 64bit) and MS Access 2013. I have no problem using the Access DB, the only problem is using the "Access.Application" object.</p> <p>When ruing the following lines I got an error:</p> <pre><code>dim objAccess Set objAccess = CreateObject("Access.Application") </code></pre> <p><strong>Permission denied (Error 70)</strong></p> <p>Using dcomcnfg.exe I have added permissions for the Access.Application object in COM to user <strong>IUSR</strong>.</p> <p>But since then, the page does not load. By the way, I don't have an <strong>IIS_IUSRS</strong> user type. </p> <p>Please tell me how to add permissions so I could import an XML via ASP into an MS Access DB.</p> <p>Thanks</p> http://stackoverflow.com/q/38423970 1 Dario Mazhara http://stackoverflow.com/users/5315336 2016-07-17T17:25:11Z 2016-07-17T21:39:26Z <p>I'm new to RoR and I am having some trouble understanding some of the code. I tried looking it up but the results haven't helped me.</p> <p>Here is the code located in the user controller. (If you need any other code, comment it and I'll update </p> <pre><code>class UsersController &lt; ApplicationController def new @user = User.new end def create @user = User.new(user_params) #I didn't see any parameters in the constructor if @user.save #Checks if @user was saved? session[:user_id] = @user.id #Creates a session? What's :user_id and @user_id? redirect_to'/' #Redirects to http://localhost:8000/ else redirect_to '/signup' #If all fails go back to signup page end end private def user_params params.require(:user).permit(:first_name, :last_name, :email, :password) end end </code></pre> <p>This is part of a programming course which failed to explain this to me properly. I'm generally aware that this is for a signup form, but I am having trouble comprehending the create and user_params function processes.</p> <p>When I'm asking for help I am asking you to lead me through the process of what is happening. I also need specific help with <code>params.require(:user).permit(:first_name, :last_name, :email, :password)</code></p> http://stackoverflow.com/q/38423612 1 Tyler http://stackoverflow.com/users/3911459 2016-07-17T16:49:19Z 2016-07-17T21:38:02Z <p>I have a Jenkins build configured to pull from a Gitlab repo.</p> <p>I have specified in the build config, branch specifier to only pull from one specific branch:</p> <pre><code>Branch Specifier (blank for 'any'): origin/development </code></pre> <p>Yet regardless of which branch a commit is pushed to, the build still triggers and pulls the committed branch and builds it.</p> <p>Am I misunderstanding exactly what the branch specifier is supposed to do? I want to only build when a certain branch is committed to.</p> <p>I've also tried the following branch specifiers with the same results:</p> <pre><code>development */development refs/head/development </code></pre> http://stackoverflow.com/q/38423023 0 bmargulies http://stackoverflow.com/users/131433 2016-07-17T15:46:15Z 2016-07-17T21:40:56Z <p>Here's a bit of code from the Apache CXF documentation:</p> <pre><code>CustomMessageBodyReaderWriter provider1 = new CustomMessageBodyReaderWriter(); provider.setCustomProperty(true); Dictionary properties = new Hashtable(); properties.put("org.apache.cxf.rs.provider", provider); bundleContext.registerService( new String[]{"org.books.BookService"}, new BookServiceImpl(), properties); </code></pre> <p>Note that this piece of an activator method registers an OSGi service where one of the property values is an object created and configured at runtime.</p> <p>Now, what if I wanted this to be a CXF dOSGi component? The only way I know to specify service registration properties for DS @Components requires the property value to be a string in the 'properties' slot in the <code>@Component</code>. Is there some way to have executable code involved?</p> http://stackoverflow.com/q/38420042 0 Deborah http://stackoverflow.com/users/1224692 2016-07-17T10:01:15Z 2016-07-17T21:40:09Z <p>I'm new to Mongo and Meteor.</p> <p>I have a collection "posts" with a field "slug".</p> <p>The "post" template is populating correctly with each post's values. Slug value is always something like "my-great-post".</p> <p>In the template's HTML, I want to do...</p> <pre><code>&lt;script type="text/javascript"&gt; var mySlug = how do I get the slug's text value??? console.log(mySlug); &lt;/script&gt; </code></pre> <p>Template helpers seem only to deliver spacebars values like {{slug}}, which I can not use in a script in the HTML. </p> <p>I tried this but it retus "undefined"...</p> <pre><code>&lt;div class="slug-container&gt;{{./slug}}&lt;/div&gt; &lt;script type="text/javascript"&gt; var mySlug = document.getElementsByClassName('slug-container').ierHTML; console.log(mySlug); &lt;/script&gt; </code></pre> <p>... and this retus a huge HTML object!</p> <pre><code>&lt;script type="text/javascript"&gt; var mySlug = document.getElementsByClassName('slug-container'); console.log(mySlug); &lt;/script&gt; </code></pre> <p>How can I get the value retued?</p> <p><strong>EDIT:</strong></p> <p>My purpose for "slug" is that I need to get the text value for the _id's slug, which will be different each time the template is accessed, encode it, write a string, and spit the string back out into the template. </p> <p>I run into the following problems with onRendered...</p> <ul> <li>"this.slug" and "this.data.slug" retu "undefined" in console.log</li> <li>if I manage to get it defined, it is only defined the first time the template is accessed, so the value persists when the template is accessed subsequent times with a new _id</li> </ul> <p>And template helpers do not seem to work for this case...</p> <ul> <li>"this.slug" and "this.data.slug" retu undefined here, too</li> <li>app crashes when I try to javascript encode and deliver a string from the helper</li> </ul> <p>In the template itself, {{slug}} does correctly render. But I can not use {{slug}} in a script. I need to get the dynamic value each time the template is accessed and use that.</p> <p>I've tried to make this work for hours and hours. I've gone way off into hacky land to try to solve this. To need to run a script on a dynamic value delivered from Mongo on every template access seems like a common use case (for example, to get value for "price" and automatically calculate, then show tax as a string) but I just can't make it work.</p> <p>If some one can solve this using any method, I will accept answer.</p> http://stackoverflow.com/q/38415851 0 Kamil Kiełczewski http://stackoverflow.com/users/860099 2016-07-16T21:34:36Z 2016-07-17T21:38:37Z <p>I want to have JWT authentication in Laravel >=5.2, using <a href="https://github.com/tymondesigns/jwt-auth" rel="nofollow">this (Tymon JWT-auth) library</a> but I want to put JWT token into HttpOnly Cookies - to protect JWT token from steal from XSS attack (ofcourse there is still need for protecting API from CSRF attack which will not be consider here). </p> <ol> <li>I set up Tymon library and... in project: app/Providers/RouteServiceProvider@mapWebRoutes i deactivate execution 'web' middelware group for all requests (which is default laravel behavior - you can see it by <code>php artisan route:list</code>) by remove <code>'middleware' =&gt; 'web'</code> (If I don't do it, i will see CSRF problem with post request).</li> <li>in routes.php i write:</li> </ol> <blockquote> <pre><code>Route::group(['middleware' =&gt;'api', 'prefix' =&gt; '/api/v1', 'namespace' =&gt; 'ApiV1'], function () { Route::post('/login', 'AuthAuthController@postLogin'); ... Route::get('/projects', 'ProjectsController@getProjects'); } </code></pre> </blockquote> <ol start="3"> <li><p>In may ApiV1AuthAuthController@postLogin i generate token and send it back as httpOnly cookie:</p> <pre><code>... try { $user = User::where('email','=',$credentials['email'])-&gt;first(); if ( !($user &amp;&amp; Hash::check($credentials['password'], $user-&gt;password) )) { retu response()-&gt;json(['error' =&gt; 'invalid_credentials'], 401); } $customClaims = ['sub' =&gt; $user-&gt;id, 'role'=&gt; $user-&gt;role ]; $payload = JWTFactory::make($customClaims); $token = JWTAuth::encode($payload); } catch(...) {...} retu response()-&gt;json($payload-&gt;toArray())-&gt;withCookie('token', $token, config('jwt.ttl'), "/", null, false, true); </code></pre></li> <li><p>And, yeah here question starts. I would like to do something (may be modifiy laravel <code>Auth</code> class) on each request:</p> <ul> <li>get coookie from request</li> <li>decode it</li> <li>check is right (if not trhow 401)</li> <li>get user from DB</li> <li>and make that method Auth::user() works every where like in usual way in laravel (so i can use it in each Controller for example)</li> </ul></li> </ol> <p>Any ideas how to do point 4 ?</p> http://stackoverflow.com/q/38402058 0 indjev99 http://stackoverflow.com/users/4796883 2016-07-15T17:31:43Z 2016-07-17T21:40:04Z <p>I am using the CImg library for the first time and I get compilation errors with a simple test program that just includes CImg.h. Why is that? How can I fix this?</p> <p>Program code:</p> <pre><code>#include "../headers/CImg.h" using namespace cimg_library; int main() { retu 0; } </code></pre> <p>Compilation errors:</p> <pre><code>In function 'FILE* cimg_library::cimg::fopen(const char*, const char*)': 5065|error: '_fileno' was not declared in this scope In function 'int cimg_library::cimg::fseek(FILE*, INT_PTR, int)': 5093|error: '_fseeki64' was not declared in this scope In function 'INT_PTR cimg_library::cimg::ftell(FILE*)': 5102|error: '_ftelli64' was not declared in this scope </code></pre> <p>This was done on a PC with a 64 bit Windows 8.1.</p> <p>Command:</p> <pre><code>g++.exe -Wall -fexceptions -g -std=c++11 -c "D:informaticsProjectsimage experimentsRectangle to circle stretchersourcesmain.cpp" -o objDebugsourcesmain.o </code></pre> <p>I tried this without the <code>-std=c++11</code> part and I get 2 errors instead of 3. I don't get <code>5065|error: '_fileno' was not declared in this scope</code>. Same happens if I replace it with <code>-std=gnu++11</code></p> <p>I also tried it on my laptop, which runs a 64 bit version of windows 7, and the same happens there.</p> <p>So far, I have a work around for the first error, but nothing for the other two.</p> http://stackoverflow.com/q/38385253 0 daniegarcia254 http://stackoverflow.com/users/3593914 2016-07-14T22:31:06Z 2016-07-17T21:39:34Z <p>This is my controller code. Show a popup and on button click, make some validations:</p> <pre><code>UZCampusWebMapApp.controller('PlanCtrl',function($scope, $ionicModal, $ionicLoading, $ionicPopup) { $scope.confirmCreatePOI = function(data) { var myPopup = $ionicPopup.show({ templateUrl: 'templates/pois/confirmCreatePOI.html', title: 'Confirmar creación de POI', scope: $scope, buttons: [ { text: '&lt;b&gt;Save&lt;/b&gt;', onTap: function() { var invalidEmail = $scope.email.length==0 || $scope.email==null || typeof($scope.email)=='undefined'; if ($scope.emailChecked==true &amp;&amp; invalidEmail) { $ionicLoading.show({ template: 'Email is mandatory'}); } else { data.email = $scope.email; $scope.finalSubmitCreatePOI(data); } } }, { text: 'Cancel' } ] }); }; }); </code></pre> <p>This is the directive code where the previous controller function <code>confirmCreatePOI</code> is called:</p> <pre><code> UZCampusWebMapApp.directive('formEditPointOfInterest', function($ionicLoading) { retu { restrict : 'A', scope: true, controller : function($scope) { $scope.submit = function(data) { console.log("Submit form edit point of interest",data); if($scope.editPOIform.$valid) { $scope.confirmEditPOI($scope.data); } else { $ionicLoading.show({ template: 'El formulario es inválido', duration: 1500}) } } $scope.delete = function(data) { console.log("Submit form delete point of interest",data); $scope.confirmDeletePOI($scope.data); } } } }); </code></pre> <p>And this is my templateUrl code:</p> <pre><code>&lt;div id="confirm-create-poi-popup"&gt; &lt;p&gt; Text &lt;/p&gt; &lt;p&gt; Text &lt;/p&gt; &lt;div class="list"&gt; &lt;ion-checkbox ng-model="emailChecked"&gt;Receive notification&lt;/ion-checkbox&gt; &lt;label class="item item-input"&gt; &lt;input type="email" ng-model="email"&gt; &lt;/label&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>So, after user have clicked on <em>'Save'</em> button ( <em>onTap</em> event), I would like to check if email has been entered on input field.</p> <p>But when I check it with the comprobation:</p> <pre><code>var invalidEmail = $scope.email.length==0 || $scope.email==null || typeof($scope.email)=='undefined'; </code></pre> <p>The <code>$scope.email.length==0</code> expression retus an error because email is undefined, so <code>ng-model</code> property isn't working with the <code>$scope</code>, I'm not getting any value on <code>$scope.email</code></p> <p>Why is that? Is the <code>$ionicPopup $scope</code> property not working? Wrongly used?</p> http://stackoverflow.com/q/38341996 1 Michael Bremerkamp http://stackoverflow.com/users/5414530 2016-07-13T03:04:03Z 2016-07-17T21:40:27Z <div class="question-status question-originals-of-duplicate"> <p>This question already has an answer here:</p> <ul> <li> <a href="/questions/1028248/how-to-combine-class-and-id-in-css-selector" dir="ltr">How to combine class and ID in CSS selector?</a> <span class="question-originals-answer-count"> 8 answers </span> </li> </ul> </div> <p>I am trying to style two Bootstrap panels slightly differently. I decided to do this by naming them with different id's and then styling them via CSS. For some reason the CSS id selector is not working for me.</p> <p>Here is the HTML:</p> <pre><code> &lt;div class="col-md-3"&gt; &lt;div id="price" class="panel panel-default"&gt; &lt;div class="panel-heading"&gt; &lt;h3 class="panel-title"&gt;Price&lt;/h3&gt; &lt;/div&gt; &lt;div class="panel-body"&gt;{{ item[0][3] }}&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-md-3"&gt; &lt;div id="size" class="panel panel-default"&gt; &lt;div class="panel-heading"&gt; &lt;h3 class="panel-title"&gt;Size&lt;/h3&gt; &lt;/div&gt; &lt;div class="panel-body"&gt;{{ item[0][2] }}&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>And the CSS:</p> <pre class="lang-css prettyprint-override"><code>#price .panel-default { width: 150px; font-size: 18px; } #size .panel-default { width: 100px; font-size: 188px; } </code></pre> <p>All the CSS / HTML I know is self taught so I may be missing something fundamental here. Any help is appreciated, thanks.</p> http://stackoverflow.com/q/38311859 0 khrist safalhai http://stackoverflow.com/users/702609 2016-07-11T16:29:35Z 2016-07-17T21:38:38Z <p>I have a elasticsearch docker image listening on 127.0.0.1:9200, I tested it using sense and kibana, It works fine, I am able to index and query documents. Now when I try to write to it from a spark App </p> <pre><code>val sparkConf = new SparkConf().setAppName("ES").setMaster("local") sparkConf.set("es.index.auto.create", "true") sparkConf.set("es.nodes", "127.0.0.1") sparkConf.set("es.port", "9200") sparkConf.set("es.resource", "spark/docs") val sc = new SparkContext(sparkConf) val sqlContext = new SQLContext(sc) val numbers = Map("one" -&gt; 1, "two" -&gt; 2, "three" -&gt; 3) val airports = Map("arrival" -&gt; "Otopeni", "SFO" -&gt; "San Fran") val rdd = sc.parallelize(Seq(numbers, airports)) rdd.saveToEs("spark/docs") </code></pre> <p>It fails to coect, and keeps on retrying</p> <p><code>16/07/11 17:20:07 INFO HttpMethodDirector: I/O exception (java.net.CoectException) caught when processing request: Operation timed out 16/07/11 17:20:07 INFO HttpMethodDirector: Retrying request</code></p> <p>I tried using IPAddress given by docker inspect for the elasticsearch image, that also does not work. However when I use a native installation of elasticsearch, the Spark App runs fine. Any ideas?</p> http://stackoverflow.com/q/4177159 234 AnApprentice http://stackoverflow.com/users/149080 2010-11-14T10:51:51Z 2016-07-17T21:39:40Z <p>I have the following:</p> <pre><code>$(document).ready(function() { $("#select-all-teammembers").click(function() { $("input[name=recipients\[\]]").attr('checked', true); }); }); </code></pre> <p>I'd like the <code>id="select-all-teammembers"</code> when clicked to toggle between checked and unchecked. Ideas? that aren't dozens of lines of code?</p>

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 28 تير 1395 ساعت: 4:55

صفحه بندی