FAQ Database Discussion Community


Varchar to Numeric Conversion

sql-server-2008-r2
I have loaded the excel data into a table using SSIS. Table Structure : Monthly_Budget SEQUENCE INT IDENTITY, TRANSACTION_DATE VARCHAR(100), TRANSACTION_REMARKS VARCHAR(1000), WITHDRAWL_AMOUNT VARCHAR(100), DEPOSIT_AMOUNT VARCHAR(100), BALANCE_AMOUNT VARCHAR(100) Values in WITHDRAWL_AMOUNT Column: 7,987.00 1,500.00 7,000.00 50.00 NULL 253.00 4,700.00 2,000.00 148.00 2,000.00 64.00 1,081.00 2,000.00 NULL NULL 7,000.00 Now, I...

music playing script 12 errors

java
This is the part i think i am having the trouble on: public class AudioPlayer { //play the music AudioPlayer AP = new AudioPlayer([Optional Replay = true]); AP.playSong(signlink.findcachedir() + "Music/2.wav"); //stop the music AP.Stop(); } Here's the error that I got: AudioPlayer.java:3: error: ')' expected AudioPlayer AP = new AudioPlayer(optional...

Is it possible to aggregate efficiently by quartile in mongodb?

mongodb,mapreduce,mongodb-query,aggregation-framework
For example suppose I have 10,000 sorted documents that I want to aggregate() on. But I'd like to group them into quartiles: top 25%, 25% - 50%, 50% - 75%, bottom 25%. Is there a way to this in one pipeline versus having to do 4 separate pipelines for each...

Where does Sitecore stores the security restrictions for an item for each user roles?

sitecore,sitecore6,sitecore7
I need to know if a user with a specific role has access to a specific item by just using the Sitecore database tables without using Sitecore API. So my question is in which table and in which column is it stored?

DOM manipulation not working with ng-view

javascript,jquery,html,angularjs,dom
There is too much code to past in here so please forgive me. I have a basic application which has a single module, controller and ng-view/routProvider. Within my controller if I perform the following, console.log(angular.element('div').length) the console spits out that I have 10 DIV elements. This is correct. However when...

Is increment/decrement operators Undefined Behaviour in Bash?

c,linux,bash,posix,post-increment
In standards C99 and C11 an expression like the following is U.B. (Undefined Behaviour): int x = 2; int ans = x++ + x++; In Bash the increment/decrement operators are defined and the official document in gnu.org says that the conventions of standard C are followed. In addition, Bash is...

Reading in datetime pandas without having to convert

python,datetime,pandas
I have a very big file, and I want to know if it is possible to read in a CSV (which had a datetime column when it was written) so that the datetime column reads in as a datetime, not a string. The problem is that it takes about 4...

Serializing Python Arrow objects for the Flask-Restless API

python,json,serialization,flask-restless
I am currently developing an application with Flask-Restless. When I substituted my SQLAlchemy models' typical DateTime fields with corresponding arrow fields, all went smoothly. This was due to the help of SQLAlchemy-Utils and its ArrowType field. However, after using the API to return a JSON representation of these objects, I...

Bash input without pausing the script?

bash,input
In Bash the only way to get a (user) input seems to be to use the read method, which pauses the rest of the script. Is there any way to receive a command line input (ending with the enter key) without pausing the script. From what I've seen there may...

Disable hamburger to arrow animation

android,android-actionbar,navigation-drawer,android-5.0-lollipop,android-support-library
I am trying to implement a two-drawer layout with the android v7 support library. I have a navigation drawer on the left (Gravity.START) side and a notification drawer on the right (Gravity.END) side. The problem is that I need the hamburger in the action bar to stay a hamburger when...

Angular attribute expression not evaluating inside directive

angularjs,angularjs-directive
Why does the link evaluate the expression inside the directive using the link attribute, but the template does not? Note that I'm only using 'link' here for console.log illustrative purposes. My end goal is to have data passed into a directive via its attribute and have that data render as...

Deployment Targets for my app

ios,ios7
I am planning to launch my app soon and it should support iOS 7+ Based on this, should my iOS deployment target setting and deployment target be for 7.0? Also why are there two settings available (one is for the project itself, one is for the target). Does the project...

Vim plugin for Opening most recently edited files

vim,vim-plugin
I'm trying to find a vim plugin that restores the most recently edited files in a directory. It's similar to this plugin, but this is the functionality that I'm trying to define. Suppose I have a directory X with these three files: hello.cpp, main.cpp, Makefile Say I'd open them up...

Swift error: “cannot invoke >= with argument of list type (@lvalue CGPoint, CGPoint)”?

swift,xcode6
I am trying to write an if statement saying if block1's position exceeds a certain point, have this happen to block3 . However when I try to compare using >= I get the error:"cannot invoke >= with argument of list type (@lvalue CGPoint, CGPoint)" Here is the code: if block1.position...

Copying set of records in Django

django,database
How do I copy the data from one record to another? That is, I have the record pk: 1, name: "Regis" total: "1000.00" I wanted to create a new exactly the same record. pk: 2, name: "Regis" total: "1000.00" ...

c also has const values but they cannot be used as array bounds?

c
In book "The Practice of Programming By Brian W. Kernighan, Rob Pike", Page 21, the buttom of expert "Define numbers as constants, not macros", he says "C also has const values but they connot be used as array bounds, so the enum statement remains the method of choice in C....

get return value of command run with script -c

linux,bash
Is there a way to capture the return value of a program run using script -c? For example (in bash) /bin/false; echo $? # outputs 1 /usr/bin/script -c "/bin/false" /dev/null; echo $? # outputs 0 as script exited successfully. I need to get the return value from /bin/false instead of...

Can I NOT send a HTTP 404 error on a 404 page?

php,.htaccess,get,http-status-code-404,server
So basically I have my website and I'm trying to make it compatible with everything. You go to the page: /Page_Name But the page Page_Name does not exist but the 404 page is what handles the the request. I'm almost using it as a PHP GET command. Web browsers work,...

Use number of misclassificatios as objective function for back propagation

machine-learning,classification,backpropagation
I'm new to machine learning (neutral network) and I have a question, please help me explain. In back propagation, the objective function to be minimized is usually a sum of the squared error between the output and the target. However, in classification problems, the goal is often to minimize the...

Why mybatis force prints log4j DEBUG info to the console

java,spring,log4j,mybatis
I've already configured mybatis to use log4j for logging. And I configured log4j to only print warning info. But when I run it, mybatis prints lots of sql debug messages to the console: <http-bio-80-exec-1 10:08:54,969> <org.apache.ibatis.logging.jdbc.BaseJdbcLogger:139> DEBUG - ==> Preparing: select count(*) from accounts <http-bio-80-exec-1 10:08:54,993> <org.apache.ibatis.logging.jdbc.BaseJdbcLogger:139> DEBUG - ==>...

How to use Reflection to inspect non-static fields of a class that is loaded with a different ClassLoader?

java,reflection,classloader,google-reflections
I am using a child URLClassLoader to load an android.jar that can be found in the Android SDK (sdk/platforms/) at runtime, then I use the Google Reflections library to inspect the new classes I loaded. However, it seems that with the following code, I can only inspect static fields; I...

Class method in enhanced for loop

java,class,for-loop,methods,foreach
I need to draw my buttons in the screen, but when using the for loop enhanced, public void update(){ for(Button bt: button){ bt.update(); } } an error is pointed in the 3rd line (code box above). I don't know what is wrong, neither an alternative way to update/draw the buttons....

binascii.unhexlify working differently in Python 3.2 and Python3.4?

python,python-3.x
I used to work on Linux Mint, and the latest version of Python 3 embedded in it is Python 3.4. My program takes a hex string as input, decodes it and creates a bytearray so I can decode several information using struct.unpack. For example: hex_str = "00000E0C180E180FEABF070030313564336332363338303431653039004A62004A62006A62406A622E636F6D00" s = binascii.unhexlify(hex_str)...

Can Scala projects be compiled into web application

scala,scala-2.10
I'm new to Scala but I do know JAVA. Can Scala projects be compiled into web apps and deployed to Webservers like JAVA? Thanks!...

sql select orders not containing certain items

mysql,sql
The database has 3 tables, "items", "orders" and "orderitems" which represent an N:N relation. I need to find the orders that doesn't contain certain items. For example, I want to get all the orders that doesn't include apples, oranges, or bananas. I've tried: SELECT * FROM orders o, LEFT JOIN...

Could not find 'berkshelf' (>= 0) among 90 total gem(s) (Gem::LoadError)

ruby-on-rails,vagrant,chef,rbenv
I am having issues when setting up Chef and Vagrant for my rails app. When I try: $ vagrant up I get the error: Bringing machine 'default' up with 'virtualbox' provider... The following berks command failed to execute: /Users/user/.chefdk/gem/ruby/2.1.0/bin/berks --version --format json The stdout and stderr are shown below: stdout:...

Simplifying code for Message box were file name is built from File.WriteAllText

c#
I have the this code that I would like to simplify File.WriteAllText( Path.Combine(dir, DateTime.Now.ToString("dd-MM-yyyy_hh-mm-ss") + "-" + messageType + "-" + messageGateway + ".csv"), messageBody); MessageBox.Show(Strings.AllActionLogViewModel_ExportMessageContentToCsv_Saved_Log_File + " " + DateTime.Now.ToString("dd-MM-yyyy_hh-mm-ss") + "-" + messageType + "-" + messageGateway + " " + "to " + dir);} As you can...

Flushing Rails template output

ruby-on-rails,performance,templates,flush,ruby-on-rails-4.1
I'm finding Rails waits until the entire view has been calculated on the server before it initiates the response and dumps everything at once. Ideally the page should be populated incrementally as the server is working. To check this, I made a fresh Rails (4.1) project, generated a dummy resource,...

Python Matlab Engine Install

python,matlab
Ive been trying to install matlab engine for python so I can call matlab functions from within my python scripts. The guide Im using is this one: http://uk.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html It says the setup.py file is located in matlabroot\extern\engines\python, however, my extern folder does not contain an engines folder (only examples, include,...

Setting ListView Property FocusedItem to “Nothing” in VB.Net

vb.net,listview
This Sub is supposed to remove the row of data (Items and subItems) at the "Selected/Focused" ListView index. It works but, after the selected row is removed, the Focus remains on the index of the row that was just Deleted. Now the curent focused index contains a new row of...

way to convert char array to a hex string and print it in one line

c
Here is a char array char temp[] ={0x1f,0x2d,0x3c}; i want use the __android_log_print to print the temp ,how can convert it to "1f2d3c" and print it in one line without a for loop? What i expected Reality ...

Executeing a method in Handheld class from Wear Module Android

java,android,android-wear,android-wear-data-api
Let's say I have a Method in MainActivity called Emergencyalert(), what it dose is, it sends some alert message to some selected contacts. So I wanted a wear app which dose nothing but just execute the Emergencyalert() Method in Handheld Device, When the user click on a Emergency button in...

CKEDITOR.editor.on not working with replaceAll

javascript,ckeditor
I'm trying to capture an event from a plugin: $(document).ready(function( ) { CKEDITOR.replaceAll( 'js-ckeditor' ); CKEDITOR.editor.on('simpleuploads.startUpload', function (ev) { console.log(ev.data) }); }); ...but when I run it, I see the error TypeError: CKEDITOR.editor.on is not a function. What am I doing wrong here? According to the documentation editor should have...

Language with separate get/set publicity

programming-languages
I've been writing a personal project, and keep coming across cases where a field needs to be publicly readable, but shouldn't be publicly writable. As far as I know, the accepted "good practice" in these cases is to make the field private, write a vanilla getter, and let that be...

Spark - How to use mllib.recommendation if the user ids are string instead of contiguous integers?

apache-spark,recommendation-engine,mllib
I want to use Spark's mllib.recommendation library to build a prototype recommender system. However, the format of the user data I have is something of the following format: AB123XY45678 CD234WZ12345 EF345OOO1234 GH456XY98765 .... If I want to use the mllib.recommendation library, according to the API of the Rating class, the...

Getting UnsuportedClassVersionError when trying to load servlet on tomcat running on debian

java,tomcat,debian
I'm developing and testing my project on a windows machine with tomcat 7.0 and compiling in compliance with JDK 1.7. This works fine. Trouble starts when I try to deploy the .war file on a Debian machine, again with tomcat 7.0. I'm getting the following error when I try to...

Android Sudio does not notice I changed AndroidManifest

android,android-studio,android-manifest
After importing my Eclipse project I got error Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library W:\android-studio-projects\example\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\6.5.87\AndroidManifest.xml Suggestion: use tools:overrideLibrary="com.google.android.gms" to force usage I think and change my code AndroidManifest.xml to <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17"...

Chef knife command not showing ssl subcommands

ruby,ssl,chef,knife
There is no knife ssl ... subcommand. It seems indicated that it's part and parcel of a ChefDK + knife distro but I'm unsure why it's not available. What should I do to get the ssl subcommands available to knife? chef-client -version Chef: 11.6.2 $ knife ... ** SEARCH COMMANDS...

how to disable responsiveness on bootstrap?

twitter-bootstrap
I am doing a project for my school where i have to make it responsive, due to some restrictions on bootstrap where it screwed up the viewport with older versions of IE. Now i have to turn the website non-responsive, instead of slowly deleting all col-sm/col-xs classes or re-code the...

Wrong index chosen by mysql

mysql,sql
why i got Using where; Using index; Using temporary; Using filesort in my explain cmd because it slow down my query 1.3s . explain : +----+-------------+--------------+--------+---------------------------------------------------+---------------------+---------+-----------------------------+-------+-----------------------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |...

Windows Phone 8.1 - Check if Primary/Application Tile is Pinned to Start Screen

c#,windows-phone-8,live-tile
Is there a way to check if the user has pinned the primary/application tile to their start screen?

jersey jax-rs communication between resources

java,rest,jersey,jax-rs,jersey-2.0
I want to implement long polling in Jersey. I have a resource for sending messages(messages.send) and another for long polling(messages.longpoll). I suspend async request in messages.longpoll, but can't realize how it can be notified that new message was added, since this happens in another resource - messages.send.

Failing query using mysqli

php,mysql,sql,mysqli,mysql-error-1064
Dear stackoverflow community, I seem to have ran into a problem. I am making a UCP for my SAMP server and I have an issue with one of my administrative function files. <?php session_start(); if($_SESSION['admin'] == 0) { echo '<script>setTimeout("window.location=\'../index.php\'", 0)</script>'; } include("../includes/connect.php"); $Charname = $_POST['charname']; $Username = $_POST['username']; $Faction...

Java NullPointerException on KeyEvent

java,nullpointerexception
I am new to Java and this is my first program, except for some 15 line print classes. Every time I try to compile my GameTutorial.java it gets NullPointerException for line 57(inside the update() method). Please, I need help because I don´t know what I am doing wrong. Maybe it...

Crm2013/15 Online and queries on huge data volumes

dynamics-crm-2013
I'm working on a couple of million records, as soon as I try to run an advanced find, and put as a criteria a linked entity, the advanced find goes in timeout. Create custom views on this allows me to filter properly? Anyone knows the proper way of using the...

How would I generate a number from a list of defined numbers, rather than a range of numbers i.e. 1-10

vb.net
Randomize() Dim gen_numb2 As Integer = CInt(Int((6 * Rnd()) + 1)) Second_Number.Text = gen_numb2 I am using the code above to generate numbers which are being used in a child's maths program that i have been tasked to create. I just need to know how I can make the...

How to convert betweem Profit Margin % and Markup %

c#,margin,formula,markup
I am writing a code where I need to convert between the profit margin % to the markup % For example if I type 50% Profit Margin then the Markup % should be 100%. If I type 75% profit Margin then the markup % will = 300%. I found this...

Overflow menu row customization

android,android-actionbar,overflow-menu
I am wanting to customise the rows of the overflow menu in the action bar. I found a great blog post explaining how to go about doing this, which seem simple enough. The link is below. http://scriptedpapers.com/2014/08/12/android-action-bar-overflow-menu-customization/ I am specifically wanting to change the background colour of the overflow menu...

Selenium, Selecting an element inside of a

python,selenium,xpath,phantomjs
The error is: Select only works on <select> elements, not on <span>. Trying to accomplish this using PhantomJS & Selenium in Python. Closest I've come to maybe finding an answer is this: How can i select this span element? Trying to learn Selenium automation, and figured working w/Gmail would be...

None being printed in middle of program?

python,semantics,nonetype
I am creating a simple scrabble style game for an online Python course. I have the concept down very well in this problem set and my program is working completely fine. Only problem is, in the console output where the user plays the game, a random 'None' is being printed...

When restart docker.io service,some docker containers don't start

logging,docker
When I restart the docker service by using the command: service docker.io restart Then I found some docker containers don't start normally and I also cannot found docker logs in /var/log. could you help me? Any suggestions appreciated. such as : I had 5 dockers at the beginning, [email protected]:/home/ubuntu# docker...

Create a simple report with text strings and plots using loop in r

r,pdf
I'm trying to find a way to loop through rows of a data frame to produce a report (preferably in PDF) that includes strings the length of a paragraph or longer, plots, and data values for each day of the year. I've exported PDFs of just plots in a loop...

Data Binding like Behaviors with Unity

c#,dictionary,unity3d
To summarise my meandering question in one sentence before I explain the problem. How can I make it so that if I update a value from a key in my Dictionary, it will fire the OnPropertyChanged method associated with that key/TextBinding, or should I be doing this a different way...

Passing a map object as parameter of the map method of an iterable

scala,dictionary,implicit-conversion
What I like in Scala is that I often discover new syntaxes just by trying what seems intuitive to me. For example, I have had to decode a text where each character was replaced by a different symbol, so I did as in this simplified example : val map =...

Django : recursive use of “request.POST” caching?

python,django,recursion
Is there a speed difference between Case 1 and Case 2 ? (Assume that request.POST contains quite big data) Case 1 Class do_something(): """ Recursive use of "request.POST" """ foo_1 = request.POST["foo"] foo_2 = request.POST["foo"] foo_3 = request.POST["foo"] Case 2 Class do_something(): """ Save "request.POST" data as a local variable...

Need help finding average and printing out errors

java,exception-handling
I need help solving this school problem. Here's a link if you're interested: http://go.code-check.org/codecheck/files/14121519036ltx4u6e3i9mtrqynsyhgihr7 When I tried to solve the problem, I print out the right messages, but there's a problem. I'm suspecting that in the Driver of the Codecheck is something like System.out.println("Average = " + message);, or something...

How could i change the url when forwarding to a page

java,jsp,url,servlets,forward
I am trying to forward to a .jsp, but the url does not change. I clearly know the difference between redirect and forward, but I need to get the error information from servlet which will be displayed in jsp, for example: login.jsp <c:choose> <c:when test="${error=='username'}"> <div class="msg error" style="display:block">invalid username</div>...

Ruby on Rails Classes

ruby,class,ruby-on-rails-4
Does a class in RoR automatically initiate the first method when a new object of that class is created? class User attr_accessor :name, :email def initialize(attributes = {}) @name = attributes[:name] @email = attributes[:email] end def formatted_email "#{@name} <#{@email}>" end end Say I create a new User like this connor...

How do you add the “each in” to work in handlebars

javascript,ember.js,handlebars
Ember is migrating to a non-context switching #each helper. For a compatibility piece I need to do the same from raw handlebars. However the trivial attempt fails var f = Handlebars.compile("{{#each numbers}}{{this}}{{/each}}"); console.log(f({numbers: [1,2,3]})); // works var f2 = Handlebars.compile("{{#each number in numbers}}{{number}}{{/each}}"); console.log(f2({numbers: [1,2,3]})); // fails How do I...

How to add custom action to ModelAdmin in Silverstripe?

php,silverstripe
I have an extension of ModelAdmin called MembershipAdmin. class MembershipAdmin extends ModelAdmin { private static $url_segment = 'membership'; private static $url_handlers = array( '$ModelClass/$Action' => 'handleAction', '$ModelClass/$Action/$ID' => 'handleAction' ) I want it to recognise the following action and have the action accessible via a URL like this: http://www.example.com/admin/membership/Member/ActivateMember/666 -...

How to get/load blob image using

asp.net,vb.net,blob
Im trying to load an image, field of longblob and I have a 1 row(id,design,name) data in my table. but when I click the button to show the image and it not showing it. I have a GetImage.aspx to call my method Protected Sub Page_Load(ByVal sender As Object, ByVal e...

random sprite movement and collision python

python,pygame,collision-detection,sprite
I am making a pacman style game using python in pygame. At the moment I am creating the ghosts/monsters that pacman has to avoid around the maze. I have created these and tried to add random movement a collision detection so they go around the maze and not just all...

Not compatible JavaScripts

javascript,jquery,html5
In a web site I have included a custom Google Map and a custom slideshow. This is the HTML file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Polideportivo Los Cedros</title> <link href="styles.css" rel="stylesheet" type="text/css"> <meta name="viewport" content="initial-scale=1.0,...

proceed to next mySQL row JAVA

java,mysql,compare
I ran into problem when my query returns result and I cannot check the next row. //here i assume that only "regular" is correct room type public boolean checkAvalibility(String roomType, String checkInDate, String checkOutDate ) throws SQLException{ database db = new database(); db.connect(); this.roomType = roomType; if(roomType!="regular"){ System.out.println("please select correct...

Can I use @switch and Enumerations?

scala,enums,switch-statement,pattern-matching,scala-2.11
Can I use switch-case for pattern matching on enumerations? I tried import scala.annotation.switch object Foo extends Enumeration { val First = Value val Second = Value val Third = Value } object Main { def foo(x: Foo.Value) = (x: @switch) match { case Foo.First => 1 case Foo.Second => 2...

django return the most recent date of a record

python,django
I am trying to return the most recent date from a number of records by a user. When the user creates a document, the date created is stored in the CreatedDocumentDetails model. I am unable to return the date of the most recently created document by the user. I asked...

Out Of Memory Error | Deploying on WAS 8

out-of-memory,ibm-was
I am getting the following error while deploying an application on Websphere Application Server version 8. SystemErr R Exception in thread "server.startup : 0" com.ibm.websphere.management.application.client.AppDeploymentException: [Root exception is java.lang.OutOfMemoryError]Exception in thread "Default : 1" java.lang.OutOfMemoryErrorjava.lang.OutOfMemoryErrorException in thread "ORB.thread.pool : 2" java.lang.OutOfMemoryError How to resolve this error?...

Show only a piece of a text that is inside a variable

javascript,ejs
I have this code: data = { date: '01/01/01 - My Name' } <% for(var i = 0; i < data.length; i++) { %> <td> <%= data[i].date %> </td> // I want show just the date here <td> <%= data[i].date %> </td> // I want show just the name here...

Find minimum-weight complete graph that spans a given minimum spanning tree

algorithm,graph,minimum-spanning-tree
Let T = (V, E) be a tree of |V| vertices and |E| = |V-1| edges, with known costs. We want to construct a minimum-weight complete Graph G = (V, E') that spans T as its unique minimum spanning tree. Example: consider the following tree T. Edges in red have...

Multiple validators for single complex type data property

angularjs,validation,breeze,complextype
I have come across a scenario where two data properties using the same complex type. Below is the entity used. { "name": "dataProperty1", "complexTypeName": "ComplexType:#test" }, { "name": "dataProperty2", "complexTypeName": "ComplexType:#test" } ComplexType: { "shortName": "ComplexType", "namespace": "test", "isComplexType": true, "dataProperties": [ { "name": "fieldA", "dataType": "String", "maxLength": 50 }...

0^2 or sqrt(0) Crashing App

android,eclipse,math
I'm trying to make an app to calculate the distance of a line segment, but when the distance should be 0, the app crashes. I'm assuming it has to do with attempting to square or square root 0, but I could be wrong. What is the problem, and how do...

How to save Qimage with 'jpeg' format in PyQt?

python,qt,pyqt
I platform is Windows7, Python3.4, PyQt5. I found that I can not save a QImage object in format jpeg. >>> from PyQt5 import QtCore, QtGui >>> i = QtGui.QImage() >>> i.load(r"C:\Users\paleneutron\Pictures\Capture4.PNG") True >>> i.save(r"C:\Users\paleneutron\Pictures\hehe.jpg") False >>> i.save(r"C:\Users\paleneutron\Pictures\hehe.jpg",format = 'jpeg') False >>> i.save('hehe.png') True >>> i.save('hehe.bmp') True >>> i.save('hehe.jpg') False >>>...

I'm getting error with CustomGridView in AlertDialog

java,android,gridview,layout,alertdialog
I have to create an AlertDialog for the user choose a category in the gridview, however I'm getting error. This is my code. When I click in the TextView to call the method that work in show dialog, the app crash. Anyone know some tutorial? category_grid.xml <?xml version="1.0" encoding="utf-8"?> <GridView...

Import blogspot posts to Jekyll

jekyll,blogspot
I imported my posts from blogger to my jekyll blog using this instructions. Unfortunetly it's in pure HTML format not in my jekyll's template post like those created by octopress. I'm looking for any ways to do that and I found this. After installing blogger2jekyll I got "command not found:...

Is there a underscore.js lib for java?

java,javascript
I use javascript often, and find underscorejs is very handy for manipulating data set, such as array or object. I am very new to Java, and wonder if there is similar lib for Java? ...

Redis extension for PHP 5.6.3 Mac OSX

php,redis
I am using XAMPP PHP 5.6.3 on Mac OSx, I need to enable redis extension PHP. If you have any help urls please suggest me.

CKRecord get value for key

ios,swift,cloudkit,ckrecord
I'm trying to get values for a user based on their username. I am able to get the correct user using: class func getByUsername(username: String, callback: (records: [CKRecord]) -> ()){ getSummary(NSPredicate(format: "Username == %@", username)){(records: [CKRecord]) -> Void in callback(records: records) } } class func getSummary(predicate: NSPredicate, callback: (records: [CKRecord])...

Sublime Text context menu on mac OSX Yosemite

osx,sublimetext3
Is there a way to create an option in the context menu of finder to open a folder/file using Sublime Text?

How to define class-methods with metaprogramming? [closed]

ruby,metaprogramming
Why is the following not creating class-methods? class Movie ['upcoming','now_playing','top_rated'].each do |method| define_method(method) do |page=1,api_key='xxxxxx'| movies = get("/movie/#{method}",:query=>{page: page,api_key: api_key}).to_hash["results"].map{|m| Movie.new(m["id"])} end end end ...

UITextField Disapearing

ios,animation,swift,uibutton,animatewithduration
I have a UITextField which animates onto the view controller (moves in from the right hand side onto the view) when I press a button. However, when I press on the UITextField or any other view, the UITextField disappears. How can I stop the UITextField from disappearing. I am using...

Active process when it should be in sleep

c,process,fork,sleep,suspend
Can anyone explain me why the child process is active, according to the output of waitpid() in the next lines of code? I've got stuck on this. int main(){ int p; if (!(p = fork())){sleep(10); return;} int s; sleep(1); printf("%d \n", waitpid(p,&s, WNOHANG|WUNTRACED)); kill(p,2); return 0; } Thank in advance!...

RSpec Request Spec - missing required keys: [:id]

ruby-on-rails,rspec
I'm getting an error when running my tests that I can't quite figure out. #The error Failure/Error: get post_path, {id: 1} ActionController::UrlGenerationError: No route matches {:action=>"show", :controller=>"posts"} missing required keys: [:id] Below is the spec. #spec/requests/visitor_interaction_spec.rb require 'rails_helper' RSpec.describe 'Visitor', :type => :request do context 'following a post link' do...

Setting up postgres ts_vector column

postgresql,sqlalchemy,tsvector
I have a search table in postgres with a ts_vector column. It looks like when I insert a dstring to this column is vectorizes it, but it doesn't do any stemming or removal of stop words: test=# create table sample_ts_vec ( id varchar(255), tsv tsvector); CREATE TABLE test=# insert into...

heroku rails application build failure

ruby-on-rails,ruby,heroku
-----> Removing .DS_Store files -----> Ruby app detected -----> Compiling Ruby/Rails -----> Using Ruby version: ruby-2.0.0 -----> Installing dependencies using 1.6.3 Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment Fetching gem metadata from https://rubygems.org/........... Installing multi_json 1.10.1 Installing i18n 0.7.0 Installing rake 10.4.2 Installing builder 3.0.4 Installing...

onSet function does not get fired on div

javascript,jquery,backbone.js,backbone-stickit
I am stacking at how to fire stickit onSet event by custom event. In the code below,colorChange event is properly occurring and all bindings(stickit) events work properly as well but onSet event. Could someone point out where the wrong point is? bindings: { '#color1': { observe: 'color1', update : function($el,val){...

Link in carousel plugin

wordpress,plugins,hyperlink,carousel
Hi I have a carousel in my wordpress page but I can't seems to find a way of how to put a link on each of the images. I am using the Wordpress Carousel Free plugin and there are no support from the author. The website is http://eyeandretina.com.au/ and the...

How do you find the php file a function is defined in in wordpress?

php,wordpress
I'm a newbie at Worpress PHP. I'm looking in the header.php file and it's calling: <?php suffusion_before_page(); ?> For this function and any other function in Worpress/PHP how do I find which file that function is being defined?...

Jquery select radio on selection

jquery
I am attempting to through jquery to check and uncheck radio boxes. For example; when radio ['mainfield'] with the value of '1' is selected – radio ['otherfield'] with the value of 1 to be selected. Then, if ['mainfield'] is changed on a value other than 1, uncheck the ['otherfield']; Hopefully...

Trying to make an image move whenever clicked, however the .click even only fires the first time clicked

javascript,jquery,onclick,click
I'm attempting to have an image (#goon) move and become resized whenever clicked. The code works great, however it only works the first time it is clicked. After the first time the image is clicked, clicking the image does noithing. Here is the Javascript code: var random = Math.floor(Math.random()* 750...

Is there anything that i missed in signed number in C language?

c,scanf
This is my basic C test program. After I built it, I just entered negative number like -1, -2, etc. in console. But the result is "oh", not "another number". I don't know why this happens, because negative numbers should make the 'if' statement true. int main(int argc, char* argv[]){...

TALEND tMap - how to use wildcard in string match?

java,wildcard,talend
I have a TALEND ETL job which I'm trying to modify slightly. In one of the tMap I have an expression like this: row.regulation.equals("Reg200806.s3.2a") || row.regulation.equals("Reg200806.s3.2b") Is there a way to make this match any string ending in '.2a' or '.2b'. I'm guessing that I can wildcard like how %...

jquery nth-child append (first and second dd in dl) trouble

javascript,jquery,html,css
Trying to select the 1st/2nd dd in a dl, to add a to them HTML: <dl> <dt></dt> <p></p> <dd></dd> <dd></dd> </dl> JS(Jquery): $("dl dd:nth-child(1)").after("<sub>md</sub>"); $("dl dd:nth-child(2)").after("<sub>lg</sub>"); Js Fiddle How can I accomplish for more than one dl? Would I have to use .each? Thank you!...

Crash while getting the current Autofocus system in ios

ios,ios8,avfoundation,iphone-6
There are two types of focus detection right from iphone 6 introduction, 1. Contrast detection 2. Phase detection from iphone 6.6+ it uses phase detection. I am trying to get the current focus system self.format = [[AVCaptureDeviceFormat alloc] init]; [self.currentDevice setActiveFormat:self.format]; AVCaptureAutoFocusSystem currentSystem = [self.format autoFocusSystem]; if (currentSystem == AVCaptureAutoFocusSystemPhaseDetection)...

Kivy: Manipulating dynamically created widgets in update function

python-3.x,layout,kivy
I am trying to extend the code in the answer here provided by Nykakin where widgets are defined on the fly in Kivy, dynamically assigned IDs, and then manipulated based on ID. The 'end game' is to implement some basic 2D physics by changing position of widgets based on ID....

  • hover effect, pretty sure it's something to do with :after
  • html,css,css3,css-animations
    I have an UL menu, I want to animate a line underneath a LI when hovered, I'm trying to start with this: .menu-container li:after { content: ""; width: 0px; height: 4px; position: absolute; bottom: 0; left: 0; display: block; z-index: 2; background: #fff; -webkit-transition: width 0.3s; transition: width 0.3s; }...

    remove elements from a list that begin with a specific character

    python,list
    I am trying to remove all mentions of anyone from a string, I was wondering if there was a faster way to do this? text = "hey @foo say hi to @bar" textsplit = text.split() n = -1 ts2 = textsplit for x in textsplit: n += 1 if x[0]==...

    function return undefined, instead of true/false boolean expr when calling [duplicate]

    javascript,node.js
    This question already has an answer here: How to return the response from an asynchronous call? 7 answers I want to check for a slug if already exist using Javascript NodeJs, Bookshelf... So far I have this code which is actually not working: var makeSlug = function (slug) {...

    AngularJS: data is being updated in controller but it is not shown in the HTML

    javascript,angularjs,html5,angularjs-scope
    In my AngularJS application, I have the following code: example.html <div> <p>{{name}}</p> </div> <div> <button ng-click="someFunction()"> </button> </div> exampleController.js angular.module('myApp').controller('exampleController', ['$scope', 'myService', function($scope, myService) { $scope.someFunction = function() { } function updateName() { $scope.name = myService.getName(); } updateName(); }]); The problem is that {{name}} is only updated in the html...

    Can't use function return value in write context - next() function

    php,arrays,multidimensional-array
    I'm getting the Can't use function return value in write context error on line 122 of my code which can be seen below. current($data['token']) .= " " . next($data['token']); I've looked at the similar questions but most of them are due to using language constructs such as empty and isset...

    How to register custom SiteMapNodeProvider Unity DI

    c#,asp.net-mvc,dependency-injection,mvcsitemapprovider
    I have MvcSiteMapProvider MVC 5 version 4.6.17 with MvcSiteMapProvider MVC 5 unity modules installed, but I can't figure out how to register my implementation of ISiteMapNodeProvider. I assume I need to add my class to MvcSiteMapProviderContainerExtension but every attempt I have tried has failed. Any help would be greatly appreciated....