FAQ Database Discussion Community


My app freeze when I try to refresh my window (detail inside)

python,python-3.x,tkinter
I have a problem with my program in Tkinter. I have added this code to my program: def display(): A1 = random.randint(1,7) A2 = random.randint(1,6) while True: Pion_Rouge_N(A1, A2) Pion_Jaune_N(A1, A2) time.sleep(5) And when I run this code, my program freeze... I need to kill python3 with the killall command....

How to build a Horizontal ListView with RecyclerView?

android,android-layout
I need to implement a horizontal listview in my Android application. I did a bit of research and came across How can I make a horizontal ListView in Android? and Horizontal ListView in Android? however, these questions were asked before Recyclerview was released. Is there a better way to implement...

Elements disapear when height is relative

html,css,css3,height,width
I have 3 a with width:100%. I don't want to set a height so that the images keep their ratio. For some unknown reason the a elements desappear if height is not specified or set to auto. Any idea why this happens? HTML: <div class="cuerpo"> <div class="articulosysidebar"> <!--articulos--> <div class="articulos"></div>...

What does `@(x) myfun(x, F_index)` means in Matlab? [duplicate]

matlab,function,handle
This question already has an answer here: @(t) mean in Matlab? [duplicate] 2 answers What does @(x) myfun(x, F_index) means in MATLAB? What does it call and return? For example in this application: fmincon(@(x) myfun(x, F_index), ...) Please provide more examples and explain them if possible....

Apply VBA code to Excel file from SSIS

sql-server,excel,vba,excel-vba,ssis
Good evening everyone. I have to build a SSIS package that does as follows: 1) Execute a VBA code to a XLS file (Transpose a range into another range) 2) Save the XLS (In the same file or as a new file) 3) Import the modified XLS from the Transposed...

Missing string using Python xml.sax to parse XML file

python,xml,parsing,sax
I am trying to parse a XML file with Python 2.7 Here is the XML file I am using: <NS:Member> <NS:Area fid='120410'> <NS:Code>10021</NS:Code> <NS:version>4</NS:version> <NS:versionDate>2004-03-29</NS:versionDate> <NS:theme>Buildings</NS:theme> <NS:Value>42.826432</NS:Value> <NS:changeHistory> <NS:changeDate>2002-09-26</NS:changeDate> <NS:reasonForChange>New</NS:reasonForChange> </NS:changeHistory>...

How to read next line in csv file on button click

c++-cli
I have a windows form with two butttons and a text box. My start button reads the first line in the csv file and outputs the data I want into a textbox: private: System::Void StartBtn_Click(System::Object^ sender, System::EventArgs^ e) { String^ fileName = "same_para_diff_uprn1.csv"; StreamReader^ din = File::OpenText(fileName); String^ delimStr =...

Simultaneously reading stdin and writing to stdout in python

python,subprocess
I am new to threading so I feel as if I am missing an obvious point, but I couldn't find an previous question that pertained to this subject. I want to make a program that writes to stdin and reads stdout of a c program. This is the code in...

Creating a “Event” in MySQL throu JAVA.JDBC

java,mysql,jdbc
Hello i'm having trouble creating a MySQL "Event" through JAVA.JDBC. Here's the code: public void skapaAuktionsEvent(String produktnamn, String slutdatum) throws SQLException{ String sql = "CREATE EVENT "+ produktnamn +" ON SCHEDULE AT '"+ slutdatum +"' DO UPDATE Auktion SET AvslutadAuktion = 1 WHERE produktnamn = "+ produktnamn; System.out.println("Skapar event"); PreparedStatement...

gcc 4.7.2 compile error on a lambda capturing this

c++,c++11,gcc,gcc4.7
I have kind of a weird issue and while trying to create a small example to post here on stackoverflow, I failed to reproduce. Hopefully, this will still ring a bell to somebody, or somebody has a good idea to dig further... On my Mac, the below code compiles fine...

Which terminology in Android / XML is right: Element or Object?

android,xml
What's the right terminology to use for ImageView in Android / XML. Some sites call it an "Element"; others call it an "Object". Which is right? ...

Advanced Lookup required

excel,if-statement,sum,max,vlookup
I'm in need of some advanced lookup formula with MAX, MIN, IF and SUM. Info: Sheet1 (data): Column one(A): name Column two (B): Type Column three (D1:AO): Data/numbers Row 1: A1=Name, B1= Type, D1:AO1=name of the different data Sheet2 (output): B5: Primary Critera, Selecting from a dropdownlist of Sheet1.Row(D1:AO1) B7:...

Span class not changing anything

html,css
I am trying to change everything in the span class "Intro" to have these settings: span.Intro{ display: inline-block; margin-left:0px; font-family: 'Lucida Sans Unicode'; line-height: 0px; height: 25px; color: grey; list-style:square; font-size: 150%; padding-left: 0px;} An example of what line I'm trying to do this on: <span class ="Intro" <ul><li><b>History</b></li></ul></span> this...

Facebook apps can't save changes with blank iPhone Store ID field

ios,facebook,facebook-ios-sdk,facebook-app-settings
While trying to save the Settings page in the app developer menu in Facebook, I'm getting an error of not submitting an iPhone Store ID however it was empty already before. The error claims "We didn't recognize the iPad Store ID you entered. " but of course, cause it still...

Painting QPolygonF on a scene manually causes rendering issues when updating

c++,qt
I have a quite simple code for painting arrows between graph vertices, inspired by the Qt diagrams sample app, but I have a problem with render artifacts. When I paint a triangle polygon onto the scene using the following code QPolygonF arrowHead; ... some setup painter->drawPolygon(arrowHead); and then I move...

Objective-C method conflicts with optional requirement method Swift

ios,swift,xcode6-beta7
After the Xcode update, the compiler began to throw an error on the working code (both functions are in the AppDelegate.swift). func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { FBLoginView.self FBProfilePictureView.self return true } With error: /Users/../AppDelegate.swift:14:11: Objective-C method 'application:didFinishLaunchingWithOptions:' provided by method 'application(:didFinishLaunchingWithOptions:)' conflicts with optional requirement method...

Is a newline character invalid in XML?

xml
Based on what I found in the XML specification, following 3 characters are the only ones that are illegal: & < > We are working with a vendor on a tool which does not seem to be able to process a newline character. e.g. <Comments> This is line 1 This...

Retrieve selection of servicestack redis session objects based on values of properties

redis,servicestack,stackexchange.redis,servicestack.redis,servicestack-auth
I want to update multiple servicestack user sessions that are stored in redis. I want to return all sessions that have a custom property set to a certain value, then I can process them. At the moment the best solution I have returns all keys as such: List<string> sessionkeys =...

php fetch file content and print it out formatted

php,html,printing
How can i print out an formatted HTML file ? This is my current code: echo htmlspecialchars(file_get_contents($url)); But the result looks so ugly, all sticks together, no space no tabs. Is there any way to print the file exactly like the original file ?...

git trying to clone a submodule's ref that doesn't exist

git,git-submodules
I'm trying to clone a project with submodules, and I get a message like this one: fatal: reference is not a tree: da3d99e1e6c554231cba76066a7b3149592e597e Unable to checkout 'da3d99e1e6c554231cba76066a7b3149592e597e' in submodule path 'module_path' Now, I'm not a first timer with git modules, and first I checked if the co-worker who pushed the...

Set an iPhone 6 launch image on Visual Studio Tools for Apache Cordova

ios,iphone,cordova,visual-studio-cordova
We are using CTP 3 of VS extension for Cordova. We are trying to add a splash screen for iPhone 6 and iPhone 6+. We need this to solve and issue where iPhone 6+ resolution is incorrect within the app. Is there a naming convention for the splash screen files...

DQL query produces error Expected Literal, got 'BY'

doctrine2,zend-framework2,dql
I am having a problem with a DQL query to retrieve users and roles from a MySql database. I am using Zend Framework 2 and Doctrine 2. The query is as follows. public function getUsers() { $builder = $this->getEntityManager()->createQueryBuilder(); $builder->select('u, r') ->from('Application\Entity\Users', 'u') ->leftJoin('Application\Entity\UserRoles', 'r') ->orderBy("u.emailAddress", "ASC"); InfoLogger::vardump($builder->getDQL()); return $builder->getQuery()->getResult(Query::HYDRATE_OBJECT);...

Jquery clone form values and replace form field id

javascript,jquery,regex,clone
I am trying to clone a row to keep the values in my text box and comments field and doing a regex expression to do a partial replace of the id from crs1 to crs2. However, I am not able to get this to work. <div id="wrapper"> <div id="info-crs1">Course Information...

Angular FB Share with no Backend

angularjs,facebook
Restriction: I only have access to upload html/css/js to the server through our client. Im trying to share to facebook without a backend in angularjs. So I need the meta tags. But I need to share different content based on what page you are on and I have no control...

How to prevent “auto update with silent check” to start launcher on error?

install4j
We want to create an update application using the template for "Update with silent version check" to check the version before the launcher will be executed. So far everythings seems to work fine but when I get an error the update application will abort the process and rollback everything. After...

Settingup AWS S3 and Codeigniter

php,codeigniter,amazon-web-services,amazon-s3
I need to use Amazon S3 with CI3, so my plan is making a library called AmazonS3 where i will have basic methods like up() delete() tokenize() just for example. I have installed S3 using composer inside the application/s3 directory. **Code of my Library: ** <?php defined('BASEPATH') OR exit('u no...

Migrate MVC 5 to MVC 6

asp.net-5,asp.net-mvc-6
I just wanted to know if there is any auto migration tool available to update from MVC5 to MVC6. As they made some changed, like instead of Global.asax, there is a startup class. I am using URL Rewriting and using Global.asax Application methods to achieve it. Any help ?...

Anchor (hash) event handler in JavaScript

javascript,jquery
This might be a double post but I haven't found any suitable solved problem that looks like mine. I have a webpage that shows a list of entries and a link "Add an Entry" that redirects to page.html#addEntry. When I click "Add an Entry" a little form should show up...

Python Encoding error with some unicode characers

python,unicode,encoding
I am having some problems with encoding some unicode characters. This is the code I am using: test = raw_input("Test: ") print test.encode("utf-8") When I use now normal ASCII characters it works, same with some "strange" unicode characters like ☃. But when I use characters like ß ä ö ü...

How to check if text overflows a rectangle in Tkinter?

python-3.x,tkinter,drawing
I drawn a rectangle in Tkinter. Then I wrote text inside the rectangle. But when I unzoom in my canvas, the text is getting bigger and it overflows the rectangle. So I want to check if the text overflows the rectangle in order to resize this text or totally remove...

AngularJS radio buttons not checked on load

javascript,angularjs
I have an angularJS controller that creates a scope with a list of items and has a property for the selected item. During initialization I create the list and set the selectedItem property to the second item in the list. app.controller('MainCtrl', function($scope) { $scope.items = [ {id: 1, name: "Item...

Append “,” to end of the desired string in notepad ++

regex,notepad++
I have quite a large list of words in a txt file and I'm trying to do a regex find and replace in Notepad++. I need to append comma(,) at the end of "local" string. So that: english: "About" local: " " english: "Accessibility" local: " " become english: "About"...

nodejs on Vagrant - can't load the page from outside

node.js,networking,vagrant
Trying to load http://localhost:3000 in browser doesn't work from my windows machine, but when I do this curl -v http://localhost:3000 on my vagrant VM - page loads fine. I was thinking about port forwarding issue, so I set config.vm.network :forwarded_port, guest: 3000, host: 3000 in vagrant config file, but it...

Google Charts legend is not correctly displayed

javascript,html,css,graph,google-visualization
I am creating google chart and my legend is not being folded into pages. My code is somthing like <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script> google.load("visualization", "1.1", { packages: ["bar", "table"] }); var chart; var table; var graphOptions = { title: 'Liczba ekspozycji w miesiącu', pointSize: 5, vAxis: { viewWindowMode: "explicit", viewWindow:...

php - permutation - possible number

php,permutation
already look around but cant find what i want for PHP. just say i have a number : 1234 ( can be splitted first into array ) and i want to get how many number combination possible for 2 digits, 3 digits , and 4 digits for example : possible...

How do I clear the canvas in my custom android view?

android,canvas
Newbie to Android, struggling with updating canvas in custom view. This may have a very simple answer, but so far I have not found it! I draw a path of about 2000 points the first time through onDraw. That is fine. Then the path changes, and I need to draw...

In Pandas, creating a Panel of MultiIndex'ed DataFrames

python,pandas
I am creating a Panel out of two DataFrames as such: import pandas as pd d1 = pd.DataFrame(index=pd.MultiIndex.from_product(iterables=[['a','b'],[1,'2','3'],[4]]), data=list(range(6))) print('d1 before panel:') print(d1) d2 = pd.DataFrame(index=pd.MultiIndex.from_product(iterables=[['a'],['1','2'],[1, '2']]), data=list(range(4))) print('\nd2 before panel:') print(d2) print('=================') p = pd.Panel({'d1': d1, 'd2': d2}) print('\npanel d1:') print(p['d1']) print('\npanel d2:') print(p['d2']) Note that I mixed index...

i need to create an event listener. but i dont want to use any framework

javascript
i need to create an event listener. but i dont want to use any framework Jquery: $(".element").on('click', function(){}); How to make it without jquery???...

How do I match a single equals sign with regular expressions?

c#,regex,match
I have the following expression: if(x == a+b) b=a+2; else x = 1; I need to match a single equal sign =. Not ==, not ==== and so on. And it should match without spaces around the sign, just equals sign. I have quite a monster-like reg. expression which matches...

Android broadcast between class and activity

android,broadcast
my receiver is not working. The probllem is between a class and activity. im traying to send message from the class to the activity but is not working... The class is going to comunicate with two activies, one at a time... My Broadcast code (inside the activity): public class MainActivity...

Value after Base64 encoding/decoding are not the same

android,encryption,base64
I need to encode/decode my data before storing in database but i have strange problem, After decoding, the value are not the same as first for example look at this code why seedBytes1 and seedBytes2 are not the same? (I tried encodedSeedBytes.getBytes("US-ASCII") instead of encodedSeedBytes but no success) seedBytes =...

Best practice for parsing and displaying wysiwyg code [closed]

php
I have a wysiwg on my website that allows users to use <br/>, <p>, <a>, <img>,<span>, <b>, <i> What is the best way to only allow these these types of tags to display on the page, would a strip tags be sufficient, or regex? I'm trying to disallow things like...

SQL Server IDENTITY_INSERT is on but an INSERT query complains it is not on

sql,sql-server,insert
I am writing a migration using MigratorDotNet for an application, and after running several thousand of similar insertions, SQL server complains: [migrate] SET IDENTITY_INSERT TimeOfDay ON [migrate] INSERT INTO TimeOfDay (id) VALUES ('312491') [migrate] [Warning] Cannot insert explicit value for identity column in table 'TimeOfDay' when IDENTITY_INSERT is set to...

Developing C++/CLI project for Windows 8 Tablet on Windows 7

visual-studio-2010,windows-7,c++-cli,windows-8.1
I have a code base of native C++. Recently I incorporated a Windows 8 tablet into the system that we deploy to. I have a .NET managed DLL that accesses the Tablet orientation sensor. This managed code is wrapped by an unmanaged class that I can access from the native...

Update Nested query in mongoose

node.js,mongodb,mongoose
I am struggling from last 2 hours to update my nested collection. Can someone please try to guide me in right direction? var ChoiceSchema = new Schema ({ body: {type: String, required: true}, correct: {type: Boolean, required: true}, timesDisplayed: {type: Number, default: 0}, timesSelected: {type: Number, default: 0}, images: {}...

Was flavor display changed in Android Studio 1.1? Or this is a bug in 1.1?

android-studio,android-productflavors
I updated Android Studio to 1.1 Beta4 and the Project tree view changed. The app is using flavors and before I was able to choose a specific flavor via Build Variants and Android Studio would load files belonging to that flavor. Files belonging to other flavors would be hidden. Right...

button in webapp on iOS needs to be 'pressed' instead of 'touched'

jquery,ios,onclick,event-handling,touchstart
I have some simple buttons in a webapp that open some map layers when clicked. They work as expected on all modern desktop browsers an on Androids, but on iOS the buttons need to be really pressed down, instead of just touched.... The click/touch events have the syntax: $(".btns").on("touchstart click",...

Executing PL/SQL functions from a file

oracle,plsql,sqlplus
I am using SQL*Plus and have a file called functions.sql, which contains 3 PL/SQL functions: create or replace function getcustnamebyid (id number) return varchar2(30) is ... begin ... end; / create or replace function getspcommbyid (id number) return float is ... begin ... / create or replace function iscommok (comm...

Rails class comparison - If Class.children include AnotherClass.children do

ruby-on-rails,ruby,arrays,has-many-through,comparison-operators
Simple question I hope. I've a couple of classes - User and Recipe - both of which have 'ingredients' as children via has-many-through relationships. I'd like to run a comparison that checks to see if User.ingredients include the ingredients for each Recipe. I thought a simple 'include?' query would work...

Adding a New Controller Brings a new Devise Authentication Error in Rails

ruby-on-rails,ruby,devise
I am working on a Rails app that I have co-coded with another Jr. developer. I want to add a static home page and a static help page to the application. Following Hartl's instructions (https://www.railstutorial.org/book/static_pages#cha-static_pages) I added a static pages controller to the application for home and help pages. When...

What action triggers onItemSelected in a ListView?

java,android,listview,android-adapter
I have a ListView of Medications that use a CursorAdapter. My goal is to obtain a reference to the Cursor of the selected item when the user presses the submit button, but I keep getting a null value. Here is my current code: mSubmitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View...

In C++, I'm getting a message “error: 'void*' is not a pointer-to-object type”

c++,compiler-errors,codeblocks,memory-address,void-pointers
Here's my code: #include <iostream> using namespace std; int main() { void *x; int arr[10]; x = arr; *x = 23; //This is where I get the error } As you can see, the code is very simple. It just creates a void pointer x which points to the memory...

How to share a database connection with a joblet in Talend

talend
I have a job with a tMSSqlConnection setup, and I need to share that connection with a joblet. I found instructions online saying to register it as a shared connection, and then add an option in dynamic settings of the joblet components with that connection name, so it can be...

Stdin and Stdout

python
Can someone explain stdin and stdout? I don't understand what is the difference between using these two objects for user input and output as opposed to print and raw_input. Perhaps there is some vital information I am missing. Can anyone explain?

Curb v 0.8.5 won't install on Ubuntu 14.04

ruby,gem,rubygems,ubuntu-14.04
I'm trying to install curb v 0.8.5 gem but without any success. Below is a stack trace: /usr/local/bin/ruby -r ./siteconf20150211-19572-1mel9g2.rb extconf.rb checking for curl-config... yes checking for curlinfo_appconnect_time... yes checking for curlinfo_redirect_time... yes checking for curlinfo_response_code... yes checking for curlinfo_filetime... yes checking for curlinfo_redirect_count... yes checking for curlinfo_os_errno... yes checking...

Deserialize multiple XML elements with the same name in C#

c#,xml,deserialization
Im trying to parse this XML response: <?xml version="1.0" encoding="utf-16"?> <CurrentWeather> <Location>BOSTON LOGAN INTERNATIONAL, MA, United States (KBOS) 42-22N 071-01W 54M</Location> <Time>Feb 11, 2015 - 11:54 AM EST / 2015.02.11 1654 UTC</Time> <Wind> from the N (010 degrees) at 17 MPH (15 KT) gusting to 26 MPH (23 KT):0</Wind> <Visibility>...

Is it bad practice to overload a function to take both a pointer or a reference?

c++,pointers,reference,overloading
For example, if I had a struct FooSpec: struct FooSpec { /* lots of data */ }; Is it bad practice to provide both of the following as overloaded functions? Or should I just choose one and stick with it? Foo *createFoo(const FooSpec *spec) { /* ... */ } Foo...

Is it possible to control multiple VideoWidgets with one MediaPlayer?

qt,qt5,qmediaplayer
I wonder if it is possible to play a video using the Qt5 QtMultimedia library in 3 widgets simultaneously. I have a video that I would like to show in 3 widgets: one showing the full video, another focusing on some object moving in the video, and a last one...

How to play a youtube video with a tag in Flash Builder

actionscript-3,youtube-api,flash-builder
I am using Google code: https://code.google.com/p/gdata-samples/source/browse/trunk/ytplayer/actionscript3/com/google/youtube/examples/AS3Player.as to play a YouTube video. I want to add the tag ?rel=0 to the end of a url to prevent YouTube adds appearing at the end of the video. However, when I concatenate the tag, the following event handler no longer works: playerLoader.content.addEventListener("onReady", onPlayerReady);...

extract data between P tag with style php

php,mysql
A while ago i have written a small php script to get the information from MySQL and put it in XML.Now one the description of the item in the MySQL was up untill now something like <p> the item description ...etc.</p> so far so good, i used the following :...

Laravel hasManyThrough issue with same named field of tables

laravel,laravel-4,orm,eloquent,has-many-through
These are the models I have : class User extends Eloquent { public function categories() { return $this->hasMany('Category'); } public function forms() { return $this->hasManyThrough('App\Models\Form', 'Category'); } } class Category extends \Eloquent { public function user() { return $this->belongsTo('User'); } public function forms() { return $this->hasMany('App\Models\Form'); } } namespace App\Models;...

Splitting a string that is not uniform with commas

regex,string
I have a strange problem that I am not sure how to solve. My goal is to be able to split a string that has certain ingredients that are separated by commas into an array so that each element in the array is an ingredient. However, some of the strings...

How to use $pristine property on AngularJS form correctly

angularjs,forms
When my form loads initially the $pristine property is always false. It was my understanding that as long as there's no user interaction with the form that the $pristine property will be true until the user changes the model via some kind of interaction. Is there anything else that I...

Bash calculate x months back from todays date

bash,date
I am working with this date format 20130702 and would like to calculate 15 months back. I am currently using date -v 10m With my current date format how can I create an if statement that checks if date is no later than 10 months Thanks all!!...

Simple slideout nav

nav
I'm not a big coder but I have my test html page built. What is the most simple way to code/add an html left slide navigation for mobile? I have seen so many solutions but having trouble getting it to work.

localstorage update property in array

javascript,jquery,local-storage
I am trying to update a property in localstorage. I don't want to loop through and reset the whole thing. Is this possible? var aR = [ { "id": 1, "width": 500 }, { "id": 2, "width": 400 } ] localStorage.setItem('test', JSON.stringify(aR)); // need to update property localStorage['test'][1]['width'] = '720';...

Ignore items in a formatconditions collection that are not formatcondition?

excel,vba,excel-vba
The following code works for most sheets in my workbook: Function IsHighlighted() As Boolean Dim wks As Worksheet For Each wks In ThisWorkbook.Worksheets Dim rUsedRange As Range Set rUsedRange = wks.UsedRange With rUsedRange Dim bHighlighted As Boolean Dim fc As Object For Each fc In .FormatConditions If fc.Interior.Color = RGB(255,...

Replacing If Statements?

java,if-statement,switch-statement
I am trying to make my code more efficient and replace a bunch of if statements that I wrote. My program so far basically checks what operator (such as +, -, etc) is entered and then computes it. For example 1 + 5 gives 6. When the program evaluates the...

Is there a way in Sitecore to display a link to a media library item that the user does not have access to?

security,sitecore,sitecore7.5
I want to use Sitecore security to make access to certain documents on a site require registration/login. However the client would like to show links to these documents to anonymous users as a way to let them know that if they register/login then they will get access to these protected...

Implementing an iterator copy constructor

c++
How can I properly implement a copy constructor for my iterator, knowing that the pointer to the data object is private? Do I need to create an accessor for this pointer? Isn't this a bad thing?

how does tabIndex work when starting at a large number

html,forms
Let's say I have a complex page with a header, and many buttons. Then lower on the page, I have a section where the order in the DOM doesn't match the actual order in which they should be focusses. I know I can add the tabIndex attribute to make them...

node - Nothing happens when running a script

node.js
I installed Node on Linux Mint doing sudo apt-get install node npm, but it doesn't seem to work at all. I created this small script to check if anything was happening: console.log('this is a test'); throw new Error(); When I execute it from the terminal, there is absolutely no ouput:...

Datatables serverside info + static colum with 2 buttons

javascript,jquery,datatables,jquery-datatables
I'm struggeling to make a static column with 2 buttons that trigger 2 links with dynamic data. I managed to make 1 button work but i can't make the other. I tried adding an id to each one and call different functions for each one but it seems it's only...

ArrayList does not save my Values

java
following: I create a ArrayList with an Own Object which keeps two int(x,y) But I only get 0 instead of the number. I don't see why it does not work. public class Snake { public class SnakeBody { public int x; public int y; SnakeBody(int x, int y){ x =...

Unknown errors with java sorting gui [closed]

java,arrays,swing,algorithm,random
I'm not long programming and have a problem with unknown errors. I've built a gui for testing sorting algorithms but keep getting errors and I can't see where the problem is import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import...

Dictionary from associations found in list of lists (performance issue)

python,dictionary
Object: to produce a dict showing which unique values in base[2:] (captured in the list uniques) are associated with base[1] values (i.e. 5001, 5002 etc.). The code below works but is too slow for the amount of data I need to process so I'm looking for a faster way to...

Bitwise XOR in VB.NET

vb.net,bit-manipulation,xor
I'm trying to get an application to XOR two hexadecimal values and output the result as a decimal value. I have searched the Internet for an answer, but every result simply gives a true or false result. The figures I am using as an example are Value 1 = 0F8F...

Most efficient data structure to use for distributions

data-structures
Use case: An element has a value between 0 and Infinity A user can make a query like -- "Give me the lowest value that is inside the top 30% of the elements" We can store 1000 of the top elements, and at any point more elements can be added....

Wordpress - post_meta vs taxonomy vs custom table

php,mysql,wordpress,post,custom-taxonomy
I'm building a car services database. Each car service is able to repair multiple models of cars. What is the best way to store the relation between car services and types, to be able to later query that? My options are: for each car save the models as post_meta as...

Is it possible to report back the route name used when calling a Web API?

asp.net-web-api
Is it possible to report back the route name used when calling a Web API? I want to do some diagnostics in a "foo" project to see what route is called based on how/what I call. Is there a way for the action/api to see what route is used to...

vba Word: Why can Word use special chars in bookmark creation, and I cant?

vba,ms-word,bookmarks
Here's a head-splitter: I'm trying to programmatically create hidden bookmarks for existing headings in a doc, so that I can create hyperlinks elsewhere in the doc that point to these bookmarks. (I want to use hyperlinks instead of cross-references so I can specify my own 'Display Text' for the links,...

How is the thread model implemented in Karaf?

multithreading,osgi,apache-karaf,osgi-bundle,karaf
i am trying to understand the karaf thread model. from what i can understand in OSGI in case the bundle starts threads it is also responsible for closing them. is this the case in karaf as well? are there any other solutions for managing threads in karaf?

making assertions in Geb JUnit4 tests

grails,geb
I'm using Geb to do some functional testing of a Grails app. I'm using Geb's integration with JUnit4, i.e. my test classes extend geb.junit4.GebReportingTest. Should I make assertions using Java's keyword, e.g. assert 2 == 1 + 1 or JUnit's assert* methods, e.g. Assert.assertTrue 2 == 1 + 1 ...

IP packet and MAC Destination Address [closed]

tcp,ip,data-link-layer
I've a simple question about IP and MAC. Lets say we have two LANs, A and B, connected by a Bridge (no Network Layer). We have host 'X', which sends an IP packet to host 'Y'. It will send it through a MAC frame. The Payload of that MAC Frame...

HTML does not update after being modified with JavaScript in .hta application

javascript,html,browser,hta
I have a .hta File containing JavaScript and HTML. My JavaScript Code modifies the HTML with functions like "appendChild", but the HTML does not get updated afterwards; Even if the element was corretly appended in the DOM-Structure (I can alert the .innerHTML, returning the html-code like it should be, but...

Do not add an existing item in the cellForRowAtIndexPath

ios,uiscrollview,tableview,custom-cell
In my TableViewController I use custom cell, this cell has a scrollView. My cellForRowAtIndexPath method looks like: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:@"cell"]; if (!cell) { cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"]; // iOS 7 separator if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { cell.separatorInset = UIEdgeInsetsZero;...

End sprite kit collision immediately after first contact

iphone,swift,ios8,sprite-kit
Hi I am trying to refine my logic for collision between two nodes in my game. I want to update the score and hide the node when the player comes in contact with the coins. It works properly but the score is updated many times throughout contact with the hidden...

Why is the alert not displayed in a new window

javascript,html
I am creating a new window with some variable as follow: var setScript = "<script>alert('test');<//script>"; var w = window.open(); var createBody = $(w.document.body); var createHead = $(w.document.head); createBody.html(""); createBody.html(p); createHead.html(setStyle); createHead.append(setScript); I am not seeing the alert in the new window. How can I resolve the issue. F12: ...

Overriding 'text' in UILabel

variables,swift,properties,uilabel,override
Is there a way to do this? I thought it would be as simple as override var text: String? in a subclass of UILabel. However, this does not work. It shows an error: Cannot override with a stored property 'text' Am I doing something wrong? Is there a way or...

ParseQuery get exception all the time

android,parse.com
I'm trying to retrieve rows from a table that has the cols: objectId InvitedId PartyId coming createdAt updatedAt ACL ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("PartiesInvites"); ArrayList<ParseObject> partiesId = new ArrayList<>(); for (int i = 0; i < mParties.size(); i++) { partiesId.add(mParties.get(i).getObjectId()); Log.d("UU-UPIL", "partyId = " + partiesId.get(i)); } query.whereContainsAll("PartyId", partiesId); query.findInBackground(new...

Visual Studio Express 2013 Web Site Administration Tool (WSAT)

asp.net,command-line,visual-studio-2013,configuration-management
I am trying to access the Web Site Administration Tool (WSAT) so I can manage the users and roles established by an earlier version of VS. Apparently Microsoft took it away. I have Googled a solution, but I am not successful. In the command prompt I entered... iisexpress.exe /path:C:\Windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles /vpath:/WebAdmin...

Pull working PHP file (with scripts) into div using JavaScript without iframes

javascript,jquery,html,loading
Working within system constraints, I needed a way to put working code from a local .php or .html into a target div without additional libraries, jfiddle, iframes, etc. (jquery was fine) Here are my failed attempts. First part of file <a href="#" id="fruit"> This is some page!</a> <script>$("#fruit").click(function(){Expand01("fruit.php"); return false;});</script>...

Codeigniter join query failing

php,mysql,sql,codeigniter
I am trying to execute this query in codeigniter 2.2. I read the documentation http://www.codeigniter.com/user_guide/database/results.html. My controller code is this $query = $this->db->query("SELECT a.id, a.child, a.immune, a.immun_date, b.id, b.fname, b.lname, c.id, c.name FROM immun a, children b, immun_master c WHERE a.child = b.id AND c.id = a.immune "); $immun =...

'Type Mismatch' Error with .Find() method in VBA

excel-vba,find,runtime-error
I'm writing a sub in Excel VBA, and it keeps giving me a 'Type Mismatch' error message when trying to assign the result of a .Find() to a Range variable. I feel pretty confident that my types are appropriate, so perhaps there's a syntax error somewhere? Help would be GREATLY...

ggplot2: coloured vertical lines

r,plot,ggplot2
I'd like to create a ggplot graph with vertical lines of different colors. Here one way to achieve this goal. mtcars$colors = rep(1:4, nrow(mtcars)/4) ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() + geom_vline(xintercept=subset(mtcars, colors==1)$wt, color="red") + geom_vline(xintercept=subset(mtcars, colors==2)$wt, color="blue") + geom_vline(xintercept=subset(mtcars, colors==3)$wt, color="yellow") + geom_vline(xintercept=subset(mtcars, colors==4)$wt, color="green") This solution is not very...

UIButton subclass not responding to super methods?

ios,iphone,uibutton,uicontrol,uicontrolevents
I would like to create a UIButton that toggles its image. Once clicked the image should change to another one and stay that way until clicked again. I have added both images to the default and selected states of the button on interface builder. Now, I have created a UIButton...

“invalid initialization of non-const reference of type…” Error in clone() function

c++,templates,clone
Good day I am busy to implement linear data structure in c++. I am struggeling with my clone() function. The one line code seems in order for me, but maybe the error is in the copy constructor. The error I am getting: linkedList.C:22:32: error: invalid initialization of non-const reference of...

JBox2D + Slick2D - Doesn't collide

java,slick2d,jbox2d
UPDATE I have a hint. That is because the center of the screen in JBox2D is (0, 0). This is so weird because x and y are not from -1 to 1, it depends of the screen size. This means the Util class I copied from the internet (everybody...

Changes made by an IndexWriter are not reflected by an IndexReader

lucene,lucene.net
I have an IndexReader in read only mode, an IndexSearcher based on this reader and an IndexWriter working on the same Lucene index. I want to delete a document from the index. Afterwards I don't want the document to show up in results returned by the IndexSearcher (that's what deletion...

dtype: integer, but loc returns float

python,pandas
I have a weird data set: year firms age survival 0 1977 564918 0 NaN 2 1978 503991 0 NaN 3 1978 413130 1 0.731310 5 1979 497805 0 NaN 6 1979 390352 1 0.774522 where I have cast the dtype of the first three columns to be integer: >>>...