Some Of The Best Answers From Latest Asked Questions

1

answers

PHP array value passes to next row

I have an array building multiple instances of the following fields: <div class="checkbox_vm"> <input type="hidden" name="fk_row[]" value="<?php echo $i; ?>"> <input type..

1

answers

programming a servo thru a barometer

i have a script which gets the air pressure from a website. and i wrote this function which says if the pressure gets different value if it rains or sunny weather or else now i have a servo which s..

5

answers

need to add a class to an element

here's my code: <body> <header> <h1>Html quiz</h1> </header> <article> <h2>What color is this?&nbsp;&nbsp; #00ff00 <ul> <li> <..

2

answers

conflicting types for 'outchar'

I am a newbie to C programming. I'm learning by reading the chapters and doing the examples from the book "Teach Yourself C" by Herbert Schildt. I'm trying to run this program in Dev C: #include <..

1

answers

How can I convert this one line of ActionScript to C#?

I would like to convert this one line of code to C# code within a void: param1:Function=null I am aware that in the void, it would be like "thing here" param1, but I dont know what "thing here" wou..

1

answers

Microsoft Advertising SDK doesn't deliverer ads

So I have a Windows Phone solution that has an ad in it. When my Solution References Microsoft.Advertising.SDK Advertising.Mobile Advertising.Mobile.UI Everything works fine and I get ads. Unfortu..

2

answers

Using Lato fonts in my css (@font-face)

I'm trying to get these fonts and add them to my css: lato bold italic 24, lato regular 14, lato bold 14, lato light 14, lato light italic 16 I found these fonts in this site: http://www.fontsquirr..

1

answers

Uninitialized Constant MessagesController

I'm building a simple chat app based on this rails cast. I'm following along fine, but when I go to localhost, I get an error "uninitialized constant MessagesController::Message". This is generally a ..

1

answers

Adding a UISegmentedControl to UITableView

How do I add a UISegmentedControl to a UITableView? Similar to the image found here: http://cdn.imore.com/sites/imore.com/files/styles/large/public/field/image/2012/08/iHomework-for-iPhone-managing-as..

3

answers

How to implement a simple scenario the OO way

After starting to read a book on OO programming, I am attempting to make my android app more OO. However I am stumped on a simple scenario. I have a Book object, which can have many say Chapter objec..

1

answers

Embed ruby within URL : Middleman Blog

I am having some problem with some facebook share link on Middleman blog:- Well I have : <%= link_to current_article, article %> => <a href="http://0.0.0.0:4567/link_of_article">Artic..

2

answers

How to make a variable accessible outside a function?

I am fetching data from a json file using $.getJSON to get an id of a character and then use $.getJSON to fetch it from another page using the id that I go previously. However, in the console it says..

4

answers

Method Call Chaining; returning a pointer vs a reference?

I have a Text class that has certain methods that return a pointer to itself, allowing calls to be chained. (The reason being I merely like how the chaining looks and feels, honestly!) My question i..

1

answers

Jquery assiging class to th in a table

I am trying to assign class to table headers. I am trying to read class names of td's and assign it to related th header. Any help would be appreciated. <table > <tr> <th>hdr..

1

answers

How to use a global array in C#?

I am making an text-based adventure game for my first little project in C#. In order for my vision to work I need a few arrays that can be accessed in any of the functions. The game will only consist ..

3

answers

Two constructors

As I remember I can use first constuctor in second constuctor, but there is mistake on bold line, could you help me to correct it? public FaceExtAdditionCanvas() { profileImage.setSize(IMAGE_WI..

1

answers

Crop image to specified size and picture location

I have an image that is being taken using AVCaptureSession and being returned to my view controller. Here is a screen shot of the camera interface: The AVCaptureSession takes the FULL SCREEN phot..

1

answers

Is there a way to view two blocks of code from the same file simultaneously in Sublime Text?

Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? I can't find anything in the view options...

5

answers

How do I get some variable from another class in Java?

I am "playing around" with Java, watching tutorials and trying to get the hang of it. For this question, I'm trying to figure out how I can take a variable from another class and use it in my main one..

1

answers

How can I tell if an algorithm is efficient?

Relatively new to C++ but I am very interested in the algorithmic aspect of programming. Is there a general framework for deciding if an algorithm is efficient? i.e. the quickest possible? I am tryi..

1

answers

Better solution without exluding fields from Binding

I have an entity Movie that has 2 fields(poster and trailer) of varbinary(max) within the database. When I want to create the instance on the controller I had a lot of problem trying to get those fiel..

2

answers

How to correctly write async method?

So I am trying to learn the basics of using 'async' and 'await' in C#, but I am not sure what I am doing wrong here. I am expecting the following output: Calling DoDownload DoDownload done [...output..

4

answers

this in equals method

I am looking at the equals method, and I see this and I don't understand what it means...I do understand them when I see it in constructors and some methods but its not clear to me when they are in eq..

1

answers

How to split a string in two and store it in a field

I have a class of fields that is like the following: public class EmployeeInformationNames { private String firstName; private String lastName; public String getFirstName() { re..

1

answers

Titlecase all entries into a form_for text field

Trying to title-case all the entries from a form_for field so they're consistent going into the database for searches. Here is my search field (file created as a partial): <%= form_for @airport ..

1

answers

Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods

When integrating the Apptentive iOS SDK via Cocoapods, I get the following errors: Undefined symbols for architecture i386: "_OBJC_CLASS_$_ATConnect", referenced from: objc-class-ref in AppDe..

1

answers

How to do perspective fixing?

I'm searching for a fast way to fix perspective of a picture given in java or any language.And currently i really don't have any idea how to do it, nor find anything useful in Google. Input: Point[4]..

2

answers

Ruby - ignore "exit" in code

Consider this code: class Bar def initialize puts 'Hi from class Bar.' exit end end class Foo def initialize loop { case $stdin.gets.chomp when 'foo' puts 'Hi ..

1

answers

String index out of range: 4

I am a beginner here to Java. So I tried to run this code here, but it kept giving me this error: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 4. ..

1

answers

Keep placeholder text in UITextField on input in IOS

Is there any way to prevent placeholder text in a UITextField from being overwritten when the text field receives an input? I have a text field that takes an expiration date in this format "MM/YYYY" w..

5

answers

python variable NameError

I am having trouble with assigning values to vars and then accessing the values. For example: # offer users choice for how large of a song list they want to create # in order to determine (roughly) h..

2

answers

Pass PDO prepared statement to variables

I am using a prepared statement to upload submitted information into a MYSQL database. I would like to know how to pass my prepared statements to a separate variable so I can post a summary of what wa..

3

answers

Why my regexp for hyphenated words doesn't work?

I'm writting a regular expression for match with simple words and single hyphenated words using re module of python, so for example in: test_case_input = """the wide-field infrared survey explorer is..

1

answers

AngularJs directive not updating another directive's scope

I have a parent directive that has a function that loads a modal div with data after a service call. I have confirmed that the service correctly returns data, but that data model is never passed to t..

1

answers

Where do I put a single filter that filters methods in two controllers in Rails

I have a single method I want to use as a filter in two controllers. Is there a central location I can place it or must I duplicate the code in both controllers?..

1

answers

My eclipse won't open, i download the bundle pack it keeps saying error log

Its say this huge message. Showing the last part , and I am on windows !ENTRY org.eclipse.osgi 4 0 2013-12-31 18:02:27.633 !MESSAGE Application error !STACK 1 java.lang.RuntimeException: Application..

2

answers

Passing multiple values for same variable in stored procedure

I have a variable that passes multiple values to stored procedure. When I see through fidler I see values being passed correctly like arg1=331 arg1=222 arg1=876 arg1=932 In my st..

2

answers

grep's at sign caught as whitespace

I ran into a problem while trying to grep a file that contains the following: @abc abc abc @[email protected] @[email protected] @[email protected] acb [email protected] assd dsasd [email protected] I tried various grep commands, but there was a problem an..

2

answers

Hide Signs that Meteor.js was Used

In order to design a blind test, how can a Meteor.js app hide signs that Meteor.js was used to build the site? PHP have a X-Powered-By header that can be removed, what hints do Meteor have?..

1

answers

Gradle - Move a folder from ABC to XYZ

Directory Structure: Project1/ABC/file1.txt I want the above ABC folder moved/renamed to XYZ (without leaving ABC there). How can I do this using Gradle. Seems like in Gradle: For a right hand pers..

2

answers

C# - insert values from file into two arrays

I want to read values from text file and insert them to 2 arrays, the first column to one array and the second column to another array. For example: Text file: 0x223 0x2342342 0x21323 0x9832..

1

answers

Implement specialization in ER diagram

I want to implement this specialization relationship. Knowing that I will have different attributes for each account type. Here's my try: accounts(account_id, email, username, password, ...) user_a..

1

answers

concat yesterdays date with a specific time

I need to create a query that looks at yesterdays date but at a specific time. I would like the time portion to be in the 'hh24:mi:ss' format as this is how the search field is formated. when I run ..

1

answers

Comparing a variable with a string python not working when redirecting from bash script

First I'll show you both the bash and python script (both are in the /bin directory on my mac): The bash script (esh_1): #! /bin/bash echo -n "Enter bash or natural-language command: " read INPUT e..

1

answers

getting " (1) no such column: _id10 " error

I'm trying to retrieve the data of a particulate row in a sqlite database . and trying to display it to on a EditText but I'm getting this error , Kindly help me in solving the error ! Thanks in adva..

1

answers

Accessing AppDelegate from framework?

I'm creating my first framework in Objective-C that wraps the facebook SDK in a more intuitive way. There are several points in my framework where I'd like to reference the AppDelegate, but there is n..

3

answers

Empty brackets '[]' appearing when using .where

I'm trying to display all Guides where title contains the word 'attack'. I do so like so: def attack @guides = Guide.where(title: 'attack') end Quick question - How do I make it non case-sensitiv..

1

answers

Xml Parsing in C#

http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.atom on this site, I wrote the following code to retrieve the data. protected void Button1_Click(object sender, EventArgs e) {..

3

answers

Instantiating a generic type

I'm trying to convert an existing class to use generics, and am getting stumped while converting the constructors. The original class was a POJO that contained logic for moving from one room to anoth..

1

answers

Does the target directory for a git clone have to match the repo name?

In other words, I have a repo up on Github called st3_packages (https://github.com/pitosalas/st3_packages). I want to do a git clone and have it create a directory on my local computer called "Pack..

5

answers

When to create variables (memory management)

You create a variable to store a value that you can refer to that variable in the future. I've heard that you must set a variable to 'null' once you're done using it so the garbage collector can get t..

1

answers

OS X Sprite Kit Game Optimal Default Window Size

I am looking to port an iOS Sprite Kit game to OS X. I'd like to provide the sharpest image quality possible. Since iOS device support only a handful of resolutions and I believe 3 aspect ratios this ..

1

answers

How to get parameter value for date/time column from empty MaskedTextBox

I'm having a problem adding a parameter of date/time type to my insert statement. For textual data you can leave the textbox empty and the record will be added but with date/time data I can't. I get t..

1

answers

How to create a showdown.js markdown extension

Using the following code, I get working output: <html> <head> <script type="text/javascript" src="/js/showdown.js"></script> </head> <body> <scrip..

3

answers

SQL permissions for roles

I'm a bit confused about permissions in SQL I have created a medical database. As a script I'm creating a doctor role and I want to say they can perform updates on tables 1,2 and 3. The database th..

2

answers

Difference between opening a file in binary vs text

I've done some stuff like: FILE* a = fopen("a.txt", "w"); const char* data = "abc123"; fwrite(data, 6, 1, a); fclose(a); and then in the generated text file, it says "abc123" just like expected. Bu..

1

answers

Parse error: syntax error, unexpected [

I have this simple function function render($template, $values = []) { // if template exists, render it if (file_exists("../templates/$template")) { // extract variables into l..

1

answers

Please help me convert this script to a simple image slider

Can some please, PLEASE! help me with this problem. Okay so I have a code that at first I thought worked well but I forgot that when the default <img src="test-img-1.jpg" class="actual-img"> con..

1

answers

java doesn't run if structure inside of onclick listener

All you must see as code is below. bSet.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method..

1

answers

String method cannot be found in a main class method

I have about a one year experience programming Java, I made a static method located in the main class, and for some reason, whenever I compile it gives me an error saying that the compareTo() method f..

1

answers

Autoresize View When SubViews are Added

I am developing an app using iOS 7 and auto layout. I am adding a simple textfield to a UIView. But the view is not getting resized. I even tried to change the frame manually but it did not work. I be..

1

answers

Preg_match backtrack error

When I use the regex (.*)*[0] everything works well: preg_match('/(.*)*[0]/', 'this is a test string'); var_dump(preg_last_error()); // no code's returned But when I add another character to char c..

1

answers

Parameter binding on left joins with array in Laravel Query Builder

I trying to do a left join with where IN clause search. But I couldn't able to bind the array to the query. $query = DB::table('offers'); $query->select('id', 'business_id', 'address_id',..

1

answers

Setting default checkbox value in Objective-C?

Okay, this one's making me feel stupid... I'm a feature film editor who's recently started teaching myself Objective-C after many years away from coding. I think the last code I wrote was in Cobol, i..

1

answers

Highlight Anchor Links when user manually scrolls?

I apologize for the long post. I wanted to include everything that might be helpful. I have a single page website that consists of several divs stacked vertically. I'm using a floating nav bar and so..

2

answers

Intermediate language used in scalac?

In the GCC compiler we see several 'intermediate languages': RTL, GENERIC and GIMPLE. This answer hints at the idea of an intermediate representation in scalac. My question is: is there an 'interm..

2

answers

Generating a list of pages (not posts) without the index file

I am using Jekyll as a static generator for a website (not a blog), and I want to have an automatically generated list of all pages on my index page. I get that to work with the following code for the..

1

answers

Warp \ bend effect on a UIView?

I'm trying to get a similar effect to the one described in the pictures. The white area on the left isn't on the original photo, it pushes the pixels away. I've tried using Core Image (which offered a..

2

answers

Why there is this "clear" class before footer?

I have recently been modifying a template from Blogofile, which is written in HTML 5. When I looked at the generated page, there is this <div class="clear"></div> box in the html sourc..

1

answers

Generic XSLT Search and Replace template

I am trying to find (before re-inventing) a "simple" XSLT template that will take ANY xml document, find ALL text elements within that XML and replace all ' with ''. I'm doing a "SELECT ... FOR XML" ..

1

answers

Are all Spring Framework Java Configuration injection examples buggy?

I'm wondering if it's only me or are most examples of Spring's Java Configuration flawed? Like here for example: http://spring.io/blog/2008/03/27/spring-java-configuration-what-s-new-in-m3 http://sp..

1

answers

Calling another method java GUI

I'm trying to make a GUI, and I can accomplish it all in one method, but I would like to make the code simpler and make multiple methods. However, I can't get it to work. I am new to Java programming...

1

answers

Use NSInteger as array index

Have a happy year! I am having trouble with the following. First logic: Get json from server. Json value is always a number. Read plist into array. NSLog the array with index of the json value from ..

1

answers

I need to know how to get my program to output the word i typed in and also the new rearranged word using a 2D array

I have a working program which takes the first letter of a word then switches it to the back of the word and adds "ay to the end. It works fine but I am trying to store the original word and the newW..

1

answers

Summing radio input values

I'm new to this so I have been trying to adapt code from others to suit my needs, I need a radio selection from the first name group to be added to the second name group and then displayed in the text..

5

answers

Removing "http://" from a string

I have a PHP script that removes the "http://" from user input url strings. My Script: $url= "http://techcrunch.com/startups/"; $url = str_replace('http://', '', $url); Result: $url= techcrunch.c..

3

answers

Is it possible to change the content HTML5 alert messages?

Is it possible to control HTML5 alert messages? when adding 'required' to an input field. because I want it to be specific and I don't want it's language to depend on the browsers. <input id="ans..

2

answers

Java and unlimited decimal places?

Is there a simple way that i can manipulate high precision decimal numbers in java, without a limit on the number of decimal places, and the ability to output the number in a println or write it to a ..

1

answers

Zipping a file in bash fails

I have this line of code in a file called backup.sh, located in /backup (so the path is /backup/backup.sh) The code is: #!/bin/bash zip -r /backup/Backup-$(date +%Y-%m-%d) /ftb The file has permis..

3

answers

is it possible to add colors to python output?

so i made a small password strength tester for me, my friends and my family, as seen here: import re strength = ['You didnt type anything','Terrible','weak sause','avarage','Good!','Very Strong', 'TH..

1

answers

Read input from a JOptionPane.showInputDialog box

I am almost done with this project. It's my very first one and I need to read a little better the inputs from the JOption box. For example, I want to go back to the previous page if the user clicks on..

1

answers

Cannot retrieve string(s) from preferences (settings)

I have encountered a problem in my Android application. The problem is that for some reason, I can't retrieve the string of a ListPreference from my preferences.xml file. Here's the code I tried: p..

1

answers

strange error in my Animation Drawable

A strange error when trying to start Activity. i think the error in my Animation Drawable LogCat: 12-31 06:37:45.138: E/AndroidRuntime(922): FATAL EXCEPTION: main 12-31 06:37:45.138: E/Andr..

1

answers

How to execute an action before close metro app WinJS

I want to trigger a function before closing my metro app but I don't know where such as app.onactivated = function (args){ //all the actions here will be executed on app's activation } I want som..

1

answers

Two Page Login with Spring Security 3.2.x

We are brand new to Java, Spring, and Spring Security, but not new to development. We've been able to create a Spring Security-based Thymeleaf login page that uses a JNDI datasource to connect to our ..

1

answers

Hadoop MapReduce: Strange Result when Storing Previous Value in Memory in a Reduce Class (Java)

If I wish to store the current value of an iterator to compare to the next value of the iterator in a Reduce method, Hadoop requires that I clone it instead of simply assigning its reference to a temp..

2

answers

javascript, for loop defines a dynamic variable name

Folks, Not sure if eval() or window() is the answer, but I am trying to loop through an array, and create variables for each item in that array dynamically. My myArray looks like: ['foo','bar','ba..

1

answers

How can compare-and-swap be used for a wait-free mutual exclusion for any shared data structure?

Being new to multi-threading and mutexes I was going through the wikipedia for starters. I came across this portion: CAS can be used to achieve wait-free mutual exclusion for any shared data struc..

3

answers

How do I hide the PHP explode delimiter from submitted form results?

I have created a form which utilizes a .txt file to pull the names of the EMPLOYEES from and breaks them up in the SELECT form option using the PHP explode function. <select name="FakeName" id="Fa..

3

answers

Got a NumberFormatException while trying to parse a text file for objects

While trying to create objects and add them to an ArrayList using data from a text file, the program threw a NumberFormatException and I have absolutely no clue why, everything seemed OK to me. Here's..

1

answers

Best way for storing Java application name and version properties

Using Eclipse IDE. I need to store my application's name and version as they are used by the app itself. I could hard-code them as static final fields somewhere in the codebase. A better solution I k..

1

answers

Problems with installation of Google App Engine SDK for php in OS X

I'm trying to create Google App Engine environment in my Mac OS X Mountain Lion. Downloaded the Googleapplauncher.dmg file. While I tried to unzip the file it shows "the following disk images couldn't..

1

answers

How is VIP swapping + CNAMEs better than IP swapping + A records?

I'm in the middle of updating my DNS setup to use all CNAMEs instead of A records, because I need support for VIP swaps between Staging and Production. I can't use A records for this because that put..

1

answers

Get Public URL for File - Google Cloud Storage - App Engine (Python)

Is there a python equivalent to the getPublicUrl PHP method? $public_url = CloudStorageTools::getPublicUrl("gs://my_bucket/some_file.txt", true); I am storing some files using the Google Cloud Clie..

1

answers

Access And/Or exclusions

I have some sample data like: |H.RISK|NOTE|NORMAL| The | are actually in the data, it's a String. I am using Access, and am trying to exclude records that contain RISK in the String. Sample query..

1

answers

Querying date field in MongoDB with Mongoose

I'm trying to query documents in MongoDB using findOne(), but it's not working. The field I'm trying to filter by is 'date', and I'm not sure if perhaps it's a special word I shouldn't be using when i..

1

answers

Uploading into folder in FTP?

I am using the following code to learn how to load files with FTP. How do I set the path or folder into which my file will be uploaded ? using System; using System.IO; using System.Net; using System...

1

answers

Speech input for visually impaired users without the need to tap the screen

We're working on a app for blind and visually impaired users. We've been experimenting with a third party library to get spoken user input and convert it to text, which we then parse as commands to co..

1

answers

Image steganography that could survive jpeg compression

I am trying to implement a steganographic algorithm where hidden message could survive jpeg compression. The typical scenario is the following: Hide data in image Compress image using jpeg The hidd..

1

answers

Getting all files in directory with ajax

Backstory: I am creating a development tool for web development. This tool loads a users webpage into an iframe, this allows the program to resize the iframe and simulate mobile screen sizes. I also w..