Questions Tagged with #Jail

The FreeBSD jail mechanism is an implementation of operating system-level virtualization that allows administrators to partition a FreeBSD-based computer system into several independent mini-systems called jails. source: http://en.wikipedia.org/wiki/FreeBSD_jail

Access files in /var/mobile/Containers/Data/Application without jailbreaking iPhone

A program logs some message in directory /var/mobile/Containers/Data/Application on iPhone. Is there any way I can get access to this directory without jailbreaking iPhone? If no, is there any directo..

Using sendmail from bash script for multiple recipients

I'm running a bash script in cron to send mail to multiple recipients when a certain condition is met. I've coded the variables like this: subject="Subject" from="[email protected]" recipients="user1..

How to fix itunes could not connect to the iphone because an invalid response was received from the device?

I have jailbroken device using Absinthe, 2 days back I removed the jailbreak. Now I am not able to connect my iPhone 4 to iTunes. It says "iTunes could not connect to the iPhone because an invalid res..

How do I get a background location update every n minutes in my iOS application?

I'm looking for a way to get a background location update every n minutes in my iOS application. I'm using iOS 4.3 and the solution should work for non-jailbroken iPhones. I tried / considered follo..

The entitlements specified...profile. (0xE8008016). Error iOS 4.2

I am getting the 'dreaded' error The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile. (0xE8008016). when trying ..

Test iOS app on device without apple developer program or jailbreak

How can I test an iOS application on my iPod Touch without registering for the Apple Developer Program or jailbreaking my iPod? Neither is a viable option at the moment. I'd like to test on the devi..

Can I edit an iPad's host file?

I doubt this is possible without extensive jail-breaking, but is it at all possible to edit the iPad's (or any iOS device's) hosts file?..

How to export non-exportable private key from store

I need to export private key from Windows store. What should I do if the key is marked as non-exportable? I know that it is possible, program jailbreak can export this key. To export key I use Org.Bo..

What's the best way to select the minimum value from several columns?

Given the following table in SQL Server 2005: ID Col1 Col2 Col3 -- ---- ---- ---- 1 3 34 76 2 32 976 24 3 7 235 3 4 245 1 792 What ..

Is there a way I can capture my iPhone screen as a video?

I want to be able to capture my iPhone's screen as a video, but I'm not sure the best way to do this. Can anyone help guide me on how to best do this without jailbreak?..

iPhone App Minus App Store?

If I create an application on my Mac, is there any way I can get it to run on an iPhone without going through the app store? It doesn't matter if the iPhone has to be jailbroken, as long as I can sti..

Changing WPF title bar background color

I have a WPF Windows application. I need to change the background color of the title bar. How can I do that?..

SVN change username

I found a lot of examples on how to change the username for specific revisions and so on. But what I need is this: I did a checkout with the authentication credentials of a workmate and need to chang..

Does Git Add have a verbose switch

I am in the process of moving all my private an public repo's over to github. One of the decisions I have made is to only use the console as it means a smaller tooling footprint if I ever need to chan..

Error 405 (Method Not Allowed) Laravel 5

Im trying to do a POST request with jQuery but im getting a error 405 (Method Not Allowed), Im working with Laravel 5 THis is my code: jQuery <script type="text/javascript"> $(document).r..

Get local IP address in Node.js

I have a simple Node.js program running on my machine and I want to get the local IP address of a PC on which my program is running. How do I get it with Node.js?..

What is the right way to check for a null string in Objective-C?

I was using this in my iPhone app if (title == nil) { // do something } but it throws some exception, and the console shows that the title is "(null)". So I'm using this now: if (title == nil..

Save and load weights in keras

Im trying to save and load weights from the model i have trained. the code im using to save the model is. TensorBoard(log_dir='/output') model.fit_generator(image_a_b_gen(batch_size), steps_per_epoc..

AppFabric installation failed because installer MSI returned with error code : 1603

When I reinstall the AppFabric 1.1, Why I'm getting this error "AppFabric installation failed because installer MSI returned with error code : 1603".? I did run it with administrative rights. Below ..

PHP 7 RC3: How to install missing MySQL PDO

I am trying to setup webserver with PHP 7 RC3 + Nginx on Ubuntu 14.04 (for test purposes). I installed Ubuntu in Vagrant using ubuntu/trusty64 and PHP 7 RC 3 from Ondrej Surý (https://launchpad.net/..

How to return data from promise

I need to get the response.data out of the promise so it can be returned by the enclosing function. I know, I probably can't do it the way I've coded it because of normal JavaScript scope. Is there an..

Git fatal: protocol 'https' is not supported

I am going through Github's forking guide: https://guides.github.com/activities/forking/ and I am trying to clone the repository onto my computer. However, running the command: $ git clone https://gi..

MVC 4 Data Annotations "Display" Attribute

I am starting out with MVC 4 (Razor view engine). (I believe this may apply to MVC 3 and earlier as well.) I am wondering if there is any benefit to using the DisplayAttribute data annotation within a..

Base 64 encode and decode example code

Does anyone know how to decode and encode a string in Base64 using the Base64. I am using the following code, but it's not working. String source = "password"; byte[] byteArray = source.getBytes("UT..

How to center align the cells of a UICollectionView?

I am currently using UICollectionView for the user interface grid, and it works fine. However, I'd like to be enable horizontal scrolling. The grid supports 8 items per page and when the total number ..

Mysql command not found in OS X 10.7

I cant get my mysql to start on os x 10.7. It is located in /usr/local/mysql/bin/mysql I get command not found when I type mysql --version in the terminal. I tried this can't access mysql from..

Using Mysql in the command line in osx - command not found?

I'm trying to get mysql up and running on my mac osx 10.9.5. I've installed the latest version14.14 5.6.21 community server. I've gone to system preferences and started the mysql server, then launch..

Shortest way to print current year in a website

I need to update a few hundred static HTML pages that have the copyright date hard coded in the footer. I want to replace it with some JavaScript that will automatically update each year. Currently I..

Error ITMS-90717: "Invalid App Store Icon"

When I tried to submit an App to Itunes Connect I got the following error. iTunes Store Operation Failed Error ITMS-90717: "Invalid App Store Icon. The App Store Icon in the asset catalog in 'YourAp..

Converting double to integer in Java

In Java, I want to convert a double to an integer, I know if you do this: double x = 1.5; int y = (int)x; you get y=1. If you do this: int y = (int)Math.round(x); You'll likely get 2. However, I..

What is the difference between HTTP 1.1 and HTTP 2.0?

HTTP/1.1 has served the Web well for more than fifteen years, but its age is starting to show. Can anybody explain what is the main difference between HTTP 1.1 and 2.0? Is there any change in ..

Automatically run %matplotlib inline in IPython Notebook

Every time I launch IPython Notebook, the first command I run is %matplotlib inline Is there some way to change my config file so that when I launch IPython, it is automatically in this mode?..

Remove header and footer from window.print()

I am using window.print() for printing page, but I got header and footer contains page title, file path, page number and date. How to remove them? I tried print stylesheet also. #header, #nav, .nop..

How do I POST with multipart form data using fetch?

I am fetching a URL like this: fetch(url, { mode: 'no-cors', method: method || null, headers: { 'Accept': 'application/json, application/xml, text/plain, text/html, *.*', 'Content-Type'..

How to set back button text in Swift

How do you remove the back button text. Current back button: < Back Desired back button: < AnythingElse None of these have worked: self.navigationItem.backBarButtonItem?.title = "B..

TypeError: 'NoneType' object has no attribute '__getitem__'

I'm having an issue and I have no idea why this is happening and how to fix it. I'm working on developing a Videogame with python and pygame and I'm getting this error: File "/home/matt/Smoking-Gam..

Understanding the results of Execute Explain Plan in Oracle SQL Developer

I'm trying to optimize a query but don't quite understand some of the information returned from Explain Plan. Can anyone tell me the significance of the OPTIONS and COST columns? In the OPTIONS column..

PHP: How to get current time in hour:minute:second?

In order to get the date in the right format I want I used date("d-m-Y"). Now I want to get the time in addition to the date in the following format H:M:S How can I procede ?..

Merge PDF files

Is it possible, using Python, to merge separate PDF files? Assuming so, I need to extend this a little further. I am hoping to loop through folders in a directory and repeat this procedure. And..

Where can I download an offline installer of Cygwin?

I need an offline installer with most of the utilities commonly needed. Somehow the default installer confuses me with all its package selection. I installed Cygwin but I can't find the diff utility a..

undefined offset PHP error

I am receiving the following error in PHP Notice undefined offset 1: in C:\wamp\www\includes\imdbgrabber.php line 36 Here is the PHP code that causes it: <?php # ... function get_match($re..

How to delete projects in Intellij IDEA 14?

I only found how to delete projects in older versions of IDEA but still don't see the button in my IDEA 14. Did the Jetbrains guys implement this feature or do I still have to delete my project folder..

Calculate summary statistics of columns in dataframe

I have a dataframe of the following form (for example) shopper_num,is_martian,number_of_items,count_pineapples,birth_country,tranpsortation_method 1,FALSE,0,0,MX, 2,FALSE,1,0,MX, 3,FALSE,0,0,MX, 4,FA..

Concept of void pointer in C programming

Is it possible to dereference a void pointer without type-casting in the C programming language? Also, is there any way of generalizing a function which can receive a pointer and store it in a void p..

ASP.Net 2012 Unobtrusive Validation with jQuery

I was playing with Visual Studio 2012 and I created an empty ASP.Net Web Application, when I tried to add the traditional validator controls to a new page, this error occurs: WebForms UnobtrusiveV..

How to change the background color of Action Bar's Option Menu in Android 4.2?

I'd like to change the background color of the option (overflow) menu in Android 4.2. I have tried all the methods but it is still showing the default color set by the theme. I used the following code..

How do I get the position selected in a RecyclerView?

I am experimenting with the support library's recyclerview and cards. I have a recyclerview of cards. Each card has an 'x' icon at the top right corner to remove it: The card xml, list_item.xml: &..

Str_replace for multiple items

I remember doing this before, but can't find the code. I use str_replace to replace one character like this: str_replace(':', ' ', $string); but I want to replace all the following characters \/:*?"&l..

How to use Microsoft.Office.Interop.Excel on a machine without installed MS Office?

I'm writing an application which works with excel files. I need a feature to delete a sheet. I have to use an assembly Microsoft.Office.Interop.Excel.dll. It's running fine on developer machine but w..

library not found for -lPods

I got an error when archiving a project. This is my environment. Mac OS Lion Xcode 4.3.1 iOS SDK 5.1 The project deployment target is: IPHONEOS_DEPLOYMENT_TARGET 3.2 The error shows: ld: libra..

How to compare two JSON objects with the same elements in a different order equal?

How can I test whether two JSON objects are equal in python, disregarding the order of lists? For example ... JSON document a: { "errors": [ {"error": "invalid", "field": "email"}, ..

Android Shared preferences for creating one time activity (example)

I have three activities A,B and C where A and B are forms and after filling and saving the form data in database(SQLITE). I am using intent from A to B and then B to C.What i want is that every time I..

Check if number is decimal

I need to check in PHP if user entered a decimal number (US way, with decimal point: X.XXX) Any reliable way to do this?..

What is the difference between server side cookie and client side cookie?

What is the difference between creating cookies on the server and on the client? Are these called server side cookies and client side cookies? Is there a way to create cookies that can only be read on..

Shorter syntax for casting from a List<X> to a List<Y>?

I know its possible to cast a list of items from one type to another (given that your object has a public static explicit operator method to do the casting) one at a time as follows: List<Y> Li..

Select All Rows Using Entity Framework

I'm trying to select all the rows out of a database using entity framework for manipulation before they're sent to the form var ptx = [modelname].[tablename](); ptx.[tablename].Select(????) what go..

Check the current number of connections to MongoDb

What is the command to get the number of clients connected to a particular MongoDB server?..

subsetting a Python DataFrame

I am transitioning from R to Python. I just began using Pandas. I have an R code that subsets nicely: k1 <- subset(data, Product = p.id & Month < mn & Year == yr, select = c(Time, Produ..

ASP.NET MVC3 Razor - Html.ActionLink style

I'm trying to set the style of an action link like so: <text><p>Signed in as @Html.ActionLink(Context.User.Identity.Name,"Index",new { Controller="Account", @style="text-transform:capit..

How to change border color of textarea on :focus

Forgive me is this is a stupid question, but i need help. I want to change border color of TEXTAREA on focus. but my code doesn't seem to working properly. Kindly view code on fiddle. <form name ..

How can I get my webapp's base URL in ASP.NET MVC?

How can I quickly determine what the root URL is for my ASP.NET MVC application? I.e., if IIS is set to serve my application at http://example.com/foo/bar, then I'd like to be able to get that URL in..

Two HTML tables side by side, centered on the page

I have two tables on a page that I want to display side by side, and then center them within the page (actually within another div, but this is the simplest I could come up with): <style> #ou..

Zip lists in Python

I am trying to learn how to "zip" lists. To this end, I have a program, where at a particular point, I do the following: x1, x2, x3 = stuff.calculations(withdataa) This gives me three lists, x1, x2..

Java logical operator short-circuiting

Which set is short-circuiting, and what exactly does it mean that the complex conditional expression is short-circuiting? public static void main(String[] args) { int x, y, z; x = 10; y = 20; ..

Query to select data between two dates with the format m/d/yyyy

I am facing problem when i'm trying to select records from a table between two dates. m using the following query select * from xxx where dates between '10/10/2012' and '10/12/2012' this query wor..

How can I produce an effect similar to the iOS 7 blur view?

I'm trying to replicate this blurred background from Apple's publicly released iOS 7 example screen: This question suggests applying a CI filter to the contents below, but that's a whole different ..

Display JSON as HTML

Any recommendations on how to embed JSON in an HTML page with the JSON formatted in a human readable style? For example, when you view XML in a browser, most browsers display the XML formatted (indent..

How to get client's IP address using JavaScript?

I need to somehow retrieve the client's IP address using JavaScript; no server side code, not even SSI. However, I'm not against using a free 3rd party script/service...

Data truncation: Data too long for column 'logo' at row 1

I am trying to insert a photo into a BLOB column of a MySQL table, and I get an exception: Data too long for column 'logo' at row 1. Here is the JDBC: int idRestaurant = 42; String reston..

what does this mean ? image/png;base64?

I don't know what we call this. but i found a image at google 404 url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKsAAADVCAMAAAAfHvCaAAAAGFBMVEVYn%2BH%2F%2F%2F%2Bex%2B3U5vd7s%2Bfq8%2Fs0itq72PMLUP..

SQL Server datetime LIKE select?

in MySQL select * from record where register_date like '2009-10-10%' What is the syntax in SQL Server?..

Resize image in the wiki of GitHub using Markdown

I'm writing a wiki page on GitHub, and I'm using Markdown. My problem is that I'm putting a large image (this image is in its own repository) and I need resize it. I have tried different solutions,..

How to add style from code behind?

I want to add a style A:Hover to a HyperLink control from code behind. I can do like this : HyperLink hlRow = new HyperLink(); hlRow.Style.Add("color", "#000000"); hlRow.Style.Add("text-decoration",..

What exactly does Double mean in java?

I'm extremely new to Java and just wanted to confirm what Double is? Is it similar to Float or Int? Any help would be appreciated. I also sometimes see the uppercase Double and other times the lower c..

How to get item's position in a list?

I am iterating over a list and I want to print out the index of the item if it meets a certain condition. How would I do this? Example: testlist = [1,2,3,5,3,1,2,1,6] for item in testlist: if ..

How do I force git pull to overwrite everything on every pull?

I have a CENTRAL bare repository that has three developer repositories pulling and pushing to it normally. I also have two other repositories that pull from the CENTRAL bare repo: one is the live ser..

Changing the resolution of a VNC session in linux

I use VNC to connect to a Linux workstation at work. At work I have a 20" monitor that runs at 1600x1200, while at home I use my laptop with its resolution of 1440x900. If I set the vncserver to run ..

Where to find the win32api module for Python?

I need to download it for Python 2.7, but can't seem to find it... ..

mysql-python install error: Cannot open include file 'config-win.h'

I am trying to run pip install mysql-python connector but it keeps giving me an error "Cannot open include file: 'config-win.h'". The installation works fine on my Mac and another Windows machine, bu..

Using getline() in C++

I have a problem using getline method to get a message that user types, I'm using something like: string messageVar; cout << "Type your message: "; getline(cin, messageVar); However, it's not..

Default passwords of Oracle 11g?

I installed Oracle 11g. I didn't change the passwords for SYSTEM and SYS. However now I find that the default passwords do not work. Please help...

How to read a text file into a list or an array with Python

I am trying to read the lines of a text file into a list or array in python. I just need to be able to individually access any item in the list or array after it is created. The text file is formatt..

Where do I find the line number in the Xcode editor?

In Xcode 3, the line number of the current cursor location was displayed. I don't see this in Xcode 4. Is there a setting that will turn it on? Or a keypress that will give it to me?..

Java, Simplified check if int array contains int

Basically my mate has been saying that I could make my code shorter by using a different way of checking if an int array contains an int, although he won't tell me what it is :P. Current: public bo..

How to execute VBA Access module?

Ok I'm using Access 2003 and I've just started learning Access and VBA a few days ago. I wrote some code in a module and there are no errors when I press the play button on the debugger toolbar up top..

Set default heap size in Windows

I want to set Java heap size permanently and don't want to run every jar file with options. I use Windows and Java 1.7...

Django - iterate number in for loop of a template

I have the following for loop in my django template displaying days. I wonder, whether it's possible to iterate a number (in the below case i) in a loop. Or do I have to store it in the database and t..

Converting Varchar Value to Integer/Decimal Value in SQL Server

How to convert the value of records in a table with data type varchar to integer or decimal so I can get the sum of the value. I use SQL Server 2005. Say that I have table structure like this: ID in..

Should I check in folder "node_modules" to Git when creating a Node.js app on Heroku?

I followed the basic getting started instructions for Node.js on Heroku here: https://devcenter.heroku.com/categories/nodejs These instruction don't tell you to create a .gitignore node_modules, and t..

Remove characters after specific character in string, then remove substring?

I feel kind of dumb posting this when this seems kind of simple and there are tons of questions on strings/characters/regex, but I couldn't find quite what I needed (except in another language: Remove..

how can I login anonymously with ftp (/usr/bin/ftp)?

I'm trying to connect to an FTP server which allows anonymous access, I don't know how to specify the appropriate username/password required to do this though. I've tried using anonymous/anonymous as..

How to get the first item from an associative PHP array?

If I had an array like: $array['foo'] = 400; $array['bar'] = 'xyz'; And I wanted to get the first item out of that array without knowing the key for it, how would I do that? Is there a function for..

Explanation of the UML arrows

I have recently been studying UML and drawing simple diagrams with ordinary plain arrows between classes, but I know it's not enough. There are plenty of other arrows: generalization, realisation and ..

Error importing SQL dump into MySQL: Unknown database / Can't create database

I'm confused how to import a SQL dump file. I can't seem to import the database without creating the database first in MySQL. This is the error displayed when database_name has not yet been created:..

Send data from activity to fragment in Android

I have two classes. First is activity, second is a fragment where I have some EditText. In activity I have a subclass with async-task and in method doInBackground I get some result, which I save to va..

HTTP Status 404 - The requested resource (/) is not available

I integrated Tomcat 7 in Eclipse. When I start it using Eclipse, it shows that Tomcat is up and running, but when I go to http://localhost:8080 in my browser, it gives me following error: HTTP Sta..

How to detect when a youtube video finishes playing?

I am working on a site that has a ton of embedded youtube videos, the client wants to show a popup whenever a video stops splaying. I looked at the youtube api and there seems to be a way to detect w..

window.onload vs <body onload=""/>

What exactly is the difference between the window.onload event and the onload event of the body tag? when do I use which and how should it be done correctly?..

How to find unused/dead code in java projects

What tools do you use to find unused/dead code in large java projects? Our product has been in development for some years, and it is getting very hard to manually detect code that is no longer in use...

Where are the recorded macros stored in Notepad++?

I have recorded a macro that I want to share with my work colleague. In what location are these recorded macros saved, so that I can add it to his machine? If interested, the macro is for taking a l..

Change label text using JavaScript

Why doesn't the following work for me? <script> document.getElementById('lbltipAddedComment').innerHTML = 'Your tip has been submitted!'; </script> <label id="lbltipAddedComment"&g..

Jquery: Find Text and replace

<div id="id1"> <p> apple </p> <p> ball </p> <p> cat </p> <p> dogsss </p> </div> How Do I change dogsss to dollsss usin..

Logical operators for boolean indexing in Pandas

I'm working with boolean index in Pandas. The question is why the statement: a[(a['some_column']==some_number) & (a['some_other_column']==some_other_number)] works fine whereas a[(a['some_colu..

Is it possible to run CUDA on AMD GPUs?

I'd like to extend my skill set into GPU computing. I am familiar with raytracing and realtime graphics(OpenGL), but the next generation of graphics and high performance computing seems to be in GPU c..

Check if passed argument is file or directory in Bash

I'm trying to write an extremely simple script in Ubuntu which would allow me to pass it either a filename or a directory, and be able to do something specific when it's a file, and something else whe..

The type or namespace cannot be found (are you missing a using directive or an assembly reference?)

I get the following error when I try to compile my C# program: The type or namespace name 'Login' could not be found (are you missing a using directive or an assembly reference?) using System; us..

Transpose/Unzip Function (inverse of zip)?

I have a list of 2-item tuples and I'd like to convert them to 2 lists where the first contains the first item in each tuple and the second list holds the second item. For example: original = [('a',..

How to reverse a singly linked list using only two pointers?

I wonder if there exists some logic to reverse a singly-linked list using only two pointers. The following is used to reverse the single linked list using three pointers namely p, q, r: struct node ..

is inaccessible due to its protection level

I can't figure this out. The problem is that the distance, club, cleanclub, hole, scores and par all say inaccessible due to protection level and I don't know why because I thought I did everything ri..

What exactly is a Context in Java?

I Googled this and read the Java documentation, but I'm a bit confused. Can somebody please explain what a Context is in plain English? ..

Combining two sorted lists in Python

I have two lists of objects. Each list is already sorted by a property of the object that is of the datetime type. I would like to combine the two lists into one sorted list. Is the best way just to d..

How to validate date with format "mm/dd/yyyy" in JavaScript?

I want to validate the date format on an input using the format mm/dd/yyyy. I found below codes in one site and then used it but it doesn't work: function isDate(ExpiryDate) { var objDate, // ..

How to manually update datatables table with new JSON data

I am using plugin jQuery datatables and load my data which I have loaded in DOM at the bottom of page and initiates plugin in this way: var myData = [ { "id": 1, "first_name": "Jo..

Angularjs ng-model doesn't work inside ng-if

Here is the fiddle showing the problem. http://jsfiddle.net/Erk4V/1/ It appears if I have an ng-model inside of an ng-if, the model does not work as expected. I am wondering if this is a bug or if I..

How can I change property names when serializing with Json.net?

I have some data in a C# DataSet object. I can serialize it right now using a Json.net converter like this DataSet data = new DataSet(); // do some work here to populate 'data' string output = JsonCo..

MySQL compare now() (only date, not time) with a datetime field

I have a duedate column(datetime format) that specifies the due date of a ticket, now i need to get 'Due today' tickets base on the comparison between now() with duedate. i.e 2010-04-29 02:00 vs 2010-..

How to escape JSON string?

Are there any classes/functions available to be used for easy JSON escaping? I'd rather not have to write my own...

How to remove all click event handlers using jQuery?

I'm having a problem. Basically, when a user clicks an 'Edit' link on a page, the following Jquery code runs: $("#saveBtn").click(function () { saveQuestion(id); }); By doing this, the onClick ..

Environ Function code samples for VBA

I am looking for some information or code samples for the Environ Function in VBA to grab the username on the current system...

How can I find out what version of git I'm running?

I'm trying to follow some tutorials to learn how to use Git but some of the instructions are for specific versions. Is there a command that I can use find out what version I have installed?..

How to change the color of a button?

I'm new to android programming. How do I change the color of a button? <Button android:id="@+id/btn" android:layout_width="55dp" android:layout_height="50dp" android:layout_gravity..

What svn command would list all the files modified on a branch?

In svn, I have a branch which was created, say at revision 22334. Commits were then made on the branch. How do I get a list of all files that were changed on the branch compared to what's on the trun..

Loop through all nested dictionary values?

for k, v in d.iteritems(): if type(v) is dict: for t, c in v.iteritems(): print "{0} : {1}".format(t, c) I'm trying to loop through a dictionary and print out all key value p..

How do I retrieve my MySQL username and password?

I lost my MySQL username and password. How do I retrieve it?..

How can I check if a URL exists via PHP?

How do I check if a URL exists (not 404) in PHP?..

Email and phone Number Validation in android

I have a registration form in my application which I am trying to validate. I'm facing some problems with my validation while validating the phone number and email fields. Here is my code: privat..

Yum fails with - There are no enabled repos.

I'm trying to install "libstdc++.i686" with yum install libstdc++.i686 but it failes beacuse of this error: qa@qa-teamcity01:/usr/local/nsis/nsis-2.46-src$ sudo yum install libstdc++.i686 ..

C++ Structure Initialization

Is it possible to initialize structs in C++ as indicated below struct address { int street_no; char *street_name; char *city; char *prov; char *postal_code; }; address temp_addres..

How do you check in python whether a string contains only numbers?

How do you check whether a string contains only numbers? I've given it a go here. I'd like to see the simplest way to accomplish this. import string def main(): isbn = input("Enter your 10 digi..

Set default value of javascript object attributes

Is there a way to set the default attribute of a javascript object such that: var emptyObj = {}; // do some magic emptyObj.nonExistingAttribute // => defaultValue IE can be disregarded, Chrome F..

How to get index of object by its property in JavaScript?

For example, I have: var Data = [ { id_list: 1, name: 'Nick', token: '312312' }, { id_list: 2, name: 'John', token: '123123' }, ] Then, I want to sort/reverse this object by name, for example. ..

Best way to convert pdf files to tiff files

I have around 1000 pdf filesand I need to convert them to 300 dpi tiff files. What is the best way to do this? If there is an SDK or something or a tool that can be scripted that would be ideal. ..

Disable Button in Angular 2

I want if the input 'Contract type' is empty, the button 'Save' is not clickable Save button: <div class="col-md-4"> <cic-textbox [control]="formGroup.get('contractType')"></..

Array or List in Java. Which is faster?

I have to keep thousands of strings in memory to be accessed serially in Java. Should I store them in an array or should I use some kind of List ? Since arrays keep all the data in a contiguous chunk..

Install Windows Service created in Visual Studio

When I create a new Windows Service in Visual Studio 2010, I get the message stating to use InstallUtil and net start to run the service. I have tried the following steps: Create new project File -..

Up, Down, Left and Right arrow keys do not trigger KeyDown event

I am building an application where all the key input must be handled by the windows itself. I set tabstop to false for each control witch could grab the focus except a panel (but I don't know if it h..

Is it necessary to assign a string to a variable before comparing it to another?

I want to compare the value of an NSString to the string "Wrong". Here is my code: NSString *wrongTxt = [[NSString alloc] initWithFormat:@"Wrong"]; if( [statusString isEqualToString:wrongTxt] ){ ..

How to solve PHP error 'Notice: Array to string conversion in...'

I have a PHP file that tries to echo a $_POST and I get an error, here is the code: echo "<html>"; echo "<body>"; for($i=0; $i<5;$i++){ echo "<input name='C[]' value='$Texting[$..

Support for ES6 in Internet Explorer 11

According to this page http://kangax.github.io/compat-table/es6/, ES6 features are not implemented in IE 11. Does IE 11 have a plan for implementing them one day or can I forget about it? Is there a..

Find the closest ancestor element that has a specific class

How can I find an element's ancestor that is closest up the tree that has a particular class, in pure JavaScript? For example, in a tree like so: <div class="far ancestor"> <div class="n..

How to update the value stored in Dictionary in C#?

How to update value for a specific key in a dictionary Dictionary<string, int>?..

Shell script not running, command not found

I am very, very new to UNIX programming (running on MacOSX Mountain Lion via Terminal). I've been learning the basics from a bioinformatics and molecular methods course (we've had two classes) where w..

Get only part of an Array in Java?

I have an array of Integers in Java, I would like use only a part of it. I know in Python you can do something like this array[index:] and it returns the array from the index. Is something like this p..

All possible array initialization syntaxes

What are all the array initialization syntaxes that are possible with C#?..

Using a custom (ttf) font in CSS

I have a mac, and have installed a font called "7 Segment" (it shows up in Font Book). When I use font-family: "7 Segment"; I get Helvetica (or similar) rather than the browser's default font, but it ..

Two statements next to curly brace in an equation

How can I write an equation with one curly brace ({), and on the right-hand side next to the curly, two statements in two different lines?..

"Bitmap too large to be uploaded into a texture"

I'm loading a bitmap into an ImageView, and seeing this error. I gather this limit relates to a size limit for OpenGL hardware textures (2048x2048). The image I need to load is a pinch-zoom image of a..

SQL Not Like Statement not working

I have the following code within a stored procedure. WHERE WPP.ACCEPTED = 1 AND WPI.EMAIL LIKE '%@MATH.UCLA.EDU%' AND (WPP.SPEAKER = 0 OR WPP.SPEAKER IS NULL) AND WPP.COMMENT NOT ..

How get sound input from microphone in python, and process it on the fly?

Greetings, I'm trying to write a program in Python which would print a string every time it gets a tap in the microphone. When I say 'tap', I mean a loud sudden noise or something similar. I searche..

How do I separate an integer into separate digits in an array in JavaScript?

This is my code so far: var n = 123456789; var d = n.toString().length; var digits = []; var squaredDigits = []; for (i = d; i >= 1; i--) { var j = k / 10; var r = (n % k / j) - 0.5; v..

Find a value in an array of objects in Javascript

I know similar questions have been asked before, but this one is a little different. I have an array of unnamed objects, which contain an array of named objects, and I need to get the object where "na..

How to get difference between two rows for a column field?

I have a table like this: rowInt Value 2 23 3 45 17 10 9 0 .... The column rowInt values are integer but not in a sequence with same increament. I can use the following sql ..

form serialize javascript (no framework)

Wondering is there a function in javascript without jquery or any framework that allows me to serialize the form and access the serialized version?..

Java: Multiple class declarations in one file

In Java, you can define multiple top level classes in a single file, providing that at most one of these is public (see JLS §7.6). See below for example. Is there a tidy name for this technique (a..

How to create large PDF files (10MB, 50MB, 100MB, 200MB, 500MB, 1GB, etc.) for testing purposes?

I tried this for ((i=1; i<=10; i++)); do convert 100MB.pdf 10MB.pdf 100MB.pdf; done to create 100MB file but very quickly run out of RAM. Any ideas?..

How to open a different activity on recyclerView item onclick

i am using a recyclerView to show my listitems in the navigation drawer.I have implemented the onclickListener but i have been stuck on how to open a different activity when items are clicked. All my ..

SyntaxError: unexpected EOF while parsing

I am getting error while running this part of the code. tried some of the existing solutions, none of them helped elec_and_weather = pd.read_csv(r'C:\HOUR.csv', parse_dates=True,index_col=0) # Add hi..

Convert array of JSON object strings to array of JS objects

I would like to convert an array of JSON String to array of JSON object without looping through each item and parse it using JSON.parse. Example: var s=[ '{"Select":"11", "PhotoCount":"12"}', '{..

How to install node.js as windows service?

I have downloaded node.js executable. How can I run that executable as windows service? I cannot use standard node.js installer, since I need to run multiple version of node.js concurrently...

ASP.NET MVC Html.DropDownList SelectedValue

I have tried this is RC1 and then upgraded to RC2 which did not resolve the issue. // in my controller ViewData["UserId"] = new SelectList( users, "UserId", "DisplayName", selected..

Using Excel VBA to run SQL query

I am fairly new to SQL and VBA. I have written a SQL query that I would like to be able to call and run from a VBA sub in an excel workbook and then bring the query results into the workbook. I have f..

How to use the pass statement?

I am in the process of learning Python and I have reached the section about the pass statement. The guide I'm using defines it as being a Null statement that is commonly used as a placeholder. I sti..

How do I find all the files that were created today in Unix/Linux?

How do I find all the files that were create only today and not in 24 hour period in unix/linux..

How to run 'sudo' command in windows

How would I run the following command in windows: $ sudo django-admin.py startproject NEW ?..

Field 'browser' doesn't contain a valid alias configuration

I've started using webpack2 (to be precise, v2.3.2) and after re-creating my config I keep running into an issue I can't seem to solve I get (sorry in advance for ugly dump): ERROR in ./src/main.js M..

How to use PrintWriter and File classes in Java?

I am trying to understand PrintWriter for a small program I'm making, and I cant seem to get java to make the file and then write on it. When I execute the program below it gives me a Filenotfoundexep..

Converting between datetime and Pandas Timestamp objects

I have the following: > date1 Timestamp('2014-01-23 00:00:00', tz=None) > date2 datetime.date(2014, 3, 26) and I read on this answer that I could use pandas.to_datetime() to convert from Tim..

How to get a ListBox ItemTemplate to stretch horizontally the full width of the ListBox?

I want to have the ListItems to extend with their orange background the full width of the Listbox. Currently they are only as wide as the FirstName + LastName. I've set every element I can to: Horiz..

Open images? Python

Im creating a text based labryinth game, but I figured it needed some pictures to illustrate whats going on. For some reason it just dies when I try to go to a2(Where the picture should pop up). I am ..

Get value (String) of ArrayList<ArrayList<String>>(); in Java

I know it's simple question, but in ArrayList<ArrayList<String>> collection; ArrayList<String> listOfSomething; collection= new ArrayList<ArrayList<String>>(); listOfSom..

MySQL INNER JOIN Alias

Does anyone know how I can do an inner joins and alias values within so they won't overwrite each other? It might look more clear if you see my code: SELECT home, away, g.network, g.date_start ..

How can I mock an ES6 module import using Jest?

I want to test that one of my ES6 modules calls another ES6 module in a particular way. With Jasmine this is super easy -- The application code: // myModule.js import dependency from './dependency'; ..

How can I customize the tab-to-space conversion factor?

How do I customize the tab-to-space conversion factor when using Visual Studio Code? For instance, right now in HTML it appears to produce two spaces per press of TAB, but in TypeScript it produces 4..

angular 4: *ngIf with multiple conditions

I'm confused a bit. I need to hide block if result have one of several cases. But seems it not working correctly... <div *ngIf="currentStatus !== 'open' || currentStatus !== 'reopen' "> &l..

How to get javax.comm API?

I'd recently downloaded a project on SMS sending, but when I tries to compile the code it gives error on line import javax.comm.*;. Can anybody tell me where to find javax.comm and where to place s..

How to escape double quotes in a title attribute

I am trying to use a string that contains double quotes in the title attribute of an anchor. So far I tried these: <a href=".." title="Some \"text\"">Some text</a> <!-- The title looks..

how to show alternate image if source image is not found? (onerror working in IE but not in mozilla)

I need to show an alternate image in cell of table if source image is not found. Currently below code is used to do so. cell.innerHTML="<img height=40 width=40 src='<%=request.getContextPath()%..

"git checkout <commit id>" is changing branch to "no branch"

I am working on a branch in git. When I do git checkout <commit id> (commit id obtained from git log ), it is getting committed to that particular change but branch is changed to <No-branc..

MySQL's now() +1 day

I'm using now() in MySQL query. INSERT INTO table SET data = '$data', date = now() But I want to add 1 day to this date (so that date should contain tomorrow). Is it possible?..

Only allow Numbers in input Tag without Javascript

I am fairly new. I am creating a webpage that ask a user for their ID. I want it to be a required field and only allow numbers. I appreciate if you lead me in the correct direction. this is what I ha..

How do I get the old value of a changed cell in Excel VBA?

I'm detecting changes in the values of certain cells in an Excel spreadsheet like this... Private Sub Worksheet_Change(ByVal Target As Range) Dim cell As Range Dim old_value As String Dim new_value A..

PostgreSQL database default location on Linux

What is the default directory where PostgreSQL will keep all databases on Linux?..

Use of #pragma in C

What are some uses of #pragma in C, with examples?..

How do check if a parameter is empty or null in Sql Server stored procedure in IF statement?

I read this: How do I check if a Sql server string is null or empty but it not helped me in this situation. The piece of code from my stored procedure: IF (@item1 IS NOT NULL) OR (LEN(@item1) > 0..

How to get the excel file name / path in VBA

Say, I'm writing a VBA inside my excel file sample.xls. Now I want to get the full path of sample.xls in my VBA. How do I do it?..

Get Table and Index storage size in sql server

I want to get table data and index space for every table in my database: Table Name Data Space Index Space ------------------------------------------------------- How can I ac..

Object of class DateTime could not be converted to string

I have a table with string values in the format of Friday 20th April 2012 in a field called Film_Release I am looping through and i want to convert them in datetime and roll them out into another tab..

Pick a random value from an enum?

If I have an enum like this: public enum Letter { A, B, C, //... } What is the best way to pick one randomly? It doesn't need to be production quality bulletproof, but a fairly even..

ASP.NET Button to redirect to another page

How do I code the button such that when I click the button and it brings me to another web form? Let's say the button name is Confirm and the wed form is confirm.aspx ? protected void btnConfirm..

Turning off some legends in a ggplot

Suppose I have a ggplot with more than one legend. mov <- subset(movies, length != "") (p0 <- ggplot(mov, aes(year, rating, colour = length, shape = mpaa)) + geom_point() ) I can turn off t..

PHP get dropdown value and text

<select id="animal" name="animal"> <option value="0">--Select Animal--</option> <option value="1">Cat</option> <option value="2">Dog</optio..

Weblogic Transaction Timeout : how to set in admin console in WebLogic AS 8.1

I face the following exception: weblogic.transaction.internal.TimedOutException: Transaction timed out after 300 seconds this is set within the Stateless Session EJB Bean as javax.transaction.Us..

text-align:center won't work with form <label> tag (?)

I was going through a site I have just completed, and fixing up some accessibility issues. I had a form: <input type="hidden" name="redirect" value="thank-you.php" /> <p>Enter your Email..

What is the difference between new/delete and malloc/free?

What is the difference between new/delete and malloc/free? Related (duplicate?): In what cases do I use malloc vs new?..

Decimal to Hexadecimal Converter in Java

I have a homework assignment where I need to do three-way conversion between decimal, binary and hexadecimal. The function I need help with is converting a decimal into a hexadecimal. I have nearly no..

What happens if you mount to a non-empty mount point with fuse?

I am new to fuse. When I try to run a FUSE client program I get this error: fuse: mountpoint is not empty fuse: if you are sure this is safe, use the 'nonempty' mount option I understand that a mou..

Saving plots (AxesSubPlot) generated from python pandas with matplotlib's savefig

I'm using pandas to generate a plot from a dataframe, which I would like to save to a file: dtf = pd.DataFrame.from_records(d,columns=h) fig = plt.figure() ax = dtf2.plot() ax = fig.add_subplot(ax) f..

How to use executables from a package installed locally in node_modules?

How do I use a local version of a module in node.js. For example, in my app, I installed coffee-script: npm install coffee-script This installs it in ./node_modules and the coffee command is in ./n..

Error handling in C code

What do you consider "best practice" when it comes to error handling errors in a consistent way in a C library. There are two ways I've been thinking of: Always return error code. A typical function..

Convert UNIX epoch to Date object

I'm plotting and performing calculations on uniformly distributed time series. The timestamps are currently stored as integers representing the number of seconds since the UNIX epoch (e.g. 1352068320)..

How to join a slice of strings into a single string?

package main import ( "fmt" "strings" ) func main() { reg := [...]string {"a","b","c"} fmt.Println(strings.Join(reg,",")) } gives me an error of: prog.go:10: cannot use reg (type [3]string) as..

Open S3 object as a string with Boto3

I'm aware that with Boto 2 it's possible to open an S3 object as a string with: get_contents_as_string() Is there an equivalent function in boto3 ? ..

Need to combine lots of files in a directory

I've got 50 to 60 files in a directory that I need to concatenate into a single file on a regular basis. I thought about using notepad++ thinking there was probably a plug-in that would help but ha..

React Native fixed footer

I try to create react native app that looks like existing web app. I have a fixed footer at bottom of window. Do anyone have idea how this can be achieved with react native? in existing app it's simp..

PHP sessions default timeout

Do PHP sessions timeout by default - ie without any coding on my part would a user eventually be "logged out" after some time of inactivity?..

Creating a file only if it doesn't exist in Node.js

We have a buffer we'd like to write to a file. If the file already exists, we need to increment an index on it, and try again. Is there a way to create a file only if it doesn't exist, or should I jus..

How do I exit the Vim editor?

I'm stuck and cannot escape. It says: "type :quit<Enter> to quit VIM" But when I type that it simply appears in the object body...

Sequence contains no elements?

I'm currently using a single query in two places to get a row from a database. BlogPost post = (from p in dc.BlogPosts where p.BlogPostID == ID select p).Single(); ..

Maven Error: Could not find or load main class

I'm using a Java Maven program and I don't know what to enter as the <mainClass>. I've tried all kinds of things based off of numerous stackoverflow questions, but they are not solving the erro..

The program can't start because libgcc_s_dw2-1.dll is missing

I have created a simple program in C++ with Code::Blocks. If I run it from Code::Blocks, it works correctly; but if I run it by doubleclicking on the executable file, a window pops up with this messa..

How to clear an ImageView in Android?

I am reusing ImageViews for my displays, but at some point I don't have values to put it. So how to clear an ImageView in Android? I've tried: mPhotoView.invalidate(); mPhotoView.setImageBitmap(nul..