Menu
  • HOME
  • TAGS

OpenGL Stereo: alternating between left and right textures

c++,opengl,cuda,stereo-3d

I think the following should work. The new fragment shader: #version 150 core in vec3 Color; in vec2 Texcoord; out vec4 outColor; uniform sampler2D texIndex; void main() { outColor = texture(texIndex, Texcoord); } Then replace ”texLeft” and ”texRight” in your code by ”texIndex”. Note that you shouldn't have to upload...

how to shuffle an object array in java

java,arrays,shuffle

Collections.shuffle isn't good enough: Randomly permutes the specified list using a default source of randomness. All permutations occur with approximately equal likelihood. The hedge "approximately" is used in the foregoing description because default source of randomness is only approximately an unbiased source of independently chosen bits. If it were a...

Securing REST Web Service using token (Java)

java,web-services,security,rest,encryption

Why not simplify it to the following? For first request: User establishes HTTPS connection to server (service does not listen on any other ports) and POSTs credentials to login service. Server replies with HSTS header to ensure all further communication is HTTPS. If credentials are valid we: Generate a random...

How to obtain exception message to log it on catch blocks on already existing class with Javassist?

java,instrumentation,javassist

When you enter a catch block, you will find the exception lying on the stack. Thus, you can extract the message as follows: duplicate the topmost value of the stack which is the exception such that you can call methods of this object without taking away the value for deeper...

Crawler4j with Grails App throws error

grails,groovy,crawler4j

Just refresh your dependencies.

Custom push notification in iOS

ios,push-notification,apple-push-notifications,javapns

You are sending Apple Push Notifications from your server to an iOS application. Apple Push Notifications offer much less freedom than Android's GCM. The JSON you are sending should look like this : {"aps":{"alert":"message","badge":3,"sound":"sound-file-name"},"custom-property":"custom-value"} The only parameter used to display the notification is the "alert" parameter (there are some minor...

Listening for outside events. Bash to NodeJS bridge

javascript,node.js,bash

The problem with using signals is that you can't pass arguments and most of them are reserved for system use already (I think SIGUSR2 is really the only safe one for node since SIGUSR1 starts the debugger and those are the only two that are supposed to be for user-defined...

Table view controller not showing data when assigned to contentViewController property in popup

ios,storyboard

You won't be able to use a segue to do this, since segues always instantiate new controllers. If you want to reuse the same instance of the content controller, then you need to present it in code something like this, @interface ViewController () @property (strong,nonatomic) AJFTableViewController *filterTableViewController; @property (strong,nonatomic) UIPopoverController...

How to union two tables with different col number ? mysql

mysql,sql

Your query should be this: SELECT firstName , secondName , lastName FROM (SELECT firstName,secondName,lastName FROM table1 UNION SELECT firstName, NULL as secondName, NULL as lastName FROM table2 ) resutls Use the alias of column name to treat it as a new column for second table. This will work for you....

Average using a difference from MAX in Excel

excel

I think what you may require is something like: =AVERAGEIF(DM7:DM34,">="&MAX(DM7:DM34)-3) You might achieve some added "comfort" by changing 3 in -3 to a cell reference where the difference number would be placed/changed....

Bash script which plots data using XMGRACE tool

bash,xmgrace

Yes, it is possible to call xmgrace/Grace without the GUI (using gracebat), but the commands you have used must first be inside a script file. Contents of file "script.bat": xaxis label "Label 1" yaxis label "Label 2" DEVICE "EPS" OP "level2" PRINT TO "plot.eps" PRINT Now, for a two-column data...

Override/embed addon SDK in a Firefox extension to modify panel.js

javascript,firefox,firefox-addon,firefox-addon-sdk

Unfortunately, there is no supported way of doing this (that I know). Searching the SDK sources for noautohide without any results seems to confirm this. Personally, I'd use the require("chrome")-and-get-the-XUL-element workaround for now (but keep in mind that there could be more than a single browser window), or just not...

Rails : wrong number of arguments (1 for 0) for .new

ruby-on-rails,ruby,ruby-on-rails-3,argument-error

Ok I find the problem... Apparently the error was caused by the attribute send. I'm really surprise because I checked all reserved words in ruby and "send" doesn't appear anywhere. So just have to rename it and everything works now. Anyhow, thanks all for your help....

BackStack Fragments blank on rotation

android,fragmentmanager

Depending on how you recreate the activity you may need to manually handle fragment state changes. In the worst of cases you may need to detach and reattach the fragment to force view recreation. public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.detach(activeFrag).attach(activeFrag).commit(); } and have the correct...

Parallelism and Flatmap in Java 8 Streams

java,parallel-processing,java-8,java-stream

In the current JDK (jdk1.8.0_25), the answer is no, it doesn't matter you set the inner flag to parallel, because even you set it, the .flatMap() implementation set's back the stream to sequential here: result.sequential().forEach(downstream); ("result" is the inner stream and it's sequential() method's doc says: Returns an equivalent stream...

Different result from regex in Windows vs linux? [closed]

python,regex,linux,python-2.7

Error , it's not /d it's \d, so your code would be, ID = re.match('^\d{1,10}', fn).group() \d matches a digit ie, [0-9]...

Completion Blocks Syntax in Swift

objective-c,block,swift

self.eventStore.requestAccessToEntityType(type) { (granted: Bool, err: NSError!) in dispatch_async(dispatch_get_main_queue()) { ... } } for an example of working code, I was experimenting with this exact API in swift :)...

php - session lost after refreshing page [duplicate]

javascript,php,jquery,html,session

First of all, no need for javascript to redirect you to the index page. You can do it from PHP too: header("Location: index.php"); So the login.php will look like this: if ($loginNumRows == 1) { session_start(); $_SESSION['username'] = $loginRow['name']; header("Location: index.php"); Note, that I have changed the order. As others...

Creating MySQL function requires SUPER privileges

php,mysql,phpmyadmin,create-function

I have circumvented the problem by making a long and therefore ugly database query in PHP. Maybe using stored procedure instead of function would be better. After searching I found in the documentation here this statement: The current conditions on the use of stored functions in MySQL 5.5 can be...

Concatenating string to integer

vb.net

This is a very poor question but I'll answer it anyway. The result is: no, casting is not needed. In your case str2 will be Test1. Internally the code will use String.Concat() method, which takes objects and calls ToString() on the object. And since everything in .NET derives from object,...

enabling a constructor with sfinae if given template argument provides a type definition

c++,c++11,constructor,sfinae

You could solve this using SFINAE, but there is a much easier solution since C++11: Inheriting constructors. template <typename T> class Check: public T { public: using T::T; }; In case the constructor does more than only forwarding; use this general solution: #include <type_traits> template< typename T > struct HasCtorParamTypedef...

How to Center Scroll Bar in HorizontalScrollView Android

android

You have to use: scrollView.post(new Runnable() { @Override public void run() { scrollView.scrollTo(x, y); } }); ...

ViewBag missing

asp.net-mvc,viewbag

Please stop using ViewBag like that. It is not designed for this. And reason ViewBag is null in controller (I suspect) that these are different ViewBag objects in filter and in controller. If you need to do repetitive actions in your view, there are better ways to do that. For...

Is it bad practice to not include type=“text/css” in style tags? [duplicate]

html,css

From the W3.org wiki : The default value for the type attribute, which is used if the attribute is absent, is "text/css" So no, you don't need it, as it was always the default value and it's now explicitly optional....

Attribute Exception Error Raised When I Run This CLI app

python

My debugging session tells me that docopt immediately bails out if it can't parse the given options (in your case, for example when no options at all are given). So in your __init__, before self.init_db() gets called to set up self.db, docopt() is called, fails to parse the (not) given...

Why is no TransactionRequiredException thrown when @Transactional is missing?

java,spring,hibernate,jpa,transactions

The answer is pretty clear and concise (you actually discovered it yourself): JPA requires a transaction being in progress for the call to EntityManager.persist(…). However your code is not set up to be run inside a transaction. Your configuration looks sane but you're missing an @Transactional on either the DAO...

Checking for presence of an item without using expect

angularjs,selenium-webdriver,protractor

The answer by @alb-i986 got me on the right track. After looking at the findElement API, I found two references on how to do the error handling for a this function: https://github.com/angular/protractor/blob/master/docs/api.md#webdriverwebelement https://github.com/angular/protractor/issues/485#issuecomment-33951648 Protractor is returning a promise from the findElement function, and the promise's then function (which is called...

why this java code didn't work? [closed]

java

The problem with your code is you are using return; statement inside for loop. What you actually need here is a break; statement Also the way you create the html for a multiline label is wrong. It wont work because the final html generated would be <html><html><html><html> <br> 1</html> <br>...

Bootstrap radio button with function

javascript,jquery,html,css,twitter-bootstrap

I ended up using this switch here : http://proto.io/freebies/onoff/ here is the html: <h4>Did you Vomit?</h4> <div class="onoffswitch"> <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="vomit" /> <label class="onoffswitch-label" for="vomit"> <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span> </label> </div> <div class="expand"> <div class="input-group"> <span...

How to redirect localhost/dir to localhost?

android,osx,redirect,localhost

You can use a .htaccess file in your web root folder. Have a look to this website about the .htaccess file Your file would look something like this: RewriteEngine On RewriteRule ^(.*)/request$ http://example.com/request [L] ...

How to connect a Form with Controller in MVC3?

c#,asp.net-mvc,asp.net-mvc-3

Assuming you are currently just using the default route, the reason you are not reaching the action method is that the "Controller" suffix on your route is implicit - it shouldn't be part of your URL. @using(Html.BeginForm("Search","List")) Additionally, regarding: What I want is to show result in same View file...

Loop to print text files is skipping some files(randomly, it seems)

vb.net

I can see a few issues. the first and most obvious is the error handling: You have a Try.. Catch with no error handling. You may be running in to an error without knowing it!! Add some output here, so you know if that is the case. The second issue...

What would keep setter methods from being created in sencha touch

extjs,sencha-touch

Assuming #responseArea refers to an HTML element like a <div>. To attribute the response from your server to the HTML element, do this: this.getResponseArea.setHtml(responseText); instead of this.setResponseArea(responseText);. Don't forget getResponseArea gets you the HTML element with #responseArea as id. When you got it, you can do whatever you want with...

DropDown lost selected values after Refresh

jquery,drop-down-menu

Solved <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script> <select id="Selection"> <option value="">Sort by</option> <option value="0">Code</option> <option value="1">Title A-Z</option> <option value="2">Title Z-A</option> <option value="3">Brand</option> <option value="4">Lowest price</option> <option value="5">Highest price</option> <option value="6">Lowest...

Detect external window update

window,gtk,x11,detect,window-managers

With X11 you need to use Damage extension - DamageCreate / DamageSubtract requests and DamageNotify event. Not sure about gtk api ( Ideally there should be wrapper around X11/Damage and win32 but not sure if it exist ) - try to look at damage-event

Regex - Remove time from date

jquery,regex,datepicker

Don't need a regex, you can use: $('span.custom-date').text($('span.custom-date').text().split(' ').slice(0, -1).join(' ') ) jsFiddle example...

Count number of NULL values in each column in SQL

sql,sql-server

As Paolo said, but here is an example: DECLARE @TableName VARCHAR(512) = 'invoiceTbl'; DECLARE @SQL VARCHAR(1024); WITH SQLText AS ( SELECT ROW_NUMBER() OVER (ORDER BY c.Name) AS RowNum, 'SELECT ''' + c.name + ''', SUM(CASE WHEN ' + c.Name + ' IS NULL THEN 1 ELSE 0 END) AS NullValues...

VBA, Need a conditional Sum based on a change in another column

vba,excel-vba

This turned out to be simpler than I first expected. This code assumes that the column of unique id numbers is ordered such that they are always grouped together and not randomly distributed throughout the sheet. (If this is not the case please say and I will include a sort...

Server send a image as response and rename it before serving - Symfony 2

php,symfony2,http-headers,symfony-2.3

Symfony2 has a helper for this. This is from the documentation. use Symfony\Component\HttpFoundation\ResponseHeaderBag; $d = $response->headers->makeDisposition( ResponseHeaderBag::DISPOSITION_ATTACHMENT, // disposition 'foo.pdf' // filename ); $response->headers->set('Content-Disposition', $d); ...

Robocopy in VBA while using strings

vba,robocopy

Your code is very close. You need to concatenate your variables. All that needs to change is the final line to be: Shell "cmd /c robocopy " & sSource & " " & sPath & " " & sFile...

Better to query once, then organize objects based on returned column value, or query twice with different conditions?

java,sql,database

Logically, a DB query from a Java code will be more expensive than a loop within the code because querying the DB involves several steps such as connecting to DB, creating the SQL query, firing the query and getting the results back. Besides, something can go wrong between firing the...

Adding a Calendar plugin into MVC 5 / Bootstrap 3, not sure how to import files

twitter-bootstrap,asp.net-mvc-5,fullcalendar

For those looking for an answer. (using FullCalendar 1.6.4) FullCalendar Demo First I went to Manage NuGet Manager in the Solution and installed the FullCalendar Plugin. Then I stuck it into the View like the following. *NOTE: Be sure to update the two link href and the @RenderScripts for the...

Empty string is interpreted as bool in Constructor

c++,qt

This problem results from implicit conversions going on in the constructor. String literals, such as the one in your code, are stored as const char types. Because you didn't have a constructor taking this type the compiler tries to find the conversion to a type that it can find in...

How to replace text of element after AJAX request using Jquery

javascript,jquery,html,ajax

You need to set the context in ajax call to current object. You can use context option from ajax to do that: context: this, Modified ajax call: $.ajax({ url: "/permissions/update", type: "POST", context: this, data: { aco : acoPath, aro : aroGroup }, cache: false, dataType: "HTML", success: function (html)...

Android: Scanning for TCP socket server IP (Port ist known)

android,arrays

ArrayList<String> arrayList = new ArrayList<String>(); then in the try block of findSocket before return true; arayList.add(ip); ...

Setting up Spring JTA transaction in Jboss 7.1.1

spring,jboss,spring-data-jpa,jta

i know its late but, i believe i fixed this error by using a different factory class. <property name="hibernate.transaction.factory_class" value="org.hibernate.ejb.transaction.JoinableCMTTransactionFactory"/> hope it helps :)...

Do I need a 64 bit version of stdvcl40.dll?

delphi,delphi-xe6

I guess this DLL is used as storage for type library only (with definition of IStrings etc), at least in your case. And then answer is "NO", you don't need x64 version. When you register this x32 DLL, type library should be available for both x32/x64 apps. Sorry, i can...

how to hide/show multiple user interface controls, in a Visual Basic 2013 ASP.NET web application?

asp.net,visual-studio

I used the Panel control in the toolbox, and then controlled its .visual property.

SQL Trigger for creating Alphanumeric value

sql-server,tsql,sql-server-triggers

A better solution would be. SET IssueIdProxy=CONCAT('ABC',FORMAT(inserted.IssueId,'0000')) The format command will pad any empty fields in the IssueId with the String passed to it. In our case '0000' four zeros. It will return a nvarchar. Concat will add this to the 'ABC'. The trigger only runs after the initial insert...

Remove the first 2
  • content, except what you have inside the tag
  • javascript,jquery

    This removes the first list item completely, then all nodes except labels from the second list item. Demo $('ul li:nth-child(1)').remove(); $('ul li:nth-child(1)').contents().filter(function(){ return !$(this).is('label'); }).remove(); ...

    What are targets in Xcode? [duplicate]

    xcode

    It means the product you want to build. You may have multiple targets in a single project if you build different products from the same source code (e.g. an app, a framework and a unit test bundle). You may even have several targets of the same kind (e.g. two apps...

    Drupal delete token by calling push_notification service from android

    android,rest,drupal,drupal-7

    I solved the issue by following these steps. 1) Used DELETE method instead of normal POST method 2) Sent the tokens in the URL => http://example.com/endpoint_name/push_notifications/{token} Like http://example.com/endpoint_name/push_notifications/abcgr123 whole token value in the end. This will delete that token from the database....

    How can I get the name of the key from object arguments in javascript

    javascript,json,javascript-objects

    Similarly to @Robby's answer, you can also use Object.keys: function foo() { console.log(Object.keys(arguments[0])); } foo({event_1:"1", event_2: "2"}); ...

    Grails Export Plugin errors

    grails

    According to this link https://jira.grails.org/plugins/servlet/mobile#issue/GPEXPORT-28 You can fix it through a workaround. Add this in the Buildconfig.Groovy repositories { ... mavenRepo "http://repo.grails.org/grails/core" } dependencies { ... compile 'commons-beanutils:commons-beanutils:1.8.3' } Apparently custom repositories are not propagated to Projects from plugins....

    StringLengthAttribute MVC Blank Space at end

    c#,asp.net-mvc-4,unobtrusive-validation

    Well, it is strange behavior, but what we can do :( I think you can't handle it by StringLengthAttribute (or I don't know how) but you can do these things: Regular expression [RegularExpression(@"^(.*\S)?$"), ErrorMessage = "Some error message")] However what I see for problem here is that it will not...

    AngularJs BootstrapUI Datepicker validation

    angularjs,validation,datepicker,angular-ui-bootstrap

    used this: maxlength="10" on the html to limit characters. and this is to validate the date format is correct (avoid 1/1/1, or 11/06/201): MyDirective.directive('dateValidator', function() { return { require: 'ngModel', link: function (scope, elem, attr, ngModel) { function validate(value) { if (value !== undefined && value != null) { ngModel.$setValidity('badDate',...

    error C3861: 'getLine': identifier not found [closed]

    c++,string,getline

    A quick rummage through the documentation for Stanford's C++ library, found through the home page for CS106B (I know it sounds implausible, but it's true), reveals that you should #include "simpio.h" I recommend that you bookmark the documentation; it will save you from many late-night homework panics....

    Share named scope in Rails 4

    ruby-on-rails

    The ActiveRecord's method .last returns an instance of your model, not an AR::Relation that you can chain scopes on it. Try this: Folder.last.class # => Folder Folder.your_scope.class # => ActiveRecord::Relation Use your_scope like this: Folder.your_scope.last ...

    How to retrieve class object from ICollection?

    c#,asp.net,linq

    var userDetailsObejct = (from u in user.UserDetails where u.id == Id select u).FirstOrDefault(); This will return a UserDetails object from the UserDetails collection from a specified user with an id that's equal to Id. If it doesn't find it, it will return null....

    Will int32 be the same size on all platforms?

    c++

    int32 is a custom typedef, only int exists by default. If you need a specified width take a look at stdint.h #include <cstdint> int32_t integer32bits; I don't think any floating point counterpart exists in the standard, correct me if I'm wrong....

    Unknown provider error on btfModal

    angularjs

    The problem is in vendors.min.js, not your code. You need ngmin all your vendor scripts as well.

    AngularJS Accordion - open accordion with the objects which just have an array

    arrays,angularjs,accordion

    is-disabled directive please see enablae/disable first panel button here http://angular-ui.github.io/bootstrap/#/accordion <div ng-app="accordion-base" > <div ng-controller="AccordionDemoCtrl"> <accordion close-others="oneAtTime"> <accordion-group ng-repeat="link in links" is-disabled="link.content.length==0"> <accordion-heading> <img class="marginleft" src="{{link.img}}"> {{link.option}} </accordion-heading> <div ng-if="link.content != 0"> <ul> <li ng-repeat="content in...

    How can I clear the cookies in a windows phone 8 cordova plugin?

    cordova,cookies,windows-phone-8,plugins

    I found the easier way of doing this is using a server based "logout" url that will set-cookie invalidate your cookie, by setting the same cookie with an expiry in the past. Basically, although android and ios can do what I wanted, it looks like you can't easily do it...

    IllegalArgumentException: URI is not hierarchical when creating a GridSpringBean

    spring,spring-boot,gridgain

    Since gridgain is embedded try setting the GRIDGAIN_HOME anyway. That should solve your problem.

    How to highlight all inside-a-line word duplicates?

    regex,vim

    This works slightly better: /\(\<\w\+\>\).\{-}\zs\<\1\> Changes: Replaced [ w]\+ by .\{-} (match any character between the pair of words; non-greedy quantifier). Moved \zs forward. Surrounded \1 by \<...\>; these anchors are not automatically inherited from the capturing subpattern. Unfortunately, there is one remaining problem; the third "the" on line 3...

    HighCharts Bubble Chart: text for axis interval labels

    highcharts

    Without seeing your chart code, it's not easy to say the best way to solve this. The first option I would look at is using x-axis categories. An alternative option may be to do this using the axis labelformatter function (http://api.highcharts.com/highcharts#xAxis.labels.formatter). For your case, you could do something like: function()...

    C# Copy bitmap's pixels in the alpha channel on another bitmap

    c#,image,bitmap

    This is not using LockBits yet, but it'll be good enough to see if it'll get you want you want: public Bitmap getGrayOverlay(Bitmap bmpColor, Bitmap bmpGray) { Size s1 = bmpColor.Size; Size s2 = bmpGray.Size; if (s1 != s2) return null; Bitmap bmpResult= new Bitmap(s1.Width, s1.Height); for (int y =...

    Name of class property to string

    c#,string,properties

    You can use reflection to get the name, here is a helper class I use: public static class MemberName { /// <summary> /// *** WARNING - Uses reflection - use responsibly *** /// </summary> /// <param name="instance"></param> /// <param name="expression"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static string GetMemberName<T>(this T...

    Averaging Count For Unique Dates Separately

    mysql,date,count,average

    So you want the average number of entries per person, per day... yes? In other words the total number of entries divided by the total number of people making those entries, right? = # entries / # people making those entries Yes? If so, the following should do the trick:...

    Tire - query with conditional/custom _score

    ruby-on-rails,elasticsearch,tire

    Look http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-min-score.html from min_score and in tire search you could use Tire::Search::Search.new index_name do query your_query min_score 0.5 end ...

    Double quotes inside html from no where displaying white space

    php,html

    ───→</div>↲ ───→<div class="col-md-4">... With ↲ being a new line, and ───→ being a tab. You have space! The "quotes" you see are the DOM inspector saying "here's a text node", they're not in the source. All that's in your source, is the whitespace that you put there. Try: </div><div class="col-md-4">......

    AngularJS Applying model to dynamic form elements

    angularjs,angularjs-directive

    You can use the following as template: template: '<div ng-repeat="element in form">' + '<input type="text" ng-model="person[element.name]"></div>' Fiddle: http://jsfiddle.net/g5Mzs/ Essentially the name field is used to define the index inside the person object....

    How to use .slice in mongoose

    node.js,mongodb,mongoose

    ... Score.find({ match: {$in: ids}} ) .sort([[score_sort, 'descending']]) .skip(skip) .limit(limit) .exec(function(err, scores) { if (err || !scores) { throw err; } else { // do something cool } }); ...

    Ruby how to delete arrays if they have matching element?

    ruby

    Array#uniq seems to work: [[4, 50], [2, 28], [1, 4], [4, 41], [1, 9], [2, 25]].uniq(&:first) #=> [[4, 50], [2, 28], [1, 4]] ...

    Trying to understand Ext.require, Ext.class.requires, and Ext.Loader

    extjs,extjs4,extjs-mvc

    In the above code you only need controllers:['Controller']. In turn, in the controller file you need views:[], stores:[] and models:[] depending on what you want the controller to pull from the server. Another example: Let's say you code a grid and it uses number column, so you need requires:['Ext.grid.column.Number' in...

    Handle Stripe Errors in the model

    ruby-on-rails,ruby,ruby-on-rails-4,stripe-payments

    You can do this, assuming save_with_payment is a callback (before_create or before_save I'd assume) def save_with_payment customer = Stripe::Customer.create( :email => email, :card => stripe_token ) charge = Stripe::Charge.create( :customer => customer.id, :amount => donation_amount, :description => 'Rails Stripe customer', :currency => 'usd' ) rescue Stripe::error => e errors[:base] <<...

    How do you call an OSGi application from a non-OSGi application, and vice versa

    osgi

    It sounds like you want to embed OSGi into a larger application. A good starting point for this is a blog post I wrote some time ago: http://njbartlett.name/2011/07/03/embedding-osgi.html The trick to creating visibility between OSGi bundles and the objects "outside" OSGi is to publish and/or consume services using the system...

    Laravel DB Seeding not autoloading Model classes

    php,laravel,vagrant,composer-php

    <?php namespace App\Models; class Song extends \Eloquent { If you want your song model in the global namespace, then don't put it in a namespace. Otherwise you'll have to use App\Models\Song; in order to load it. Once you do that, it should work for your Seeder. If you then need...

    handlerbar js extending arithmetic addition helper

    javascript,handlebars.js,helper

    This should be what you're looking for Handlebars.registerHelper("total", function(a,b) { var nums = [].slice.call(arguments,0,-1); var sum = nums.reduce(function(prev,next) { return prev + Number(next.replace(/[^0-9\.]+/g, "")); },0); return "$" + sum.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); }); You can test this in tryhandlebarsjs with the following context and template { "a": "10", "b": "20", "c": "30",...

    Chrome displays dd/mm/yyyy in default calendar - instead of actual date within the model

    asp.net,asp.net-mvc,asp.net-mvc-3,google-chrome

    It's not a "known problem" per se, just an issue with how the HTML5 date control works. Date inputs are expected in ISO 8601 format, which for a date would be YYYY-MM-DD. The format you see, dd/mm/yyyy is localized to make it easier for the user to input the date,...

    Scraping web page using BeautifulSoup Python

    python,html,web-scraping,html-parsing,beautifulsoup

    You can use replace_with() to replace every br tag with a new-line: def extract(soup): table = soup.find("table", attrs={'id':'ctl00_TemplateBody_WebPartManager1_gwpste_container_SearchForm_ciSearchForm_RTable'}) for br in table.find_all('br'): br.replace_with('\n') return table.get_text().strip() For the HTML input you've provided it prints: A Southern RV, Inc. 1642 E New York Ave Deland, FL Phone: (386) 734-5678 Website: www.southernrvrentals.com Email:...

    Multiple Login Forms On One Page

    javascript,jquery,html,forms,login

    As others have said this storing username and password combos in your JavaScript source is a bad idea. But I'd like to show you how you can use arrays to store Key -> Value pairs and reference them to reduce the amount of code duplication. In JavaScript you can define...

    Pass Angular html template to backbone template

    angularjs,templates,backbone.js,typescript,marionette

    Marionette expects all templates to be immediately available, not having to be fetched async. The view.template function can be easily overwritten but it needs to immediately return a string (or return a function that will immediately return a string). There was an old fork called Marionette.Async which enabled fetching of...

    Trouble returning the affected rows on batch insert using SQLSRV

    php,codeigniter-2,sqlsrv

    So after looking around I found the oversight in the insert_batch and update_batch functions in Codeigniter. Because the inserts and updates are changed in 100 rows at a time the affected_rows function only sees the last ($rows%100) rows as that would be the last insert/update done. The solution I found...

    Get transaction details in real time, Paypal

    api,paypal

    You should look at either IPN or Express Checkout. If you are using web standard payments it is important to note that a customer does not have to return to your page, once they hit pay on the Paypal site - the transaction is complete. Hence relying on them to...

    Error when calling Oracle stored procedure

    sql,oracle,stored-procedures

    The RAW variable declaration needs a size. DECLARE theID RAW(32); OtherSystemOrderId VARCHAR2 (60 CHAR) := 'ORDERNR1000'; BEGIN GetID(OtherSystemOrderId, theID); dbms_output.put_line('unid is ' || theID); END; anonymous block completed unid is 3F66DF77FC234C7B887A18F33C174A6A...

    Layout selection on app launch

    android

    Using Fragments would probably the best solution, because like this, you don't have to start another Activity from your starting Activity. In your MainActivity, just define a layout that contains a Fragment placeholder. On start, if the shared preference is set, show Fragment1, if not, show Fragment2. Layout of the...

    WPF ListBox using ItemsSource and ItemTemplate

    c#,wpf,binding,listbox

    You need to use a data template for the ItemTemplate. This is then applied to each item in the list MSDN docs are here: http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemtemplate(v=vs.110).aspx The issue her is about data context scope. When you bind any property on the ListBox, it will use the data context of the ListBox...

    Angular JS - Key Binding on Directive Calls Function But Doesn't Affect Ng-Show State

    angularjs,angularjs-directive

    Plunker Here Wrap your 'keyup' handler in an $apply. When you bind to jQuery events, you can call $apply to let angular know to trigger a $digest cycle. myApp.directive("closeIt", function(){ return{ restrict: "A", link: function(scope, element, attrs){ element.bind("keyup", function(event){ scope.$apply(function() { if(event.which == 27){ console.log("escape has been pressed"); scope.changeFlag(); }...

    Objective-C - Date format not recognized by device

    ios,objective-c,nsdate,nsdateformatter

    There a two issues with your code, HH is for 24 hour dates and you should tell the formatter which language the date is going to be in: NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]; [dateFormat setDateFormat:@"MMM dd, yyyy hh:mm:ss a"]; NSDate * dataStringFormatted = [dateFormat dateFromString:...

    Avoiding timeouts in Angular applications

    angularjs

    I believe this is because the angular $digest cycle is happening just once here. Using the $timeout, forces the second part of what you do into a second digest cycle, which is why it works with the $timeout. You can't just call $scope.$apply() because you are already in a digest...

    IBM SBT: Updating a subcommunity breaks subcommunity relation?

    ibmsbt,ibm-connections

    IBM SBT SDK 1.1.0 of Jul 17, 2014, seems to be out. At least it is available in Maven central. This is the better answer of course but will require several code adjustments if you have built code on top of internal structures due to some internal refactorings....

    ModelMultipleChoiceField returns “name Object”

    html,django

    Define __unicode__ method in Instrumentation model for human-readable representation of the model object: class Instrumentation(models.Model): code = models.CharField(max_length=70, unique=True) marca = models.CharField(max_length=70) modelo = models.CharField(max_length=70) familia = models.CharField(max_length=150) subfamilia = models.CharField(max_length=150) calibration_date = models.DateField() #test = models.ForeignKey(Test) notes = models.TextField(max_length=170, blank=True) utilization = models.DateField(blank=True) def...

    How Android HTTP cache is working?

    android,caching,picasso

    Answers are below. 1) How Android knows to cache or not to cache a file, and for how long? The HttpResponseCache caches an HTTP or HTTPS response if all of the following is true It was installed via HttpResponseCache.install() setUseCaches(true)was called on the HttpURLConnection or HttpsURLConnection The headers returned by...

    How to use uniform initialization for a pointer?

    c++,initialization

    You can't take an address of a temporary "directly"... You can't take an address of a temporary with &: g(&({1, 3.14})); as per: §5.3.1/3 The result of the unary & operator is a pointer to its operand. The operand shall be an lvalue or a qualified-id. (emphasis mine) ... but...

    select2: swapping between text and value in multiple select2

    javascript,jquery,jquery-select2

    You can just use the plug in as is and use the formatSelection option and give a function such as formatSelection: function(item) { return item.id } here's a fiddle forked from someone's multiselect select2 fiddle http://jsfiddle.net/ba98G/...

    Android Studio OnInfoWindowClickListener not working

    android,map,android-studio

    Did you add this code: public class MapsActivity extends MapActivity { public void onCreate(Bundle savedInstanceState) { ... setUpMap(); } private void setUpMap() { float blue = BitmapDescriptorFactory.HUE_AZURE; float red = BitmapDescriptorFactory.HUE_RED; mMap.addMarker(new MarkerOptions() .position(new LatLng(-26.055984, 28.084833)) .title("pick me") .icon(BitmapDescriptorFactory.defaultMarker(blue)) ); mMap.addMarker(new MarkerOptions() .position(new LatLng(-26.058394, 28.078792)) .title("Hello World")...

    Spring MVC REST JSON jQuery dynamic parameters for jpa query

    java,jquery,json,spring,jpa

    I tried with this example and it worked for me. The json look now like this: contract = {fromDate:moment($('#datepickerVon').val(), 'DD-MM-YYYY').format('DD-MM-YYYY'), endDate:moment($('#datepickerVon').val(), 'DD-MM-YYYY').format('DD-MM-YYYY'), Season: { season: "SO14"}, name: {name: "peter"}, category:{category:"SomeString"}}; console.log(contract); $.ajax({ url:'/contracts/search/', dataType: "json", type: "POST", mimeType: 'application/json', contentType: "application/json", data: JSON.stringify(contract), success: function(data) {...

    FirstBaseline of NSLayoutAttribute, what does it mean?

    swift

    It's mentioned in some of the WWDC sessions (what's new in table and collection views, I think). There are now two baseline attributes for multiline labels, so you can pin to the first and last lines.

    Swift optional Array property is immutable?

    arrays,swift,immutability,optional

    For the sake of having my code on SO rather than Pastebin, here's my observation. This looks like some kind of bug or unexpected behaviour when using an optional array in a Swift class derived from an Objective C class. If you use a plain Swift class, this works as...

    How to Build Software

    Getting started tutorials how to be a good programmer, develop software with:

    wmv , solr-schema , actionpack , sybase-ase15 , android-cardview , design-view , logon-failed , robolectric-gradle-plugin , pymol , matrix-multiplication , simctl , private-messaging , fat32 , system-rules , passphrase , progressmonitor , avatar , dynamic-arrays , ocaml-lwt , mason , spatstat , scaleout-hserver , wkinterfacebutton , draw2d , bounded-types , database-cluster , jmeter-plugins , malformed , data-fitting , fault-tolerance , ebay-lms , accelerator , custom-cell , deletion , palette , remote-access , webpartpage , wizard , dynamicform , android-gridlayout , test-data , arc4random , grails-validation , nsworkspace , unidac , geotools , units-of-measurement , mytoolkit , .bash-profile , jquery-data , rails-routing , poptoviewcontroller , file-icons , xmlnode , alice-fixtures , unobtrusive-javascript , android-preferences , ivar , chess , views , va-list , drools-guvnor , nested-generics , netduino , orbeon , bits , ownership , pointcuts , google-webmaster-tools , nodemailer , referenceerror , the-little-schemer , inform7 , physx , freopen , vimgrep , context-injection , linuxmint , binding.pry , custom-exceptions , beam , core-api , sanitize , iscroll , vram , managedobjectcontext , httplib2 , blendability , flying-saucer , failure-slice , interprocess , statusbar , aspxcombobox , keynote , specs , variant , php-closures , uibezierpath , html5-notifications , volatility , weighted-average , acts-as-ferret , scanning , nvda , chef-zero , completion , cdialog , naming-conventions , cocoalibspotify-2.0 , phalcon , xmllite , nsmutablearray , bold , tying-the-knot , dnvm , no-match , spark-cassandra-connector , packets , babylonjs , defaultlistmodel , webmail , ironpython , shapely , browser-refresh , sparql , computed-observable , exists , java-time , sparqlwrapper , clickatell , xap , google-spreadsheet-addons , dialogviewcontroller , cordova-4 , django-auth-ldap , cocoon , pdo , android-progressbar , mkmapview , floating-point-precision , simplemodal , keyword-search , angular-http-interceptors , xcode4.5 , anchorpoint , qbxml , bufferedreader , rewriting , parsley , java-5 , scjp , image-manipulation , treeline , cardslib , wxnotebook , tagged-corpus , azure-cli , predicates , ivyde , apprtcdemo , freebsd , sorl-thumbnail , mean , spatial-data-frame , cgi-bin , apache-tiles , neo4j-spatial , delete-operator , tfsintegrationplatform , accumulo , craigslist , unwind-segue , primes , darken , rowname , h5py , flyweight-pattern , octave , benchmarking , illegalaccessexception , wine , varray , stoppropagation , getelementsbyclassname , zend-navigation , deletable , makemaker , doc , icommand , ejdb , message-listener , jquery-focusout , .profile , sitecore7.1 , logfiles , mpj-express , mouselistener , pkcs#8 , github-for-windows , indexed-view , httpexception , ractivejs , web-scraping , nodeunit , overhead , ipad , gwt-rpc , assistant , akka-supervision , nhibernate-envers , cublas , time , datetimepicker , system32 , pivotaltracker , rails.vim , bank-conflict , custom-wordpress-pages , dead-key , scalikejdbc , pydoc , joi , stereoscopy , setbackground , hoverintent , populate , django-login , dry , fsyacc , jqgrid-formatter , django-authentication , maven-jetty-plugin , google-maps-sdk-ios , stl , lzo , endpointbehavior , pick , psr-4 , ordered-test , synedit , dbpedia , zfs , openindiana , plagiarism-detection , speclj , spannable , aif , oauth-2.0 , traminer , vcard , jqgrid-php , http-status-code-406 , wordpress-plugin-dev , neural-network , geoxml3 , android-elevation , bonecp , dart-js-interop , contao , phonertc , mediator , dynamic-compilation , xmla , video-watermarking , caemitterlayer , dev-c++ , grammar , elevated-privileges , phantomcss , wifimanager , pyvirtualdisplay , chatbot , hivemq , mobile-chrome , obfuscation , akamai , sdl-2 , shoulda , jquery-cycle2 , caliburn , pthread-barriers , phong , jsonresponse , adobe-reader , android-json , networkcredentials , browser-testing , genexus-sd , wpfdatagrid , moped , resignfirstresponder , toolbar , codehighlighter , stackato , kiosk , subscriptions , body-parser , marching-cubes , teamviewer , magento-1.7 , voice-recognition , c-libraries , linux-kernel , attributeerror , reference-class , color-mapping , addressing , jrebel , php-curl , part-of-speech , wheel , build-agent , supercomputers , active , virtualenvwrapper , artificial-intelligence , compliance , gas , beizer , identity-operator , data-extraction , android-custom-view , strict-mode , prolog-assert , cpu-cores , eclipse-marketplace , custom-action-filter , facebook-audience-network , pagination , usart , modulus , client-certificates , clear-cache , short , javaplot , southeast-asian-languages , dsquery , mainwindow , ace-editor , dictionary-comprehension , directoryindex , storage-engines , key-bindings , workflowservice , mercurial-queue , refs , print-spooler-api , excel-vba , weblogic11g , rfc2445 , pasting , httpverbs , radio-group , uint32-t , prime-ui , sizer , rawcontactid , chm , fql.multiquery , jericho-html-parser , phantom-types , google-cloud-logging , git-fork , mongodb-mms , paraview , pryr , alivepdf , jstack , ipython-notebook , librarian , moving-average , lm , file-io-permissions , fastreport , dsml , wikidata , phone , cglib , testfairy , ocanvas , noop , swift-array , checked-exceptions , gwt-maven-plugin , cakephp-2.5 , keychain , resizable , biztalk-2013 , custom-search-provider , nscountedset , child-actions , widget , twilio-click-to-call , load-balancing , database-table , hottowel , mount-point , python-idle , mousewheel , heroku , gwt , rainbowtable , flux , apache-wink , avatars , musicxml , revit-api , freeimage , pyqt4 , custom-lists , activity-indicator , rar , haste , undefined , vpc , delete-file , reindex , varchar , c4.5 , autoprefixer , bufferedimage , pfquerytableviewcontrolle , turn , ruby-1.8.7 , synthesis , bing-search , abstract-type , axiom , qt3d , javasound , cpu-speed , nslog , capifony , street-address , webproxy , nape , idris , swingbuilder , task-manager , heritrix , batch-file , .post , rrd , actionmethod , image-capture , ar , caucho , xcode6-beta7 , slick.js , ion , uiview , file-management , finalizer , froala , angularjs-ui-utils , pre-increment , j2mepolish , microsoft-fakes , discourse , messageformat , persistent-connection , beanstalkd , gulp-preprocess , exp , stringstream , datatables , docblocks , ws-federation , fltk , jq , fiware-wirecloud , remote-control , django-allauth , bootstrap-wysihtml5 , nosuchelementexception , readable , active-model-serializers , clockkit , futuretask , saga , whmcs , nomachine , uglifier , ptrdiff-t , eclemma , capability , jssor , libpcap , opengl-es-3.1 , flexmock , materializecss , database-metadata , interruptions , git-annex , dce , thickness , inversion-of-control , il , iptc , graph-databases , roman-numerals , optaplanner , csr , preprocessor , sys-refcursor , zebra-printers , affiliate , pdfclown , levels , sybase , jslink , telerik-appbuilder , sunone , mahout-recommender , aes-ni , lwp , semantic-zoom , google-play-games , mysqldump , non-member-functions , heredoc , fallback , browser-detection , nserror , lambda-calculus , console2 , bridj , web-inf , bcp , user-management , explain-plan , statements , jquery-mobile-panel , rrdtool , dancer , ifconfig , g1gc , audio-fingerprinting , location-services , client-server , gp , cmake-gui , inputstream , apache-commons-io , rounding , apple-id , repast-simphony , tree-balancing , firebird , epub , distance , jcache , bin-packing , om , pos-tagger , abstract-factory-pattern , bass , ffi , parent-node , httparty , strophe , pivot , findwindow , xlsread , triplet , google-cse , jpa , pants , typesafe-activator , xilinx-edk , ply , stormpath , bitmap-fonts , qdbus , table , processwire , axis , pull , angularjs-1.2 , java-war , import , helpers , .net-4.0 , js-cookie , stage , diagramming , mvvm , unicode , gembox-spreadsheet , business-layer , tcpserver , mechanicalturk , redismqserver , reply , approval , .obj , backbone-views , jest , network-programming , oracle-rac , jsonschema2pojo , superview , jquery-autocomplete , nearlyfreespeech , filereader , textmate2 , swingworker , canjs , teamwork , sitemapprovider , audio-capture , system-verilog , kendo-datepicker , openscad , fileobserver , xmlns , blockui , ctrlp , object-initializers , mknetworkkit , ora-00947 , artisan-migrate , contactscontract , ion-koush , picturecallback , qframe , nl2br , kendo-grid , step-into , vs-community-edition , sequence-alignment , mirror , model-driven , indexer , mapdb , appdata , compiler-bug , subdomain , snowflake-schema , nsbezierpath , python-dateutil , django-haystack , aws-elastictranscoder , cereal , state , model-view , multilabel-classification , mtp , crystal-reports-server , adddays , uint32 , runspace , neat , js-routes , apache2 , joblib , xattribute , skydrive , requirejs-define , timing , accent-insensitive , grub , app-store , smoothing , x509certificate , excel-udf , javaw , nominatim , while-loop , sha2 , libressl , controller-factory , skype4com , addclass , teamcity-7.1 , non-type , relative-date , webautomation , vsct , opl , livereload , angle , intervention , thin , scaldi , jsmovie , suppress-warnings , queue , swifty-json , directadmin , django-file-upload , azure-data-factory , audiotrack , hardware , gobject-introspection , ng-grid , biginsights , presentation-model , pushbullet , tv , shunting-yard , git-clone , createwindow , swashbuckle , graph-theory , xmlbeans , nanoc , printdocument , buildconfiguration , susy-compass , jekejeke , qtnetwork , physijs , icinga , cumsum , gtk , callout , nm , mybatis , libmosquitto , blockingqueue , gecko , templatebinding , sakai , bearer-token , automoq , hierarchyid , cocoapods , nsnotificationcenter , bitwise-operators , tastypie , ado.net-entity-data-model , kinect-sdk , fuseesb , qtserialport , http-error , redactor , always-on-top , moment-recur , my.cnf , asp.net-2.0 , controlfile , symmetry , c++-amp , mql4 , nzsql , nsdatepicker , openpgp , binarywriter , template-matching , border-layout , middleware , algebraic-data-types , bitrate , reporting-tools , unexpectendoffile , annyang , beatsmusic , webots , sin , vmware-sdk , cvx , row-removal , text-classification , key-value-observing , core-location , ios8.1 , rpm-spec , typo3-6.2.x , image-zoom , phpstorm , google-reseller-api , liferay-6.2 , appdelegate , transformer , ckeditor4.x , cleartimeout , enlive , jvm-hotspot , stringwriter , rune , setting , enterprise-library-5 , dwmapi , database-tuning-advisor , pixel-density , arrayref , chrome-gcm , sugarbean , kendo-editor , multicastsocket , custom-validators , ssi , soapfault , jasmine2.0 , ninject-2 , linkedin , rc , cdc , compiler-specific , auto-update , forwarding-reference , hashable , custom-events , contentplaceholder , d3.geo , bytearrayinputstream , type-safety , httpwebrequest , jol , glutcreatewindow , azure-machine-learning , selectedindexchanged , windows-10-mobile , ucs2 , qt-signals , emgu , hsv , martini , canvasjs , search-tree , autofilter , libxslt , custom-adapter , mailcore , proxy-object , plugins , adaptive-design , opengl-es , jinternalframe , html-escape , capybara , createuser , array-unset , const-correctness , directed-acyclic-graphs , connectivity , starling-framework , termination , stacked , tfs2015 , linqpad , spritebatch , jquery-draggable , qualtrics , tinyalsa , read-data , jtableheader , cross-browser , asprepeater , member-function , spring-security-test , werkzeug , soffice , move , ignore , indy-9 , box-view-api , manova , jqlite , modelattribute , html-sanitizing , popen , sql-server-2005 , google-datalayer , invalidation , pdflib , qmenubar , tetgen , google-fusion-tables , cryptojs , migrating , google-http-java-client , svd , groovysh , knapsack-problem , vr , cloudhub , python-multiprocessing , arabic , system.exit , rails-api , bazaar , whoops , pyyaml , toolstrip , ppapi , combinations , callermembername , generic-variance , xcode-server , magento-1.5 , spid , hidden-files , fragment-lifecycle , boost-test , documentfilter , intellij-idea , bleu , realurl , type-constraints , m2crypto , universal-storyboard , liquid-layout , f#-async , java-web-start , funq , better-errors-gem , hortonworks , simplify , weasyprint , tds , arcgis-server , confluence-rest-api , jexl , token , doxygen-wizard , cxfrs , packaged-task , renderer , app-engine-ndb , autofixture , isr , unmarshalling , embedded-fonts , typeahead.js , toeplitz , elasticsearch-net , docsplit , resolution-independence , outputstream , chef , visual-studio-addins , spaces , application-layer , ios8-today-widget , zikula , zero , swc , x3dom , language-concepts , iana , ambiguity , select , failed-installation , vmware-fusion , porter-stemmer , custom-linq-providers , flask-restless , permalinks , gulp-wrap , spring-data-rest , xqj , storing-data , mpi , countdown , google-contacts , watir-webdriver , typoscript2 , make-shared , odbc , autobahnws , ravendb-http , minitab , delphi-xe8 , express-session , null-coalescing , shopware , sceditor , mobile-application , pagertitlestrip , samtools , notify , themoviedb-api , formats , pin-code , cprofile , rjson , webmethods , parsing-error , actionmode , ibm-db2 , define-syntax , texinfo , db2-luw , form-post , qeventloop , jaxl , custom-formatting , atmelstudio , deserialization , uisearchcontroller , qtxml , outlook-2013 , ui4j , pgf , azure-web-sites , wse3.0 , view-helpers , vtd-xml ,