FAQ Database Discussion Community


Reflection IllegalArgumentException java

java,reflection
What i am trying to do: get the value of the a reflected field named "f3" with the type "K". I would like to be able to use the value of f3 to reflect fields from within it. (edit)f3 is inside class b which is from a .jar file. (edit)...

rails has_many and belongs_To [closed]

sql,ruby-on-rails,ruby
I am writing an app in which I have two models, User and post, so far my app has been running fine without using has_many and belongs_to accordingly. What difference is it going to make when I add these two statements? I want to see practical differences not just theory....

Ruby freeze method

ruby,call,freeze
def track_for stat # This is a hash with 2 elements of proc { symbol: -> { send(stat) }, array: -> { send(stat[0], stat[1]) } }.freeze[stat.class.name.underscore.to_sym].call end freeze[stat.class.name.underscore.to_sym].call , I have no idea about this code. What is the function of the code inside [], and why use call method?...

Is it possible to add two table's data in Seed method in Entity Framework(Code-first)?

entity-framework,entity-framework-4,entity-framework-5,entity,entity-framework-4.1
In my DataLayer I have this 'Seed' method: protected override void Seed(Context context) { User u1 = new User() { UserName = "dayan", Password = "dayan", Role = "Admin" }; User u2 = new User() { UserName = "neranjan", Password = "neranjan", Role = "employee" }; context.Users.Add(u1); context.Users.Add(u2); base.Seed(context); }...

Error executing mysql_fetch_array

php
mysql_fetch_array is not working. Everything looks fine. I don't know where I am doing something wrong. $sql = "SELECT * FROM `$tbl_name` limit $start,$limit";//if echo gives o/p Resource id #14 $resultw = mysql_query($sql); while($gup=mysql_fetch_array($resultw))//if echo gives o/p Array { //if echo $gup['to']; gives o/p [email protected]; $anusha=mysql_query("select * from users where...

Why does libstdc++ store std::tuple elements in reverse order?

c++,c++11,libstdc++,libc++
According to http://flamingdangerzone.com/cxx11/2012/07/06/optimal-tuple-i.html, with regards to std::tuple... libstdc++ always places the members in reverse order, and libc++ always places the members in the order given Assuming that's true, is there a reason (historical or otherwise) why libstdc++ uses reverse order? Bonus: Has either implementation ever changed its std::tuple ordering for...

iOS: Intercept tap gesture event from top view to bottom view

ios,objective-c,cocoa-touch
In my view controller, I add a UITapGestureRecognizer to self.view. And I add a small view on top of self.view. When I tap the small view, I don't want to trigger the UITapGestureRecognizer event in self.view. Here is my code, it doesn't work. - (void)viewDidLoad { [super viewDidLoad]; UITapGestureRecognizer *_tapOnVideoRecognizer...

Java runtime.getruntime() gives no output

java
I am trying to execute a curl command as a Process through Java. When I execute it, I am not getting back any output at all. When I execute the same command through the command line I am getting the proper output. The URL returns the output as XML. Here...

Can I add a entitlements.plist to jailbreak tweaks?

ios,jailbreak
I'd like to restrict how much access to resources jailbreak tweaks receive. Things like network/keychain/location access... Is it possible to manually add a entitlements plist per tweak? Many thanks....

Parse query gives nil outside himself

swift,parse.com,nil
Can someone explain me (or help) why im getting print like this: A and B:[45.35924,14.39673,Name 1,0, 45.35509,14.40257,Name 2,7] // this is ok C and D:nil //this is not with this code: var dataFromParse: Array<String>! //im calling this func in viewDidLoad and I'm sending to it the ID for row in...

How to “package” an SQL database

java,mysql,sql
I am looking for a way to save an SQL database and then reference it by means other than localhost which would not work because it is being used on other computers. I realize that my terminology may not be correct in asking for a means to "package" an SQL...

moving div with transition height

html,css
Last question for today :/ If someone hover over a link, the height should change. But the problem is now, the complete div moves. Here is the page: Page Here is the code: *{ font-family: "Open Sans"; margin: 0px; padding: 0px; } body{ background: url("images/bg.png") repeat-x scroll left top #9EB5D6;...

Golang net/http request Body always empty

json,web,go
I'm trying to send JSON arguments to my server and parse them using json.Decoder. I've read that you should be able to get the query params from the request.Body property. The following is my server code: func stepHandler(res http.ResponseWriter, req *http.Request) { var v interface{} err := json.NewDecoder(req.Body).Decode(&v) if err...

Where to find sqlite database using Android Studio

android-studio
In Eclipse we can use the DDMS to find where the sqlite database is stored in an Android project. Where or what do we use to find it in Android Studio? Thanks....

Converting System::Drawing::Bitmap^ to ::MAT

opencv,c++-cli
How converting image from picturebox to ::MAT in C++/CLI? Thank you...

How to handle variables in loops from functions and functions in regards to garbage collector?

javascript,performance,canvas,garbage-collection
I'm trying to create my little particle system as a self study to learn more about javascript. Althought I'm not a complete beginner to programming I'm anything but professional programmer. Currently I'm trying to advance my knowledge of pure javascript (thus no libraries in my code). After reading an article...

RegEx Parser like in Automata Class [closed]

regex,perl,computer-science,theory,automata
It seems that most CS textbooks in Automata theory cover Regular Expressions with the alphabet Σ = {0, 1} or Σ = {a, b}. Many students in Automata class had trouble writing RegEx's, is there a parser that accepts something like the following examples? Perl RegEx and similar syntax is...

error create sqlite database?

android,database,sqlite
i want make a databases in sqlite, but when aplication run and i fill edit text and push button force close, log caat error 12-27 09:36:23.063: E/Database(450): Failure 1 (near "TABLElatihan": syntax error) on 0x584160 when preparing 'CREATE TABLElatihan(_id INTEGER PRIMARY KEY,name TEXT,D TEXT)'. 12-27 09:36:23.183: E/AndroidRuntime(450): FATAL EXCEPTION: main...

In KDIFF3 How to automatically overwrite any whitespace conflict for all files

kdiff3
In Kdiff3, when comparing between two directories with multiple files and folders and there are multiple white space conflicts in each file. I have to go through each file and manually click on "merge" and choose "Choose (A or B) for all unsolved white space conflicts". Is there a way...

how to run the Sage preprocessor from command line

python,sage
I'm running my Sage program with sage -python file.py, How do I get sage to run the same preprocessor on 'file.py' as it does on code in the Sage notebook? (Also, why would Sage not do this by default?)...

Ajax request does not work if i dont write return false at the end

ajax
This is my validation function written on button click. function chk_add_area() { var areaCountry=$('#areaCountry').val(); var areaCity=$('#areaCity').val(); var area=$('#area').val(); if(areaCountry.trim()=="") { $('#err_areaCountry').fadeIn('slow'); $('#err_areaCountry').html("Please Select Country"); $('#areaCountry').focus(); $('#err_areaCountry').fadeOut(3000); return false; } else //if(areaCountry.trim()!="" && areaCity.trim()!="" && area.trim()!="") { $.ajax({...

iOS: Adding UITapGestureRecognizer to container view intercepts UICollectionView's didSelectItemAtIndexPath method

ios,swift,uicollectionview,uitapgesturerecognizer
I added a UITapGestureRecognizer to my main Content View in my ViewController to dismiss my keyboard when the content view is tapped. The problem is that I have a UICollectionView inside my content view, and setting the UITapGestureRecognizer intercepts the taps of my UICollectionView. How do I allow my UICollectionView's...

WinRT XAML Menu Navigation MVVM

c#,mvvm,navigation,windows-runtime,winrt-xaml
I have a Windows 8.1 app, and I am trying to add a dynamically generated menu to the left side. I retrieve a list of MenuItem (defined below) and I would like to make a page that has a menu on the left side, and when you click on the...

CakePHP - Use HtmlHelper::link with URL title

php,cakephp
I want CakePHP to make a link with a title that is the full URL that the link points to. Like this: http://example.com/users/login Instead of this: Login I tried using a null title: echo $this->Html->link(null, array('controller' => 'users', 'action' => 'login')); and a blank title: echo $this->Html->link('', array('controller' => 'users',...

convert reference type to value type in golang

go
I want to create slice of elements of type *Person. package main type Person struct { Name string } func convertRefTypeToType(refPerson *Person) Person { // is it possible to convert *Person to Person return Person{} } func main() { personRef := &Person{Name: "Nick"} person := convertRefTypeToType(personRef) people := []Person{personRef} //...

How can you assign a variable that is defined inside an if else statement

java,if-statement
I need to create something that will find the current hour in GMT and convert it into EST. When I attempt to compile and run the program I receive this error: currentHourEST cannot be resolved to a variable. I think that my issue is someplace down in the if else...

How and why use curly braces: return $this->{$this->action}();

php,function,class,methods
so in first part i made 2 object, instantiate two classes (one we generate from createController function) $loader = new Loader(); $controller = $loader->createController(); $controller->executeAction(); and the method executeAction code: public function executeAction() { return $this->{$this->action}(); } my question is taking this line of code: $this->{$this->action}() how this method is...

Qt Blurry QMovie (from gifs)

c++,qt,transformation,gif,blur
I'm trying to incorporate gifs into my project, however the source files are of a small resolution and become blurred when loaded. In the past when I've used small pictures in QLabels they became blurry when scaled because Qt tries to automatically "smooth" them out when scaling. I fixed it...

SQL statement is ignoring where parameter

mysql,sql,phpmyadmin
SELECT * FROM people WHERE university='2' AND MATCH (lname,fname) AGAINST ('+massive' IN BOOLEAN MODE) OR (fname LIKE '%box%' OR lname LIKE '%box%') This query is allowing results to filter through other than those of university='2' how would I update this so it strictly only shows results where university = 2...

Jquery working in Chrome but not Firefox

jquery
I have the following jquery to stop any links from working. It works find in Chrome but fails in Firefox. I don't see any errors. Per some information I found online I change the import to this: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js" type="text/javascript"></script> Here is the Jquery: <script> var j$...

How to put an html link inside a Javascript fucntion?

javascript,html,function
So I have two html files, one named matrix.html and one named oneOne.html and a Javascript file named set.js. matrix.html looks like this: <form id=form1> <script type="text/javascript" src="_layout/js/set.js"></script> <select id="size1"> <option value="1">1</option>` </select> <select id="size2"> <option value="1">1</option> </select> <input type="button" value="Set" onclick="set();"/> </form> And the Javascript files, set.js, looks like...

Printing 2 evenly populated lists side by side evenly

python,string,list,formatting,rows
I'm using the following code to produce 2 lists, nameList and gradeList. nameList[] gradeList[] for row in soup.find_all('tr'): name = row.select('th strong') grade = row.select('td label') if grade and name: if "/" in grade[0].text: gradeList.append(grade[0].text) nameShort = re.sub(r'^(.{20}).*$', '\g<1>...', str(name[0].text)) nameList.append(nameShort) Producing something like: nameList = [“grade 1”,”grade 2222222222”,”grade 3”]...

Loss of Margin Spacing on Fixed Layout

html,css
I am learning HTML and CSS from Jon Duckett's book and have encountered a problem with the fixed layout example in Chapter 15. I was messing around and put in another to try completely understand this layout. My problem is the new I put in seems to not honor the...

Why doesn't this PHP code to create a table in html from a mySQL database work? [closed]

php,html,mysql,linux,apache
This code does not work, for some strange reason. I am sure the MySQL database is correctly structured. yes, I stole some code from W3schools... Maybe the code is too long so I will explain my intentions: <?php $servername = "localhost"; $username = "root"; $password = "censored"; $conn = mysqli_connect($servername,...

How to retrieve image from sqlce database and place on picture box

vb.net,image,sql-server-ce
I have never worked with images before, this is my first time. I am trying to write a procedure that retrives the image based on a product ID. I did it the same I would retrieve a string but I am getting the following error on one of my lines:...

System.InvalidCastException with string isolatedstorage

c#,visual-studio-2012,exception-handling,isolatedstorage
I get this exception on the following code. An exception of type 'System.InvalidCastException' occurred in Project.DLL but was not handled in user code. if (IsolatedStorageSettings.ApplicationSettings.Contains("0")) { string temp = (string)IsolatedStorageSettings.ApplicationSettings["0"];//exception here } What am I doing wrong?...

Regex negative lookbehind max “length”

regex
It actually does work. I am trying to use Regex to match strings with one character surrounded by single quotes ' where both quotes cannot be preceded by a backslash \. This is my Regex: (?<!\\)'(.{1})(?<!\\)' It uses negative lookbehind to ensure that the quotes are not preceded by a...

How to get desktop item count in python?

python,python-2.7,pywin32,win32gui
I'm trying to get the number of items on the desktop using win32gui in python 2.7. The following code: win32gui.SendMessage(win32gui.GetDesktopWindow(), LVM_GETITEMCOUNT) returns zero and I have no idea why. I wrote win32api.GetLastError() afterwards and it returned zero either. Thanks in advance. EDIT: I need to use this method because the...

Bridging file on Swift framework

swift,xcode6
I'm creating a Swift framework and I need to use SQLite, when I create a bridging file the compiler gives me the following error: using bridging headers with framework targets is unsupported, however I found this project (https://github.com/stephencelis/SQLite.swift) which includes a bridging file. How has he done it?

How to get the name of a method in a class [duplicate]

ruby-on-rails,ruby
This question already has an answer here: Get the name of the currently executing method 4 answers How to get the specific name of the current method in Ruby? Example: class Pages def home @title = self.name end end I want to get this result: p = Pages.new p.home...

Misaligned inline block elements with variable heights

html,css
I have code like: HTML <div class="container"> <div class="item"> <p>Testing</p> <p>Testing</p> </div> <div class="item"> <p>Testing</p> </div> </div> CSS .container { text-align: center; vertical-align: top; } .item { background: orange; width: 40%; padding: 30px; display: inline-block; margin-bottom: 20px; } I noticed things are ok when the inline blocks have same content....

$compile not working inside callback

javascript,angularjs,angularjs-directive
I have an AngularJS directive which calls $compile inside a callback click() function. However, the contents do not seem to be getting compiled. var testApp = angular.module('testApp', []); testApp.controller('TestController', function($scope) { $scope.user_name = 'George'; }); testApp.directive('testDirective', function($compile) { return { template: 'Click Here', link: function(scope, element, attrs) { $(element).click(function() {...

What is the difference between an Observer and a Subscriber?

java,rx-java
I am trying to decipher the following function: Subscription getCar(id, Observer<Car> observer) { return getCarDetails(id, new Observer<CarDetails> { @Override onNext(CarDetails details) { observer.onNext(details.getCar()); } }); } I got a good intro to rxjava from http://blog.danlew.net/2014/09/15/grokking-rxjava-part-1/ but it only mentioned Observer in passing, saying you'll be using Subscriber most of the...

Constraint controls greyed out in Xcode (pinning toolbar to bottom)

xcode,swift,ios8
I have a toolbar that I want to pin to the bottom. I was trying to use Storyboard rather than code to do it. When I command + drag from the toolbar to the controller, all I get is a delegate option rather than the option to pin to each...

Bourbon fails when installing in an arbitrary local directory

gem,sass,bourbon
I'm using bourbon in a tornado application. So to install bourbon I wrote this simple make rule: gems: export GEM_HOME=./gems; gem install sass bourbon Then when I try to run bourbon I get this: $ ./gems/bin/bourbon /usr/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'bourbon' (>= 0) among 9 total gem(s) (Gem::LoadError) from...

Is it possible to uniquely reconstruct a binary tree with just inorder traversal with null makers?

binary-tree,inorder
Is it possible to uniquely reconstruct a binary tree with just in-order traversal and null makers? For example, for the tree: A / \ B C The inorder traversal with null markers is: null, B, null, A, null, C, null...

Python dictionary or map in elisp

elisp,emacs24
What is the equivalent of a python dictionary like {'a':1, 'b':2} in elisp? And again, does elisp have any map-reduce api?

Add Static php file but still can use wordpress template

php,wordpress
I just want to create one static PHP file in the theme folder, but I can't use get_header or anything. How can I access to the WordPress API with static PHP file?...

Why can I populate variables through a std::map before main()?

c++,c++11,initialization,undefined-behavior,stdmap
I stumbled across some peculiar behavior in an old program and am figure out why G++ and CLang++ allow it to happen. I have some global variables declared and initialized before main(). The odd part is that they are initialized through a static std::map which is being populated at the...

So many parentheses in gcc standard headers

c,gcc,macros
Why are constant expressions in GCC header files surrounded by parentheses, like this? #define INTMAX_MIN (-9223372036854775807LL) #define INTMAX_MAX (9223372036854775807LL) What would be the difference if I omit parentheses, this way? #define INTMAX_MIN -9223372036854775807LL #define INTMAX_MAX 9223372036854775807LL And why is there the 'L' suffix? Would it be the very same if...

change video overlay resolution in unity

google-project-tango
I'm using Unity VideoOverlayListener to retrieve video overlay from tango tablet camera. But fps is too low, I guess this is because the resolution of the video is too high (1280 x 720). Is there a way to lower resolution?

Check if div contains any overflowing inline-block spans

javascript,jquery
I'm trying to detect if there are any spans in a container that are overflowing and hidden. <div class="container"> <span>one</span><span>two</span><span>three</span><span>four</span><span>five</span><span>six</span><span>seven</span><span>eight</span> </div> . .container { width: 150px; white-space: nowrap; overflow: hidden; } span { display: inline-block; margin-right: 6px; } The only way I could think of doing this is by selecting...

What is happening when I compose * with + in Haskell?

haskell,functional-programming,function-composition
I'm trying to understand the result of (*) . (+) in Haskell. I know that the composition operator is just the standard composition of mathematical functions- so (f . g) = f (g x) But: (*) . (+) :: (Num (a -> a), Num a) => a -> (a ->...

How to vertically stack two UI elements via Autolayout's visual format language

swift,autolayout
I'm learning AutoLayout's Visual Format Language (VFL) and trying to construct a view that has two elements: UITextView about 20 points from the top and should fill-up most of the vertical space available on an iPhone UIButton that needs to sit below the UITextView, without any padding between the two....

How do i acess textfields inside MC contained in a ScrollPane

actionscript-3,flash,movieclip
I have the following situation... I have a ScrollPane that has a movieclip contained. Inside that movieclip i have various textfields wich i want to populate with json. I know how to do the json part, so the real question here is how can i acess the textfield inside the...

A long-running operation is being executed on the main thread. Swift

ios,iphone,swift,parse.com
In my ProfileViewController I have a query that retrieves the users profile picture which is stored as a PF File. var query = PFQuery(className:"Users") query.whereKeyExists("profilePicture") query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]!, error: NSError!) -> Void in if error == nil { self.userNameLabel.text = PFUser.currentUser().username if let imageFile = PFUser.currentUser().objectForKey("profilePicture") as? PFFile {...

How to add and toggle all li of child uls to parent ul below specific clicked li

javascript,jquery,html,css
Working on converting nested menu to mobil... I need to add each li of dropdown right below parent li on click and toggle them. Here is current menu markup where dropdown is visible on hover: <ul class="navigation-menu"> <li class="white-hover"><a ceid="rd-menu" class="nav-main-links" href="#">Category</a> <div class="drop"> <div class="drop-holder"> <div class="left-side-menu dividerLine"> <ul>...

rails ActiveRecord transactional Integrity / Data not committing mid scenario spec?

ruby-on-rails,rails-activerecord,database-cleaner
I know i'm mis-understanding how ActiveRecord maintains integrity/works: hoping someone can clarify for me explaining why the following is not working? We have an abnormal situation: our rails app calls a compiled binary that accesses (and creates a new table rows, it does not update existing) in a shared database....

How do I paste programmatically with Swift?

ios,swift,paste
I want to have a button the user can press that will automatically paste whatever text is in the clipboard into a UITextView. How can I do that in Swift? It has been answered here but it's in Objective-C....

Containing equal objects in the HashSet

java,collections
Hello I found a question like this related to collections. public class Person { private String name; public Person(String name){ this.name=name; } public boolean equals(Object o){ if(!(o instanceof Person))return false; Person p=(Person)o; return p.name.equals(this.name); } public static void main(String[] args) { HashSet<Person> hs=new HashSet<Person>(); hs.add(new Person("Hi")); hs.add(new Person("Hi")); hs.add(new Person("Hi"));...

Key/Value Confusion in Python Dictionaries

python,dictionary,key
This code does what it's supposed to do. My hang up is understanding what the key in a dictionary is and what the value is. I was (~still am) sure it was -- dict = {key : value} -- But upon running the code below it appears to be the...

Linux run scripts one after other in loop [closed]

linux,loops
I have 10 scripts 1.sh ... 10.sh in one folder. I want to run them one after another and starts from the beggining in loop. For example ./1.sh when finish ./2.sh and so on till run ./10.sh finish and automatically starts again ./1.sh

Python script writes out a file, works from command line but not from java app

java,python
I am trying to invoke a python script (part of a larger python project) from a java app. I've tested and tested this, it works exactly as expected from the command line. I've even resorted to making my own stand alone python script to write out a file. It looks...

ggplot add line to scatter

r,ggplot2
I have "observed data" which are classical [X, Y, Z] points. X, Y, Z are saved in vectors named X, Y, Z. (Typically 10-30 values.) Then i have "result of model data" which is set of [X, Y] points creating a smooth line (= specially made regression line). Data are...

User restriction page when logged in

jsf,servlet-filters
My website contains two type of users, user and admin. I'm trying to restrict the user from accessing admin control page, and I tried to do it like this inside doFilter(): System.out.print("\nNumber of objects constructed:->" + Counter.show() + "\n\n"); String path = req.getRequestURI().substring(req.getContextPath().length()); if (path.startsWith("/faces/xadmin.xhtml") && !JloginDAO.per.equals("admin")) { res.sendError(HttpServletResponse.SC_UNAUTHORIZED); }...

How to delete QFrame in pyqt

python,qt,ubuntu,pyqt
i try to build a software center GUI similar to ubuntu software center. I'm using pyqt. I created three QFrame object in my GUI. Each QFrame object has a different purpose, one for categories, one for top rated softwares, one for recommended softwares. These three frames are displayed on the...

Laravel with Confide - Custom validator not working?

php,validation,laravel
The documentation of the Zizaco/confide package for Laravel isn't very descriptive when explaining how to use custom validators. I'd like to be able to validate first name, last name, address, city, state etc. fields in my registration process however I haven't found anything that works besides modifying the vendor package....

Mysql select cells that contain a string from another row's cell

mysql,select
Hello I've been looking all over and haven't found my answer. I am trying to make mysql select all rows that contain a certain string from another row For example: i d | item | info 1 | circle | red|blue 2 | square | green|yellow 3 | triangle |...

Remove consecutive duplicate values in a string

c++
I am trying to make a program so that when a string such as "cccaaaattt" is entered the output will be "cat" Here is my code so far: #include "stdafx.h" #include <iostream> #include <string> using namespace std; int main(array<System::String ^> ^args) { string str = "";//create an empty string variable...

Convert class object to bytes and create object from bytes

c#,bytearray
I have done some researches on this topic and found some solutions with the help of MemoryStream and BinaryFormatter classes Marshal class But neither of these methods work for my class because my classes have an array. Here is the test class I am working with: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi,...

why does PHP_EOL write \r\n at the end of each line

php,xampp,fwrite,eol,osx-yosemite
I have been struggling with the PHP newline character. I agree with the following facts that PHP_EOL provides a platform neutral newline (\r, \r\n, \n based on OS) and we can leverage that to our benefit. I am doing a simple PHP File Read and Write in my Mac OS...

database query optimization mySQL

mysql
Hello was wondering what the better approach is: the target database will only have about 100,000 rows To have one table like below: AllCars ID | Car_Name | Car_Model | Car_Type | Car_Features | Car_Location ______________________________________________________________________ 1 | Nissan | Ultima Explorer | 4D | Airbag Power | TX SQL:...

Three.js: re-orient axis of rotation

javascript,rotation,three.js
I have an airplane mesh with its tail at (0,0,0) and its nose at (a,b,c). I want to point the nose at (e,f,g) and leave the tail at (0,0,0). No extraneous rotations should be introduced, just the one simple rotation to repoint the plane. Perhaps another way of saying this:...

Stored procedure to find free slots with different work times per day of the week

sql-server,stored-procedures
I am using the awesome stored procedure created by Aaron Bertrand here as a start since it almost does what I need. Sadly my SQL skills are not as good as his so I need some help here. What I need to do is to find free time slots between...

XPath iteration Exception: “An attempt was made to use an object that is not, or is no longer, usable”

javascript,exception,dom,xpath
Slightly changed snippet from Mozilla's Introduction to using XPath in JavaScript is throwing exception. [Exception... "An attempt was made to use an object that is not, or is no longer, usable" code: "11" nsresult: "0x8053000b (InvalidStateError)" location: "debugger eval code Line: 6"] Code: var headings = document.evaluate('//h2', document, null, XPathResult.ANY_TYPE,...

Sequelize eager loading association with through table

node.js,associations,sequelize.js
I've been through several questions on the site but I still can't see what I'm doing wrong here, so any help would be greatly appreciated. I'm getting the error: Organization (organizations) is not associated to User! Org Model: module.exports = function (sequelize, DataTypes) { return sequelize.define('Organization', { organizationID: { primaryKey:...

Can I substitute SICP lecture videos with SICP lecture notes?

lisp,sicp
As far as I understand, the famous SICP lecture videos: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/ Are a complementary material to the famous SICP book. However, for a few reasons, I prefer reading these SICP lecture notes from here: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/lecture-notes/ So, a couple of questions to those who know...

Rewrite .htaccess buffling issue

php,.htaccess,xampp
So I'm trying to rewrite some urls for a website I'm working on. The rewrite files read as: Options +FollowSymLinks RewriteEngine On RewriteBase /NetbeansProjects/App/ RewriteRule ^(.*)/+$ $1 [R=301,L] RewriteRule ^/*$ index.php?page=index [NC] RewriteRule ^([webapp/]+)/([main/]+)/?$ /NetbeansProjects/App/index.php?page=$1_$2 [NC,QSA] RewriteRule ^([webapp/]+)/([dashboard/]+)/?$ /NetbeansProjects/App/index.php?page=$1_$2 [NC,QSA] RewriteRule ^([webapp/]+)/([search/]+)/?$ /NetbeansProjects/App/index.php?page=$1_$2 [NC,QSA] RewriteRule...

How to position an input field inside of a DIV

html,css
I'm trying to position an input field inside of its parent div. I want to float the box to the right and center it vertically, but I can't seem to get it to work. Here is my HTML: <!DOCTYPE html> <head> <link rel="stylesheet" type="text/css" href="index.css"> <script src="index.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> </head>...

Creating Method for UI Notification in Swift

ios,swift,notifications
In one of my views, I have a UITableView. I would like to create a function that is called whenever a user selects a cell in the table. I figure I should use "UITableViewSelectionDidChangeNotification", but I am new to iOS and Swift so I don't know how to precede. Thanks...

How to maintain jQuery DataTables scroll position after .draw()

jquery,datatables,jquery-datatables
I am using jQuery Datatables plugin for a smal table (12 rows). Some <input type="text" ... fields allow editing. When the input field loses focus I need to validate its value and possibly change the field value. I haven't been able to get modified input field values to be recognized...

How determinant is ylim in R's plot()? What overrides it? [duplicate]

r,plot
This question already has an answer here: How can I make the zero tick appear in the lefthand corner in R plots? 1 answer Something appears to take precedence over the ylim parameter in a plot in R. Coding > plot(c(0,1), c(-30,30), ylim = c(-32,32)) > text(x = .5,...

Calculate new X,Y position based on angle center x,y is facing for a radar

c#,math
I have a radar in my game. Right now the radar works using a static X,Y graph that does not rotate based on how you are facing in my game. I want the X, Y positions on the radar to rotate based on the direction you are facing. Monsters in...

Change color of table cell when radio button is checked

jquery,css,button,colors,radio
I would like for the cell neighboring my radiobutton's cell to be highlighted green when the radio button is checked, and to turn back to grey when it is moved to unchecked. In other words, the radio button containing the value of the winning team should turn the cell containing...

change the margin using variable with JavaScript

javascript,html,css
I'm trying to change the value of the top margin when hitting the up arrow key the code seems right to me but i don't know why it wont work ! JavaScript var playerPosition = 0; window.onkeyup = function(e) { var key = e.keyCode ? e.keyCode : e.which; if(key =...

How to share ownership of a directory between two users

node.js,jenkins,amazon-ec2,continuous-integration,nvm
I've created an EC2 instance and built a Jenkins Server //my current folder pwd > /var/lib/ // permissions of jenkins ls -la > drwxr-xr-x 10 jenkins jenkins 4096 Dec 27 02:24 jenkins > ... I've also installed node via nvm //by default installs in home directory under ec2-user pwd >...

Google map does not display on Ionic Android Build .apk using Cordova( works fine on the Chrome browser)

ionic-framework
Plz help Issue: Not able to display a google map on the page for an ionic android build app using cardova (WORKS FINE ON THE CHROME ie WITHOUT ANDROID BUILD) Page: <script id="mapPage.html" type="text/ng-template"> <ion-view title="Map" ng-init="init()" > <ion-nav-buttons side="left"> <button class="button"> Back </button> </ion-nav-buttons> <ion-content> <div id="map" data-tap-disabled="true"></div> </ion-content>...

How to have a free text input field (textbox) in a toolbar widget with Firefox Addon-SDK

javascript,firefox,firefox-addon,firefox-addon-sdk
I am using Firefox Addon-SDK to create a toolbar for learning purpose which takes free text and search the webpage for that text, something which ctrl + f does. Based on the SDK documentation, I was able to create a normal button, toggle button, etc. But, I couldn't find anywhere...

How do I change Command Prompt from C:\> to H:\> - I'm trying to install ROR [closed]

ruby-on-rails,installation
I'm very new at this, just started to learn about code I'm trying to install Ruby on Rails by Command Prompt H:>gem install rails (I already have ruby installed on my windows 7/8 laptop) but I don't know how to change from C:> to H:> at the moment it says:...

Where to Process User Input in the Command Pattern

design-patterns,command-pattern
I'm currently processing user input in client classes, however I feel that by doing this the command object's execute method I would be increasing the capability for reuse as one would only need to instantiate the command object to use its functionality rather than relying on the implementation from the...

Select integer returning function result into variable postgres

postgresql,stored-procedures,plpgsql
In Postgres, I'm writing a test script for a function (stored procedure) I wrote. The function returns and integer, the id of the row inserted. In the test script I want to select that id into a variable and show everything has been inserted correctly. The function looks like this:...

Button with PNG using GDI+

c++,winapi,graphics,gdi+
I'm trying to load a png to my button, but it's not showing the png in my button. I create my button with this function: HWND MyControls::CreateButton(LPCTSTR text, int x, int y, int w, int h, HMENU id, HWND hwnd, HINSTANCE hInst, bool png){ if (png){ return CreateWindow("BUTTON", text, BS_BITMAP...

scrollTop() function infinite loop

javascript,jquery,scroll
I know this subject has already been covered but I didn't find something as specific as my problem and the solutions I found didn't work for me (or i couldn't manage to make it work). I basically want to scroll to the top of the next element (a 100% height...

Why are all the dialogs are using the “old” Android 2.x style?

delphi,firemonkey,delphi-xe7,rad-studio,appmethod
I am currently using RAD Studio XE7 and just wondering why all the dialogs in my Android app are using the "old" 2.x style? And how to force my Android app to use the 4.x style in all the dialogs like date picker and MessageDlg? Using StyleBook and modying the...

Bluetooth client-server communication [java]

java,eclipse,bluetooth
I tried some blue-tooth chat program that involves import javax.bluetooth.* and my eclipse shows that as error saying import javax.... cannot be resolved I am using Linux.. Will the Java bluetooth specific program is portable to other OS....

Trouble With NSSplitView Starting Sizes (Storyboards and Swift)

osx,cocoa,swift,nssplitview
I just started a simple Cocoa app using Swift, Storyboards, and a Document. The only change I've made is to replace the default View Controller in Main.storyboard with a Split View Controller. Everything works great as far as the subviews populating correctly except for one thing: the divider is always...

Drop in Javascript component - How to handle ‘configuration'

javascript
I’m trying to create a Javascript component that I can simply ‘include’ on a page and it basically outputs a form. I will probably use Handlebars templates within my component. However, I’m struggling with how best to structure the configuration of my component I thought of some how passing it...

creating a 2D circular mesh in Matlab

matlab,circle,mesh,polar-coordinates
I have some data on a horizontal line (x,y,data) (2991*3) with y=0. Instead of plotting the line in a Cartesian coordinate system, I would like to transform that line into a quarter circle and plot the data in a range of color. I'm able to create a mesh rho =...

Rails : Storing and retrieving values from multiple select

ruby-on-rails,model,multiple-select
I'm wondering what is the best way to store values from a multiple select in the database? I have a model "People" and I need to store people's preferences which can be multiple values Should I store their preferences as an array on the same table or create another table...

Online Betting Games and Security: How to?

javascript,ruby,clojure,clojurescript
I've developed a betting game (using bitcoins). This is how it is set up: Using javascript, clojurescript, ruby on sinatra. Initial Way (Plan A) Client side: JavaScript is evaluated. This includes all game logic and requests to server. Yes, all of the game is evaluated on the client-side. Server side:...