FAQ Database Discussion Community


Laravel Flash Data in View with Joins

laravel
I feel bad for asking this question and may receive down votes. But my mind is fried... I am trying to access flash data in my view. The flash data is an array from a query that has joined data. Usually I can just access in the view like $Flashdata->columnname;...

Can't convert 'bytes' object to str implictly HTML Parser Python3 Error

python,python-3.x,html-parsing,python-3.4,html-parser
I am trying to create an HTML Parser in Python 3.4.2 on a Macbook Air(OS X): plaintext.py: from html.parser import HTMLParser import urllib.request, formatter, sys website = urllib.request.urlopen("http://www.profmcmillan.com") data = website.read() website.close() format = formatter.AbstractFormatter(formatter.DumbWriter(sys.stdout)) ptext = HTMLParser(format) ptext.feed(data) ptext.close() But I get the following error: Traceback (most recent call...

Uncaught TypeError: Cannot read property 'style' of null(index):110 onclick

javascript,html
I've got a problem with my alert box. I want to design a cross for closing the box by clicking on it: <div id="alert"> <img src="cross.png" onclick="document.getElementById(alert).style.display = 'none'" width="15px" height="15px" style="float: right; margin-top: 3px; cursor:pointer;"/> <p style="margin-top: 20px;">alert text</p> </div> When I click at the cross an error appears....

Play mongo Enumerator stops unexpectedly

scala,akka,reactive-programming,reactivemongo
Setup Scala 2.11.4, Playframework 2.3.7, Reacivemongo (0.10.5.0.akka23/0.11.0-SNAPSHOT tried with both). We have a collection with 18'000 entities, processing this collection in asynchronous manner, using Enumerator/Iteratee approach. Case 1. Processing is simple (extraction of entities to CSV format and sending them in chunks as a REST response) everything works fine, all...

facebook android user getUsername

android,facebook,session,user
i'm trying to get ,in my app, the username of user that is connected to facebook working on the active session in that moment. In many post I read that the method getUsername() is deprecated. Really? This is my piece of code: if(session!=null && session.isOpened()){ Log.i("LandingActivity", "session not null..."); Request.newMeRequest(session,...

Controlling a CSS Animation with Buttons

html,css,animation,scroll
I need to have scrolling images controlled by two arrows (scroll up and scroll down). I have a CSS "scrollUp" animation written as well as a "scrollDown" animation. How can I have these animations occur to the images when the arrows are clicked? I think I need to have a...

Turn off marginal distribution axes on jointplot using seaborn package

python,matplotlib,seaborn
I like this particular plot and the ability to pass a function to the stat_func keyword to quickly plot up and visualize relationships between variables, but there's one thing. How do I 'turn off' or not plot the marginal distribution axes? It looks nice but sometime I don't want this...

How do I take last n elements from nested collection

asp.net-mvc,linq,entity-framework
I am buinding a chat for an application, so when a user logs in I need to send them all 'unseen' messages, I am using entityframework, Id like to return only the last 20 unseen messages. but my query is not working, currently I get this exception Count must be...

Yii2:Saving listbox multi-select field to db

php,listbox,yii2
I am created a listbox and related functions like in my model Appointment.php Validation Rule & related function in Appointment.php public function rules() { return [ ['weekdays', 'validateWeekDays'], ]; } public static function getWeekdaysList() { return [ 'monday' => 'Monday', 'tuesday' => 'Tuesday', 'wednesday' => 'Wednesday', 'thursday' => 'Thursday', 'friday'...

Can I use other tables in database with single model cakephp?

php,cakephp
Is there any way in cakephp where I can use (insert delete update) tables data without creating controller files and view folder. I have table user with controller usercontroller.php. Can I use one model to use (insert delete update in) other table's data instead of making individual files of controller...

calling a function does not work

c
My program is using stacks to input and output points. My problem is when I want to output the points in the main function. Like this it works fine: push(readPoint()); printStackElement(pop()); But if I want to call the functions step by step I don`t get the points. Why is pop()...

Behavior or Java array

java,arrays
I was writing a random piece of code and it is bothering me as to why the output is 100000000 in this case: public class HelloWorld { public static void main(String[] args) { try { int[] array = {1}; System.out.print(array[100000000]); } catch (Exception e) { System.out.print(e.getMessage()); } } } Why...

JavaFX maximize the size of node children

layout,javafx
I want to have squares added to a pane, and those squares maximized. One square takes up the whole pane. Two squares split the pane. Three squares make it all in thirds. When it overflows it goes to the next "row" and continues the process. All the squares should be...

Cannot connect to Compute Engine CentOS Virtual Machine

virtual-machine,google-compute-engine,centos6
I am new to Virtual Machines and CLI so please bear with me. I have a CentOS 6.5 running on Compute Engine. I ran yum update (without creating a snapshot of the previous disk - Yes I am an idiot) and not I cannot connect to the machine using the...

Encoding a unicode string to utf-8 and getting question marks

python,unicode,utf-8
System: Python 2.7.5 , IPython 2.3.1 , OSX terminal (local), sys.stdout.encoding : 'UTF-8' (venv) toz$ locale LANG="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_ALL= – I am expecting both commands print the same but the latter prints question marks for ord(c)>128. Why is that? How can I encode this unicode...

How to properly update a managed entity using data from a non-managed entity?

php,symfony2,doctrine2,entity
Context My goal is to perform an update on a managed entity using data from an object of the same class, but non-managed by Doctrine. This would be cool if it was possible to perform a "simple update", when replacing attributes, but in fact, if I clean an ArrayCollection, old...

ModelSIM ALTERA error

vhdl
I have the following code, to test in Altera ModelSim one memory ROM. LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.numeric_std_unsigned.all; ENTITY hex_vhdl_vhd_vec_tst IS END hex_vhdl_vhd_vec_tst; ARCHITECTURE hex_vhdl_arch OF hex_vhdl_vhd_vec_tst IS -- constants -- signals SIGNAL t_sig_address : STD_LOGIC_VECTOR(10 DOWNTO 0); SIGNAL t_sig_clock : STD_LOGIC; SIGNAL t_sig_q : STD_LOGIC_VECTOR(7 DOWNTO 0); COMPONENT...

Saving ref to a User login

node.js,mongoose
I'm having a trouble to write a simple User and Tweet Schemas relation. I created a middleware that will check a user token once he logged in. This is a token based authentication. The problem lies in the '/tweet' route section of how to save a tweet to a Logged...

Selenium+firefox: empty execute_script arguments

javascript,python,firefox,selenium,selenium-webdriver
I'm trying to set textarea value using javascript instead send_keys() method. As documentation says, I should be able to pass webelement to execute_script as parameter and refer to this parameter via arguments array. However, I've checked in firefox js console, that arguments is Object and it doesn't matter what i...

Access and manipulate files and directories on an external USB storage in a rooted Android device

java,android,rooted-device
It's clear to me now that it's very hard (currently) to copy, move, etc. files in an external usb device in Android, as there are no high level classes to do this. I'm considering doing my app only work on rooted devices. I've read that it's possible (and much easier)...

Dock an element to the bottom of a div as well to the bottom of the screen

javascript,jquery,html,css,twitter-bootstrap
To be honest, I don't really know how to explain my problem. I'm trying to dock an element to the bottom of a div (which works great), but it should also dock to the bottom of the screen if the bottom of the div is below the bottom of the...

How to correctly return the path to an image from the ternary operator (and display it)

ruby-on-rails,ternary-operator
I am new to rails. I am trying to implement the following method in my User model def avatar_to_load self.picture ? self.picture.url : image_path("logo.png") end Which if the User has a picture, then it will display the picture, if not, it will display the "logo.png", the path of which is...

How to set name of the column using union

mysql,sql
I making a SQL statement using union all as the following image: But the name of the column is the first name used in SQL query. How make this SQL statement without this my error? Thanks a lot!...

Safari Webkit animation (Rotation) not working

css3,animation,safari,webkit
Good afternoon. Im playing around with webkit animations and somehow I can't get it to work in Safari. The animation worked in IE and Firefox but somehow not in Safari (8.0.2). Can somebody spot any mistakes ? I would be really happy if someone can help me out. Many greetings...

Stalled HTTP request (chrome) using own web server

c#,sockets,google-chrome,internet-explorer
I'm writing an embedded HTTP server for educational purposes in C# (getting more into the rfc and learning something about winsock). For now I can serve static web pages. The server itself seems to be reasonable fast with one great exception. Chrome loads my test page very slowly in comparison...

FBO + texture: strange results from offscreen generation of geometry data

c++,gpgpu,fbo,off-screen
I have 2+ pass rendering where the first stage generates the positions of the vertices of a rectangular mesh and stores them in a 2D float texture. The shaders look this way: vertex: #version 330 core out vec2 vfTexCoords; const float halfSide = 1.0f; const vec2[] pos = vec2[ 4...

With the trueskill algorithm, given two players' ratings, how can I calculate the win/loss probability?

python,algorithm
I see this question come up a lot in discussions of trueskill, but I've yet to come across a conclusive answer. I'm using the Python implementation here: https://github.com/sublee/trueskill I've put together a simple simulation using that library here: https://gist.github.com/klenwell/3a15eca6b83ce575d0ca The question is submitted as the first issue for the Python...

HSSFSheet POI API Java doesn't fill all columns with color

java,excel,api,apache-poi
I am using POI to export some data to .xslx, but some columns are not filled with color, I use a loop, so it should work, it does for most of the columns. So what's wrong? for (int i = 0; i < columnNamesFase1.length; i++) { HSSFCell cellA1 = row1.createCell((short)...

SCNLight cast shadow in all direction

ios,scenekit
Suppose we have a room where the lamp is right in the middle of the room, both vertically and horizontally. How can it cast shadows in all directions? Is there anyway to fake it? I have objects that move. SCNLightTypeSpot can cast shadows in a cone, but that doesn't work...

Pointer-events fail when used on parent element :hover in IE11

html,css,css3
Here is a snippet of a little navigation structure. If you hover the blue box, a menu will appear revealing new navigation options. This works in all major browsers except IE11. In IE11 the menu will close once you try to hover it. The problem is this following CSS: .menu.pointer-events...

Get value of property in editor template of kendo grid

asp.net-mvc,kendo-ui,kendo-grid
I have kendo grid with ajax binding @(Html.Kendo().Grid<LightViewModelExtended>() .Name("LightsGrid") .Columns(col => { col.Bound(x => x.LightID) .ClientTemplate(Html.ActionLink("#: LightID #", "Edit", new { id = "#: LightID #" }).ToHtmlString()); col.Bound(x => x.Name); col.Command(command => command.Edit()); col.Command(command => command.Destroy()); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("LightExtended")) .DataSource(dataSource =>...

angularJS interceptor: access parent controller method

javascript,angularjs
In my app i have different manipulations with http request's, for example: $scope.getArticle = function(id) { $http.get('/app/' + id, { headers: { 'Content-Type': 'application/json', } }) .success(function(response) { }) .error(function(data, status, headers, config) { }); }; $scope.displayAlert = function (message) { var modalHtml = '<div class="modal-header"><h3>Warning</h3></div>'; modalHtml += '<div class="modal-body"><strong>'...

Can someone explain to me why python 3.4 is parsing a string to an int without me explicitly asking for it

python
I am so confused it's beyond belief, it's probably a noobie mistake, but I am thoroughly befuddled by this behavior. Here's the small algorithm (as I think it should be): a, b, n = input().split() x = 0 def prod(num): x=1 for y in range(len(num)): if int(num[y])>0: x*=int(num[y]) x+=int(num) return...

Can an Rx Observable gracefully handle exceptions in an operator and continue?

system.reactive,reactive-programming,rx-java
i.e., by passing the error condition and not halting the entire Observable? My Observable starts with a user-supplied list of package tracking numbers from common delivery services (FedEx, UPS, DHL, etc), looks up the expected delivery date online, then returns those dates in terms of number of days from today...

Manage different codebases using single git repository instead of submodules

git,github,chef,git-submodules
After reading this article on submodules, it seems like they exist only to link to external git repositories from within your own. However, I am expecting submodules to simply allow you to manage multiple, separate commit histories from within one repository. Is it possible to have non-external git repositories? I'd...

How to do functional-component relationship in c#

c#,oop,design-patterns
How is the proper way to declare a class that needs another class to be functional? For example, public class Car { IEngine Engine { get; set; } } interface IEngine { void go(); } public class DieselEngine { void go() {} } The Car class defines the majority of...

Configuring Android Studio to use NDK (android-ndk-r10d, Windows 64-bit)

android,android-studio,android-ndk
I have an application I'm trying to compile, which uses *.c files. To compile this I must use NDK. Downloaded the 64bit version and browsed the net to find tips on configuring gradle. It seems the config is ok, and gradle attempts to run the NDK build process. It does...

Tomcat Server Installation

apache,environment-variables
I was installing Tomcat server on my system (Windows XP). It was required to set three environment variables namely path,JAVA_HOME and CLASSPATH. But for Windows 8 , another environment variable CATALINA_HOME was required to be set. Why this difference ?...

Google Scripts for Sheets - onEdit and “source”

google-apps-script,google-spreadsheet
I've been struggling for a few days now trying to get a script to work. At its most basic level my function contains this: function onEdit(e) { var changedRange = e.source.getActiveRange() } It seems this is a perfectly legitimate use according to Google's docs: https://developers.google.com/apps-script/guides/triggers/events This code however produces this...

Scrapy, Parse items data from page then follow link to get additional items data

python,callback,web-scraping,scrapy
I have a problem to scrape additional fields which are on other pages after scraped data from first page e.g: Here is my code: from scrapy.selector import HtmlXPathSelector from scrapy.http import HtmlResponse from IMDB_Frompage.items import ImdbFrompageItem from scrapy.http import Request from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor URL...

Recursively select (with limited depth) relationships in SQLAlchemy using ORM, declarative style, and Association objects

python,postgresql,recursion,sqlalchemy,flask-sqlalchemy
Given: DIRECTIONS = db.Enum('N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', name='directions') class Exit(BaseModel): __tablename__ = 'exits' src = db.Column(db.Integer, db.ForeignKey('room.id'), primary_key=True) dst = db.Column(db.Integer, db.ForeignKey('room.id'), primary_key=True) direction = db.Column(DIRECTIONS, primary_key=True) from_room = db.relationship('Room', foreign_keys=[dst], backref=db.backref('exits', lazy='dynamic')) to_room = db.relationship('Room', foreign_keys=[src])) Using: SqlAlchemy 0.9.8, PostgreSQL 9.3.5 How do I query...

Reactjs : Invariant Violation when using input element

javascript,reactjs
I am a bit new to React and was trying out a simple experiment. I wanted to have a text-box and a search-button in my initial render, and then when I click on the search-button, I wanted a completely different markup (close-button + div/h1) So I store the value in...

Implementing MultiDex results in compiling for so long, and finally heap space error

android,multidex
I have a big Android project where I got the Unable to execute dex: method ID not in [0, 0xffff]: 65536 error; I believe some of you guys have definitely gone through this issue before. This is an error due to too many methods referenced in the app. I have...

Why do I get a reference error when assigning to a variable without the var keyword?

javascript
This came up at work today. Take the following assignment, commonly used to initialize a variable. // bill is undeclared var bill = bill || []; The value assigned to bill is []. Why does this fail with a reference error when you omit the var keyword? // bill is...

What is an array linked structure or node array?

java,arrays,data-structures,arraylist,linked-list
I am a couple of java data data structure exercises. Here is the exercise I am currently doing Add an array-linked hierarchy to the overall structure. Use the following names: AbstractNodeArrayMyList, NodeArraySorted, and NodeArrayUnsorted I've already implemented abstract array list, sorted array list, unsorted array list, abstract linked list, sorted...

Can someone please tell me what is wrong with the for loop

java
So I'm supposed to make a deck of cards and I'm doing it in this way. No CT error but I get IndexOutOfBound Exception. I dont know why. The class Card is already defined. The value goes up to 12 and the suit goes up to 3, inclusive. Thank you!...

How To add a gridview to Datagridview cell

c#,datagridview,datagridviewcolumn
I want to have a grid view like this image I find out that I should have a gridview in datagridview cell so I tried to find how to do that.I finally find that there is not any DataGridViewcolumn type like DataGridViewTextBoxColumn and etc,So I think I must create a...

typecasting with StringTokenizer [duplicate]

java,stringtokenizer,typecasting-operator
This question already has an answer here: Converting String to int in Java? 17 answers I need to convert the output of nextToken() to type int and double. The way i'm doing it currently does not work and gives me the error saying java.lang.String cannot be converted to int....

Remember me functionality in IBM Worklight [closed]

worklight,jsonstore
We are using Worklight 6.1 for our app. I want the app to remember the user id (with no limitation on the duration & it should be accurate & reliable).I want to use JSONStore API for this purpose. In our app, after we gather the user credentials, we are sending...

How do I generate a `x,y` co-ordinates that is always 90 degrees either left or to the right of the current position of a UIImage?

objective-c,math,angle
How do I generate a x,y co-ordinates that is always 90 degrees either left or to the right of the current position of a UIImage? I have a location which is a random x, y in generateRandomLocation. I require to generate a new x,y which is 90 degrees to the...

rename an internal class with Obfuscar

obfuscar
I need Obfuscar to obfuscate (rename) internal classes such as Secret1 in the following. This is a minimal WPF application with ancillary public and internal classes for exercising Obfuscar. namespace WpfApp { public enum Category { Low, High } public partial class MainWindow : Window { private ViewModel ViewModel; public...

How can I push down the footer of my page so that it always wraps to the left?

html,css
I made a page that has a menu on the left, some content on the rest of the page and a footer on the bottom. Everything works perfectly if I have a big wall of text as content, because that will push the footer down and it will make the...

Extracting a variable from a function call in Python

python,string,python-3.x
I am trying to extract strings in Python received by a function. Consider the following; I have a script that runs in Python. The script runs continuosly. It binds to a USB port and listens for incoming ZigBee data frames. I have a function that dissassembles this dataframe; # Decoded...

Rails and queries - Custom query to get duplicated records

mysql,sql,ruby-on-rails,ruby,postgresql
For the most part I try not to write custom SQL queries with my apps but I came acros a case and I was wondering if this would be one those cases where I would be better off doing it. I'm using PostgreSQL with this specific app. I want to...

Big Gaps Between HTML Elements in Grid

html,css,grid,spacing
I'm trying to create a 3 column grid for one of the pages on my website. Some of the elements span 2 columns while others only span 1 column. This has created a spacing issue for me as I'd like the elements to kind of "float" up to the closest...

Send a value with action:@selector

ios,objective-c
my code : UIButton *boutonSuppr = [UIButton buttonWithType:UIButtonTypeRoundedRect]; boutonSuppr.frame = rectBoutonSuppr; [boutonSuppr setBackgroundImage: [UIImage imageNamed:@"croixTest.png"] forState:UIControlStateNormal]; [monScrollView addSubview: boutonSuppr]; int numb = 10; [boutonSuppr addTarget:self action:@selector(boutonSupprAppuye) forControlEvents:UIControlEventTouchUpInside]; My method declared : - (void)boutonSupprAppuye:(int) numero; My problem is that I need to send a parameter in the method because I have...

Linker fails to find 32-bit libraries under 64-bit Mint OS when compiling with Clang

c++,linux,gcc,clang,mint
I just installed Clang 3.5 on 64-bit Mint OS (version 17). I'm trying to compile my program in 32-bit, however I'm running into problems. I have a file called test.cpp in my home directory with the following code: #include <iostream> int main() { std::cout << "Hello" << std::endl; } I...

Bind a java swing gui and c++ backend for a standalone application, which form two different projects

java,c++,swing,jni
I want to bind a JAVA Swing GUI with C++ back end for a standalone application. These two form two different projects. I've read about Java Native Interface. Though JNI appears to be the best solution for this, I have few questions regarding JNI: Can JNI help me bind different...

FFMPEG reads fps of input h264 file wrong, resulting in wrong duration of output file

python,osx,video,ffmpeg,h.264
I am trying to convert an .h264 file created with python from an incoming stream to xvid format with ffmpeg. The file is 30min long and 12fps. However, the converted file automatically creates a file that is 25fps and thus 14.4min long. If I set fps like ffmpeg -i test.h264...

How to convert org.bson.types.ObjectId to String during marshalling?

mongodb,scala,casbah,spray-json
Looks like I have to write a serializer/deserializer to fix this, but not exactly sure how. I see several examples using liftweb framework, but not without it. Any help on how to get this working? Registration Model package model import spray.json._ import spray.json.DefaultJsonProtocol._ import spray.httpx.SprayJsonSupport import com.mongodb.casbah.Imports._ import org.bson.types.ObjectId import...

Office 365 send email with attachment using OutlookServicesClient

c#,api,office365
I'm trying to send out some e-mails on behalf of users of my LOB application. I'm using the Office 365 connected service API so that I can authenticate using OAuth. My code will send the e-mail, but no attachments show up. Here is an isolated example of my code: static...

Setting primefaces calendar end date after setting start date

jsf-2,primefaces,calendar,mindate
I'm using primefaces calendar for the creation of an event. With the "mindate" parameter i have disabled the days before the current day. I want to do this even with the end date, disabling the days before the start date. I don't know how to handle this, since the backing...

Desiging restful API for user resource

php,angularjs,api,rest
I am designing a restful API by using Laravel & AngularJS. I know the basic of restful API, but having trouble to figure out what will be the best way to design it for user resource. Let's guess, user can have his profile & can update profile. So, the URL...

Seems I need to repeat date_default_timezone_set() each time I need to work with dates withing the same script

php,time,timezone
So, there is either something I don't understand, or sometime broken somewhere. To my understanding, when I set date_default_timezone_set, it's supposed to work for the entire current script. But working with one this morning, nothing seemed to work, up until I started to call date_default_timezone_set before each call to, for...

Is there any easy way to .zip up my source code with Visual Studio 2013?

git,visual-studio-2013,zip,pkzip
When playing around creating new Visual Studio projects to try out various technologies, or a weekend project, I want an easy way to zip up my source and not worry about .pdb, obj/bin files, etc. So many years ago, I came up with a set of .bat files, one of...

Substituting string labels by integer IDs and back

vowpalwabbit
My data files contain lines with the first entity being a string label followed by features. For example: MEMO |f write down this note CALL |f call jim's cell The problem is that Vowpal Wabbit accepts only integer labels. How can I quickly change from string labels to unique integer...

Display HTML options based on separately selected options with Angular

javascript,angularjs,angularjs-ng-repeat
I have some data that consists of various brands, and each brand has a nested array (of strings) containing range names: [ { "brandName" : "Brand 1", "ranges" : [ "Range A1", "Range A2", "Range A3" ] }, { "brand" : "Brand 2", "ranges" : [ "Range B1", "Range B2",...

loading program with irb when using rspec

ruby,rspec,irb
I am creating a simple program of blackjack with ruby. I am doing this to work on my TDD skills therefore i am using Rspec for test coverage. In order to keep the work cleaner the structure of my files is a main folder called blackjack. Within this are lib...

How to stop centering inside a table cell?

html,css,css3
My question will become more clear with the linked JSFiddle below. I would simply like each to not be centered (height-wise) in the table cell it may be in. Here the example showing my problem: http://jsfiddle.net/qc1st2t9/ So, how can I use CSS to prevent a from being centered inside of...

Cannot connect more than 4k users in Openfire installed on Amazon EC2

linux,amazon-ec2,openfire
I'm running an stress test on my openfire server and I cannot connect more than 4k users. When my computer connects 4k users, just to be sure that the problem is in the EC2, I run same test with different user offset on another computer, and still no improvement. This...

How to display a ListView in alphabetical order?

c#,xaml,windows-phone-8
I have a XAML Listview. In c#, I have my class with the properties "NomeRegione" of the class "Regioni". I then created a list of Regioni: List<Regioni> reg = new List<Regioni> { new Regioni { NomeRegione="Valle d'Aosta" }, new Regioni { NomeRegione="Piemonte" }, I then grouped the elements so: var...

What do three dots “./…” mean in Go command line invocations?

go
If you run Golang tests on Travis CI, it will download all of your dependencies with three dots: go get -d -v ./... && go build -v ./... What does ./... indicate or expand to there? I've done some research but it doesn't seem to be a Unix convention....

TextWrangler - move text to the end of the line

sorting,text,grep,textwrangler
I have a text file containing only text lines like this: (abc) defghjklmnop I want the whole bracket to be at the end. So it should look like this: defghjklmnop (abc) The text in the bracket and the text after it vary from line to line. How can I do...

Get Web Response Status Code properly Asynchronously

c#,.net,vb.net,http,httpresponse
I'm searching for a solution in C# or else VB.Net for this problem. Using a WebClient I would like to retrieve the server response of UploadValuesAsync method asynchronously but I can't figure it out how to do it. Basically I want to do the same done in this question, get...

Anorm with Java 8 Date/Time API

scala,datetime,playframework,playframework-2.3,anorm
I try to save timestamp field to postgresql using anorm. In scala code date/time stored as instance of java.time.Instant (someTime variable) DB.withConnection() { implicit c => SQL("INSERT INTO t_table(some_time) values ({someTime})").on('someTime -> someTime) } But anorm can't work with it now (Play 2.3.7). What is the best way to make...

Updating pseudo-element content property when HTMLElement.dataset updates

javascript,html,css,internet-explorer,pseudo-element
I am using the CSS attr function to dynamically link the value of a data-* attribute to the content of a pseudo element: body::after { content: attr(data-after) } I am then regularly updating that data attribute via the HTMLElement.dataset property: setInterval(function () { document.body.dataset.after = new Date; }, 1000); I'm...

How do I use a function multiple times in Python?

python,function,loops,arguments,call
I am having some trouble with some code. When I use a function once calling it again doesn't appear to call the function again. credit=0 x=1 d=1 def sum1(): global x global credit while x>0: g=int(input("Press 1 to continue inputting money or press 0 to select and item")) if g==1:...

Why does quickbooks fail when trying to create/update certain attributes?

ruby-on-rails,ruby,quickbooks
I am trying to create a new customer using the quickbooks API. If I only pass the name and active attributes it works fine. However, when I pass other attributes it fails. ruby 1.9.3p194 - Rails 3.1.3 gem 'strong_parameters', '~> 0.2.3' gem 'quickbooks-ruby' gem 'quickbooks-ruby-base' gem 'oauth-plugin' base = Quickbooks::Base.new(@user,...

page factory pattern and dropdownlist

java,drop-down-menu,selenium-webdriver,pageobjects,findby
I am a novice in selenium. I need some help trying to do this. how do I use page factory pattern to select a drop down list the code I tried is not working I am getting an error saying annotation name expected instead @FindBy(how=How.ID,using="ccompound") public WebElement Select_Compound; Select dropDownBox...

JOINS between 7 tables

mysql,sql,join,left-join,inner-join
I have got alot of help in my previous post, which lets me understand the Database model better. I have read tutorials and explainations about JOINS, but i can't seem to figure it out, hereby my database model; ***Person*** ***DrivingLicense*** ***DrivingLicenseLicenseTypes*** ID ID ID Name ExpiryDate DrivingLicense_ID Person_ID LicenseType_ID ***LicenseTypes***...

Connecting git on new computer to previous repo

git,github
I have searched all over but can't seem to find the answer. I got a new computer, copied all my files from my previous machine over and want to reconnect to an existing repo on github. What is the best way to do this? I cloned the directory but that...

java: what value should I return when one of the String arguments is null.“int compareTo(String,String)” [duplicate]

java,string,compare,return-value
This question already has an answer here: What should int compareTo() return when the parameter string is null? 5 answers I'm trying to create my own "int compareTo(String,String)" method. I was wondering what should I return if I find any of the strings are null? throw an exception? return...

Data transfering between services, repositories and model

php,design-patterns,laravel,domain-driven-design,dto
I'm having a hard time to decide the best practice to translate data between application layers in my case between the UserService which receive an update request that contains the following : { "first_name" : "somename", "last_name" : "somename", "gender" : "male" } And the UserRepository which expect to receive...

How do I apply unknown arguments to a function in Python 3.x?

python,function,arguments,apply
I'm developing my own GUI for my engine, and I've created an "object" called EwConsole (A simple "drop-down" console to input commands). In order to do that, I simply store an ID for the function to be "triggered with enter/return" as the key to the function-object itself in a dict....

Update my content into XML-file

javascript,php,jquery,xml
I just gratefully managed to load the content of an XML-file into my php-document, like so: $(document).ready(function () { $.ajax({ type: "GET", url: "abstimmer.xml", dataType: "xml", success: function (xml) { var $lis = $(".abstimmer li"); $(xml).find('klick').each(function (index) { if (index < $lis.length) { $lis.eq(index).html($(this).text()); } }); } }) }) By...

How to apply where cause in mysql join query to different tables

mysql,sql
I have the following mysql statement based on Mysql intersection based on single field: SELECT m1.* FROM mytable m1 INNER JOIN mytable2 m2 ON m1.history = m2.history WHERE `insert_date` >= DATE_SUB(CURDATE(), INTERVAL 3 DAY) Does the where clause applies to the first table. How do you apply the where clause...

Javascript ondbclick

javascript,events
I've got a table. I want its every "td" to call an event when double-clicked. So, var cell = document.getElementsByTagName('td'); cell.ondblclick = function() { alert('You clicked me!'); }; I understand it like "When you click on a cell you get the alert message "You clicked me!" But it doesn't work...

ComboBox ItemTemplate triggering TargetException when selected item is removed?

c#,wpf,xaml,mvvm-light,mef
I have a WPF application (.NET 4.5) using MEF and MVVMLight. There is a shared MEF Export called "DeviceSupervisor" which holds an ObservableCollection of a custom class, DeviceConfiguration, which isnt much more than a few string properties. In the main app, you can add and remove devices to/from this collection....

Auth redirect isn't working. Prefix doesn't show

php,authentication,laravel,routing,prefix
Everything is working fine except when I try to open some link that requires authentication I get the wrong route. Route::group(array('prefix' => 'admin'), function(){ Route::get('login', array('as' => 'admin.login', 'uses' => [email protected]')); Route::post('login', array('as' => 'admin.login.post', 'uses' => [email protected]')); Route::get('logout', array('as' => 'admin.logout', 'uses' => [email protected]')); }); Route::group(array('prefix' => 'admin', 'before'...

BackColor property not changing properly in code. Any ideas as to what I'm doing wrong?

c#,windows,winforms
Intermediate C# dev here. Trying to transition into game programming by writing a simple Simon clone (private learning only, I do not own any copyrights or intend to distribute/sell) and I'm stuck. Here's a link to the full code thus far: Simon The problem lies in the PlayTile() method below:...

Combining data from columns w/ a conditonal

excel
I have two columns, column O and column P, along with a new blank column Q. I want column Q to be filled with values from column P, unless the cell is blank, in which case I'd like that cell to be filled with the value from column O. I'm...

Controlling volume with buttons

android
I want to be able to control the volume with on screen buttons (A plus and a minus) I'm using the following in the OnClick method: case R.id.bMinus: currentRingerVolume = audioManager.getStreamVolume(AudioManager.STREAM_RING); newvolume(-1); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); break; case R.id.bPlus: currentRingerVolume = audioManager.getStreamVolume(AudioManager.STREAM_RING); newvolume(1); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); newvolume is a method I...

JSON parsing in C#

c#,json
Basically I am trying to parse this JSON object and get EmailAddress, OldEmailAddress, State and ListID { "ListID":"2ccf66750eb1b889", "Events":[ { "Type":"Update", "Date":"2015-01-19 10:50:00", "EmailAddress":"[email protected]", "Name":"Lei", "CustomFields":[ { "Key":"General School Information","Value":"Centennial (W)"}, {"Key":"Board Information","Value":"Alert: Special Announcements"}, ], "State":"Active", "OldEmailAddress":"[email protected]" }] } Here is my class structure public class cmupdate { public...

Convert Excel CSV to XML format Asp.net C#

c#,asp.net,csv,xml-parsing
I am looking for a way to convert my CSV files into XML format and ultimately display the XML in an HTML table. I have found various ways on doing this on Stack Overflow. First, the technologies I'm using are: ASP.NET MVC 4.0 with WCF REST service in C#. I...

How can I reload the data in a WatchKit tableview?

ios,iphone,core-data,watchkit,wkinterfacetable
I have an app for iPhone with a Tableview, whose data comes from CoreData. The same data are also displayed in a watch app: If I add a row from the iPhone app: and I reload data in the Watch app: I see the old rows empty! If the stop...

Export a function within it's namespace?

c++,function,dll,namespaces,export
I'm fairly certain this isn't possible from what I've read, and tried. Although for ease and continuity in code I would like to ask here. Is it possible to export a function along with it's namespace container example: namespace Continuity { int Foo(void); } Standard usage would be: Continuity:Foo(); I...

java.lang.VerifyError: Verifier rejected class on Lollipop when using release APK

java,android,butterknife
I get this error when I install my release APK on a 5.x device. The error does not occur when I push the same code from Android Studio, or if I run it on a 4.x device. java.lang.VerifyError: Verifier rejected class com.myapp.android.ui.activity.MainActivity$$ViewInjector due to bad method void com.myapp.android.ui.activity.MainActivity$$ViewInjector.reset(com.myapp.android.ui.activity.MainActivity) (declaration of...

How to open localhost:8080 in Cloud9 IDE?

google-app-engine,go,localhost,cloud9-ide
I am developing an app engine project (golang) in Cloud9 IDE. For testing in desktop i would go to localhost:8080 in my desktop browser. In Cloud9, I tried https://workspace-username.c9.io with $PORT set as 8080, but somehow its not working for appengine project. But it is working for normal go web...

how to use python argparse optional argument

python,argparse
my python code looks like this parser.add_argument("-c","--configFile",action ='store_true',\ help='I am here one travel') the idea is when running with -c option, I could have select to use my special config file. However, I issue my command python mypython.py -c myconfig, I am getting unrecognized argument: myconfig. What am I missing?...

Dart polymer 'does not have default constructor'

templates,constructor,dart,dart-polymer
I have several templates (Polymer and Dart) working fine. But I cannot understand the Dart editor complaining in the case where I have a (my) template within another of (my) templates. I have a template for "staff" - it extends PolymerElement. I have a template for "person" - it extends...