Monday, 30 September 2013

Desktop icons missing after "logging on" to 13.04

Desktop icons missing after "logging on" to 13.04

So I signed in to my Ubuntu 13.04 (dual booted) computer today and I
noticed something strange, the unity lancher had appeared as soon as I
signed in, but sign in box has stayed where it is and not disappeared,
along with the Ubuntu logo and white dots all over the screen. In addition
to this my desktop icons have disappeared.
Any advice as how I could go about getting rid of the login screen and
retrieve my icons?
Cheers.

Hausdorff spaces from continuous functions

Hausdorff spaces from continuous functions

The question is to prove a topological space is Hausdorff if for every $p$
in the space there exists a continuous function $f_{p}$ such that
$f^{-1}(0) = \{p\}.$ (The inverse here is implied as converse, not a
bijective inverse).
My thinking is that if we take the open subset of $\mathbb{R}$ $(-1;1)$
for each $f$ since the map is continuous we get open sets containing
$p_i,$ and it boils down to showing the intersection is empty. I can't
quite follow this important part through.
Thanks in advance.

jquerymobile file input text is invisible on android 3.2 browser

jquerymobile file input text is invisible on android 3.2 browser

I'm using in a jquerymobile web application. It works good on several
platforms, but on samsung galaxy tab 10" (Android 3.2) file input filename
is not visible after file was selected. After some investigations I've
found that removing data-position="fixed" almost fix the problem (input
text is visible but shifted down).
Here is my test html.
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<link rel="stylesheet" href="css/jquery.mobile-1.3.1.css" />
<script src="js/jquery.mobile-1.3.1.js"></script>
<title>Test</title>
</head>
<body>
<div data-role="page">
<div data-role="panel" id="leftpanel">
left panel
</div>
<div data-role="header" data-position="fixed">
<h1>Test item</h1>
<a href="#leftpanel" data-role="button"
data-inline="true">left panel</a>
</div>
<div data-role="content">
<input type="file" data-clear-btn="true" id="file1">
</div>
</body>
</html>

PLEASE ANSWER THESE JAVA BASED QUESTIONS

PLEASE ANSWER THESE JAVA BASED QUESTIONS

TO READ HTML FROM ANY WEBSITE SAY "http://www.google.com"(you can use any
API of inbuilt APIs in java like URLConnection) 2.PRINT ON CONSOLE THE
HTML FROM THE URL ABOVE AND SAVE IT TO A FILE (web-content.txt) in local
machine. 3.JUnit test cases for the above programme.

Sunday, 29 September 2013

Recieve 400 Bad Request when using Jquery Form Plugin

Recieve 400 Bad Request when using Jquery Form Plugin

I changed my code to using the Jquery Form Plugin so that I could upload
pictures. My original form was simple
$.ajax({
type: "POST",
url: "register.htm",
data:{
account_name: $('#regAccount_name').val(),
pwd: MD5($('#regPwd').val()),
fname: $('#regFname').val(),
lname: $('#regLname').val(),
},
success: function(data){
changeMainIFrame('MenuFrame.jsp?regStatus=User Successfully
Registered');
},
error:function(e){
console.log("sendRegistration(): " + e);
}
});
but changed to this
var options = {
beforeSend: function()
{
//alert(MD5($('#regPwd').val()));
// document.getElementById('regPwd').value =
MD5($('#regPwd').val());
},
uploadProgress: function(event, position, total, percentComplete)
{
},
success: function()
{
changeMainIFrame('MenuFrame.jsp?regStatus=User Successfully
Registered');
},
complete: function(response)
{
},
error: function(e)
{
console.log("sendRegistration(): " + e);
}
};
$("#regForm").ajaxForm(options);
However now I get a 400 Bad Request which I take it to mean the my
controller isn't even picking up the request. Here's my controller code:
@RequestMapping("/register.htm")
public String register(// @RequestParam("regProfilePic") File pic,
@RequestParam("regAccount_name") String account_name,
@RequestParam("pwd") String pwd,
@RequestParam("fname") String fname,
@RequestParam("lname") String lname,
ModelMap params){
setup();
System.out.println("Register");
service.registerUser(fname, lname, account_name, pwd);
return "MenuFrame";
}
Here's My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID"
version="3.0">
<display-name>Volt</display-name>
<welcome-file-list>
<welcome-file>Mugenjou.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>volts</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>volts</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>
and here's my servlet
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.mugenjou.control" />
<!-- /WEB-INF/jsp/VIEWNAME.jsp -->
<bean id="viewNameTranslator"
class="org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator"/>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- <property name="prefix" value="/WEB-INF/jsp/"/> -->
<property value="" name="prefix"/> <property value=".jsp"
name="suffix"/>
</bean>
</beans>
the html
<form id ='regForm' action="register.htm" method="POST"
enctype="multipart/form-data">
<table cellpadding=5>
<!-- <tr>
<td>Profile Picture <br> <input type = "file" id
="regProfilePic" name ="regProfilePic" /></td>
</tr> -->
<tr>
<td> *Account Name <br> <input id
="regAccount_name" name = "regAccount_name"
type="text" size ="20"
onblur="isAccount_name();registerBtn();"/></td>
<td>
<div id ="chkUserLb"></div>
</td>
</tr>
<tr>
<td> *Password <br> <input id = "regPwd" name =
"pwd" type="text" size ="20"
onblur="isPwd();registerBtn();"/></td>
<td id=chkPwdLb></td>
</tr>
<tr>
<td> *First Name <br> <input id = "regFname" name
="fname" type="text" size ="20"
onblur="isFname();registerBtn();"/></td>
<td id=chkFnameLb></td>
</tr>
<tr>
<td> *Last Name <br> <input id = "regLname" name =
"lname" type="text" size ="20"
onblur="isLname();registerBtn();"/></td>
<td id=chkLnameLb></td>
</tr>
<tr>
<td><input id = "regSubmitBtn" type="submit"
value="Submit" disabled></td>
</tr>
</table>
*Required
</form>

generate random string in php for file name

generate random string in php for file name

How would I go about creating a random string of text for use with file
names?
I am uploading photos and renaming them upon completion. All photos are
going to be stored in one directory so their filenames need to be unique.
Is there a standard way of doing this?

When should I prefer a clone over an reference in javascript?

When should I prefer a clone over an reference in javascript?

at the moment I'm writing a small app and came to the point, where I
thought it would be clever to clone an object, instead of using a
reference.
The reason I'm doing this is, because I'm collecting objects in a list.
Later I will only work with this list, because it's part of a model. The
reference isn't something I need and I want to avoid having references to
outside objects in the list, because I don't want someone to build a
construct, where the model can be changed from an inconsiderate place in
their code. (The integrity of the information in the model is very
important.)
Additional I thought I will get a better performance out of it, when I
don't use references.
So my overall question still is: When should I prefer a clone over an
reference in javascript?
Thanks!

Find MAC address of system, using python (in chat system)

Find MAC address of system, using python (in chat system)

is there anyway,to find MAC address of a device ( in chat system )using
python? except uuid library

Saturday, 28 September 2013

cakephp multiple domains & Configure::write

cakephp multiple domains & Configure::write

Running multiple domains on one install. In bootstrap I have:
Configure::write('Application.name', 'example1.com');
Configure::write('Application.name', 'example2.com');
What's the best way to define these variables so that I can check my main
domain and set them up all at once?

What does assertion failure mean in xcode?

What does assertion failure mean in xcode?

Currently following a checklists tutorial built with io6 in mind. I'm
using xcode 5, ios7 sdk. The tutorial hasn't been updated for IOS7 but I
didn't want to stop my learning so decided to go ahead and work with the
outdated tutorial and hopefully use it as a learning experience. Using
reading of official Apple docs and extensive googling as my guide along
the way.
Very early I've run into an issue already and not sure what is wrong. I
noticed that the autocomplete had part of the methods below crossed out (a
deprecation maybe?). The issue is definitely coming from the code below
because once I remove it the simulator loads the app fine.
Code causing crash:
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"ChecklistItem"];
return cell;
}
Here is the stack trace:
2013-09-28 20:51:26.208 Checklists[47289:a0b] *** Assertion failure in
-[UITableView _configureCellForDisplay:forIndexPath:],
/SourceCache/UIKit_Sim/UIKit-2903.2/UITableView.m:6235
2013-09-28 20:51:26.218 Checklists[47289:a0b] *** Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason:
'UITableView dataSource must return a cell from
tableView:cellForRowAtIndexPath:'
*** First throw call stack:
(
0 CoreFoundation 0x017335e4
__exceptionPreprocess + 180
1 libobjc.A.dylib 0x014b68b6
objc_exception_throw + 44
2 CoreFoundation 0x01733448 +[NSException
raise:format:arguments:] + 136
3 Foundation 0x0109723e
-[NSAssertionHandler
handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x00311ae5 __53-[UITableView
_configureCellForDisplay:forIndexPath:]_block_invoke + 426
5 UIKit 0x0028af5f +[UIView(Animation)
performWithoutAnimation:] + 82
6 UIKit 0x0028afa8 +[UIView(Animation)
_performWithoutAnimation:] + 40
7 UIKit 0x00311936 -[UITableView
_configureCellForDisplay:forIndexPath:] + 108
8 UIKit 0x00317d4d -[UITableView
_createPreparedCellForGlobalRow:withIndexPath:] + 442
9 UIKit 0x00317e03 -[UITableView
_createPreparedCellForGlobalRow:] + 69
10 UIKit 0x002fc124 -[UITableView
_updateVisibleCellsNow:] + 2378
11 UIKit 0x0030f5a5 -[UITableView
layoutSubviews] + 213
12 UIKit 0x00293dd7
-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
13 libobjc.A.dylib 0x014c881f -[NSObject
performSelector:withObject:] + 70
14 QuartzCore 0x03aed72a -[CALayer
layoutSublayers] + 148
15 QuartzCore 0x03ae1514
_ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
16 QuartzCore 0x03aed675 -[CALayer
layoutIfNeeded] + 160
17 UIKit 0x0034eca3 -[UIViewController
window:setupWithInterfaceOrientation:] + 304
18 UIKit 0x0026dd27 -[UIWindow
_setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:]
+ 5212
19 UIKit 0x0026c8c6 -[UIWindow
_setRotatableClient:toOrientation:updateStatusBar:duration:force:] +
82
20 UIKit 0x0026c798 -[UIWindow
_setRotatableViewOrientation:updateStatusBar:duration:force:] + 117
21 UIKit 0x0026c820 -[UIWindow
_setRotatableViewOrientation:duration:force:] + 67
22 UIKit 0x0026b8ba __57-[UIWindow
_updateToInterfaceOrientation:duration:force:]_block_invoke + 120
23 UIKit 0x0026b81c -[UIWindow
_updateToInterfaceOrientation:duration:force:] + 400
24 UIKit 0x0026c573 -[UIWindow
setAutorotates:forceUpdateInterfaceOrientation:] + 870
25 UIKit 0x0026fb66 -[UIWindow
setDelegate:] + 449
26 UIKit 0x00340dc7 -[UIViewController
_tryBecomeRootViewControllerInWindow:] + 180
27 UIKit 0x002657cc -[UIWindow
addRootViewControllerViewIfPossible] + 609
28 UIKit 0x00265947 -[UIWindow
_setHidden:forced:] + 312
29 UIKit 0x00265bdd -[UIWindow
_orderFrontWithoutMakingKey] + 49
30 UIKit 0x0027044a -[UIWindow
makeKeyAndVisible] + 65
31 UIKit 0x002238e0 -[UIApplication
_callInitializationDelegatesForURL:payload:suspended:] + 1851
32 UIKit 0x00227fb8 -[UIApplication
_runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:]
+ 824
33 UIKit 0x0023c42c -[UIApplication
handleEvent:withNewEvent:] + 3447
34 UIKit 0x0023c999 -[UIApplication
sendEvent:] + 85
35 UIKit 0x00229c35
_UIApplicationHandleEvent + 736
36 GraphicsServices 0x036862eb
_PurpleEventCallback + 776
37 GraphicsServices 0x03685df6 PurpleEventCallback
+ 46
38 CoreFoundation 0x016aedd5
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
39 CoreFoundation 0x016aeb0b
__CFRunLoopDoSource1 + 523
40 CoreFoundation 0x016d97ec __CFRunLoopRun + 2156
41 CoreFoundation 0x016d8b33
CFRunLoopRunSpecific + 467
42 CoreFoundation 0x016d894b CFRunLoopRunInMode
+ 123
43 UIKit 0x002276ed -[UIApplication
_run] + 840
44 UIKit 0x0022994b UIApplicationMain +
1225
45 Checklists 0x00001b7d main + 141
46 libdyld.dylib 0x01d6f725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Kind regards

Objective-C UICollectionView Scroll Up/Down

Objective-C UICollectionView Scroll Up/Down

Does anyone know, what method for UICollectionView, while scrolling
Up/Down. I need to change UICollectionView's Header while scrolling down.I
am doing own calendar View.
I have following method that creates header view for section
- (UICollectionReusableView *)collectionView:(UICollectionView
*)collectionView viewForSupplementaryElementOfKind:(NSString *)kind
atIndexPath:(NSIndexPath *)indexPath
{
ASCalendarHeaderView *calHeader = [self.calCollectView
dequeueReusableSupplementaryViewOfKind:kind
withReuseIdentifier:@"CalendarHeader" forIndexPath:indexPath];
calHeader.MonthYearLabel.text = [calendar
getCurrentMonthYear:calendar.today];
[calHeader setNeedsDisplay];
calHeader.MonthYearLabel.textAlignment = NSTextAlignmentRight;
if (indexPath.section){
[calendar getNextMonth:calendar.today];
NSLog(@"Some Text");
}
return calHeader;
}
But it increment month while I am scrolling up. Is there is method that
mean while scrolling up and while scrolling down separately?
Thanks

#EANF#

#EANF#

This is frustrating. I searched about it a lot but none of the results
help me. I tried subprocess but I still cant get it to work. Basically I
want to get this line to work:
appName = "ap01"
optna = "-server"
optnb = "-filename=c:/test.VS"
optnc = "-display=1"
os.system('start "VSM" "C:/bin/" {appName, optna, optnb, optnc} ')
In CMD I would simply type
CD C:/bin/
press enter and then:
ap01 -server -filename=C:/test.VS -display=1

Friday, 27 September 2013

About the EX1-9 of K&R

About the EX1-9 of K&R

Here's the text of Exercise 1-9 from the book 'The C programming language'
by Ritchie&Kernighan:
Write a program to copy its input to its output, replacing each string of
one or more blanks by a single blank.
To me the simplest way of solving that problem is writing
int single_byte = getchar();
while (single_byte != EOF) {
putchar(single_byte);
if (single_byte == ' ')
while ((single_byte = getchar()) == ' ')
;
else
single_byte = getchar();
}
though I was told (last night in the #c channel of irc.freenode.net) it
would be more readable getting rid of the nested while by implementing a
comparison between the last character saved and the one just read. What I
thought is kind of this:
int current_byte = getchar();
if (current_byte == EOF)
return 1;
putchar(current_byte);
int previous_byte = current_byte;
while ((current_byte = getchar()) != EOF) {
if (current_byte == ' ' && previous_byte == ' ')
;
else
putchar(current_byte);
previous_byte = current_byte;
}
that does not satisfy me at all: starting from the first if-statement (for
the case when there's nothing to read). Additionally I wish I could push
the last two lines before the while inside the loop; the less I should
distinguish the beginning from the rest of the execution, the happier I am
!

Swap Class of Element

Swap Class of Element

I have the following code:
<a href="#" class="more">text</a>
How can I toggle the class between "more" and "less" when clicked?
$('a').click(function (e) {
e.preventDefault();
var $this = $(this);
$this.toggleClass('more', 'less');
});
But I get the class changing from "more" to "" and not to less.
Thank You, Miguel

(CodeIgniter) Unable to add to Cart Class

(CodeIgniter) Unable to add to Cart Class

I've just started playing around with the shopping cart class for
CodeIgniter (version 2.1.4) and I've been following tutorials that help
explain it. But for some reason I am unable to successfully add a a simple
array to the cart.
Here is my implementation of the cart class:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Cart extends CI_Controller {
public function __construct() {
parent:: __construct();
}
public function index() {
$nav["navigation"] = $this->getCategory->getCategories();
$this->load->view("header");
$this->load->view("scripts");
$this->load->view("nav", $nav);
$this->load->view("cart");
$this->load->view("footer");
}
function add() {
$data = array(
"id" => "42",
"name" => "pants",
"quantity" => 1,
"price" => 19.99,
"options" => array("size" => "medium")
);
$this->cart->insert($data);
var_dump($this->cart->contents()); //This should output the array!
}
function show() {
$cart = $this->cart->contents();
echo "<pre>" . print_r($cart) . "</pre>"; //Nothing here either!
}
function update() {
$this->cart->update($data);
redirect(base_url()."cart");
}
function total() {
echo $this->cart->total();
}
function remove() {
$this->cart->update($data);
}
function destroy() {
$this->cart->destroy();
}
}
But if I go to the add function the var_dump just displays "array(0) { }".
Same result if I navigate to the show function.
Here is my autoload config showing that I have autoloaded the cart library
has been loaded:
$autoload['libraries'] = array("database", "session", "cart");
$autoload['helper'] = array("html", "url", "form");
I know it's something really simple and obvious I'm missing, but right now
I'm just left baffled. Any suggestions?

how the javascript compare the number and string?

how the javascript compare the number and string?

I know the meaning of ===, it will check whether the operand is identical
or notC so 1 === '1' will result false, but 1 == '1' result true, but
typeof 1 is number and typeof '1' is string, so how javascript compare 1
== '1', are there any converting, and how?

MVC3 Razor View Multi Select Dropdown

MVC3 Razor View Multi Select Dropdown

I want to create a multiselect dropdown (all options having checkbox to
select) in MVC3 razor view (cshtml).
I have searched it a lot and everywhere I found recommendations to use
Jquery plugins like chozen etc. Due to some constraints, I cannot use
external tools.

Thursday, 26 September 2013

IOS MDM-Managed Settings Command return CommandFormatError

IOS MDM-Managed Settings Command return CommandFormatError

I receive "CommandFormatError" on Managed Settings commands.
That's what I'm sending as a Settings command:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CommandUUID</key>
<string>123456</string>
<key>Command</key>
<dict>
<key>RequestType</key>
<string>Settings</string>
<key>Settings</key>
<array>
<dict>
<key>Item</key>
<string>VoiceRoaming</string>
<key>Enabled</key>
<true/>
</dict>
</array>
</dict>
</dict>
</plist>
Thank you in advance!

Wednesday, 25 September 2013

How to parse a telephone number from calendar Event.Description to textbox in android?

How to parse a telephone number from calendar Event.Description to textbox
in android?

I am using a calendar and the event description consists of some telephone
numbers how can i parse the numbers and put it in the textbox.Is there any
API for that in android?

Thursday, 19 September 2013

Left-floated div place below another div

Left-floated div place below another div

I have two divs whereas (div 1) is floated left while (div 2) is floated
right. I am creating a responsive layout where when the viewport changes,
(div 1) will go under (div 2). I created a simple image via MS Paint for
an easier illustration and also some code. Also, both contain dynamic
content so their heights must not be fixed.
No javascript (if possible) just plain CSS. I only know how to put div 2
under div 1 but not the other way around.
Does anyone know how I could achieve this?

HTML:
<div id="div1" style="float: left;">
//dynamic content
</div>
<div id="div2" style="float: right;">
//dynamic content
</div>

attempt to reopen an already-closed object: sqlitequery

attempt to reopen an already-closed object: sqlitequery

So essentially I am querying the DB twice. I don't understand where this
error is really coming from because I am not closing the DB anywhere. The
code that returns the error runs like this. I've checked around and I just
having seen a case like mine.
BeaconHandler pullAllDB = new BeaconHandler(this);
try {
List<Beacon> beaconsShown = pullAllDB.getAllBeacons();
for (final Beacon bn : beaconsShown) {
try {
int messageCount = pullAllDB.getMessageCount();
Log.d("Message", messageCount + " Messages Found");
if (messageCount > 0) {
//Do Something
} else {
// Do Nothing
}
}
catch (Exception e) {
e.getStackTrace();
Log.e("Message", e.getMessage());
}
}
}
And the code doing the queries...
public int getBeaconsCount() {
String countQuery = "SELECT * FROM " + TABLE_BASIC_BEACON;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(countQuery, null);
cursor.close();
// return count
return cursor.getCount();
}
public int getMessageCount() {
String mcountQuery = "SELECT * FROM " + MESSAGE_BEACON;
SQLiteDatabase mdb = this.getReadableDatabase();
Cursor mcursor = mdb.rawQuery(mcountQuery, null);
mcursor.close();
// return count
return mcursor.getCount();
}

How do I check if an email field is 1) empty and 2) contains a specific email address with jquery?

How do I check if an email field is 1) empty and 2) contains a specific
email address with jquery?

Not sure why my alerts aren't firing, but what I eventually would like to
do is enable the submit button when this field is not empty and contains a
specific email address, such as "@something.com"
First things first, I'm simply trying to check if the field is empty on
the change event.
HTML
<input type="email" id="email" placeholder="lauren@something.com">
JS
$("#email").change(function(){
if (this.is(':empty')) {
alert('empty');
} else {
alert('not empty');
}
});

Python string slice step?

Python string slice step?

I want to convert python codes to java. But I do not understand slicing
step parameter.
Example:
x = "Hello World !"
x[6:2:-1]
And what is the result x[6:2:-1] ?

MySQL: my.ini not read

MySQL: my.ini not read

I have MySQL 5.6 installed on Windows 7 64 Bit and I can't seem to get it
to read my my.ini file. I've put the file into the base installation
directory, the Windows directory and C:\, but it doesn't look like it's
being read, even though all paths are listed here:
http://dev.mysql.com/doc/refman/5.1/en/option-files.html
My my.ini file doesn't do much, I just took the my-default.ini as a base
and added [mysqld] max_allowed_packet=100000000 because that default limit
of 4MB is bad for BLOBs.
When I start mysql.exe and check the variable I find that it's still at
4MB, even after restarting the server (both via the services menu in the
control panel and via mysqld -shutdown + mysqld -startup) and restarting
Windows.
I have Windows 7, 64 bit. Can anyone help me, please?
Thanks in advance!
Alex

How to do not stop vribating when screen off

How to do not stop vribating when screen off

I have an application which vibrate when I press a button and I don't want
the vibrations stop when I turn off the screen.
Is it possible and if yes, how to do it ?
Thank you.

why am not able to add a bitmap to the bitmap arraylist

why am not able to add a bitmap to the bitmap arraylist

why am not able to add a bitmap in the bitmap array list inside asynktask.
public static class YourMoves_Players extends AsyncTask<String, String,
String> {
// static String yourmove_players[];
@Override
protected String doInBackground(String... args) {
boolean failure = false;
// TODO Auto-generated method stub
// Check for success tag
int success;
Log.d("login.on create","YOURMOVE_PLAYERS Background");
try {
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("playerid", fb_id));//player_id
Log.d("request!", "starting");
//Posting user data to script
JSONObject json = jsonParser.makeHttpRequest(
GETYOURMOVE_URL, "POST", params);
if(json == null)
{
Log.d("json","json returning null");
return null;
}
success = json.getInt(TAG_SUCCESS);
if (success == 1) {
products = json.getJSONArray(TAG_PRODUCTS);
Log.d("Notification","BEFORE FOR LOOP");
Log.d("",products.length()+" LENGTH");
for (int i = 0; i < products.length(); i++) {
JSONObject c = products.getJSONObject(i);
String yourmove_pid = c.getString(TAG_YOURMOVE_ID);
String player_name = c.getString(TAG_YOURMOVE_NAME);
// yourmove_pic.add(Get_FB_Image.getFBImage(yourmove_pid));
Players player=new Players(yourmove_pid,player_name);
yourmove_list.add(player);
yourmove_id.add(yourmove_pid);
yourmove.add(player_name);
Log.d("Vs_facebook","going to add bitmap facebook
image");
yourmove_pic.add(Get_FB_Image.getFBImage(yourmove_pid));
Log.d("Vs_facebook"," facebook image added");
Log.d("User Created!", json.toString()+"CONGRETS");
}
Log.d("","AFTER FOR LOOP yourmove_id "+yourmove_id);
return json.getString(TAG_MESSAGE);
}else{
Log.d("Login Failure!", "SUCCESS FAILED");
return json.getString(TAG_MESSAGE);
}
} catch (JSONException e) {
e.printStackTrace();
}
catch(Exception e){}
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
}
"yourmove_pic" is a bitmap array list and
"Get_FB_Image.getFBImage(yourmove_pid)" is the method from where am
getting the facebook profile image of a user. but my app get stuck before
executing this line . am getting the log message that i am printing before
executing this line.
so what is the problem please help
my Logcat message ----->
09-19 10:21:48.999: I/Choreographer(2115): Skipped 77 frames! The
application may be doing too much work on its main thread.
09-19 10:21:49.300: I/Choreographer(2115): Skipped 194 frames! The
application may be doing too much work on its main thread.
09-19 10:21:49.350: D/Vs_facebook(2115): inside on start
09-19 10:21:49.390: D/(2115): Vs_FACEBOOK ON RESUME BEFORE ShowList
09-19 10:21:52.509: D/login.on create(2115): YOURMOVE_PLAYERS Background
09-19 10:21:52.560: D/request!(2115): starting
09-19 10:21:54.980: D/Notification(2115): BEFORE FOR LOOP
09-19 10:21:54.980: D/(2115): 4 LENGTH
09-19 10:21:55.000: D/Vs_facebook(2115): going to add bitmap facebook image

Concatinating values of a matching string in an arrray

Concatinating values of a matching string in an arrray

I have a string array[2] as follows:
1st Array 2nd Aray
"100101" "Testing123"
"100102" "Apple123"
"100101" "Dog123"
"100104" "Cat123"
"100101" "Animal123"
I would like to concatenate all elements of the 2nd array if the elements
in the first array match.
For example elements of the first array that match are "100101", "100101"
and "100101". So a string with the concatenated values of the respective
2nd array would be as follows:
"Testing123 Dog123 Animal123"
How could this be achieved elegantly?

Wednesday, 18 September 2013

Can we create iTunes or iExplorer like application?

Can we create iTunes or iExplorer like application?

Now I'm trying to create an application; using that desktop application we
can sync the iOS device and we can share the document with PC? Is it
possible?Can we create iTunes or iExplorer like like application?Is there
any certificate issue?

SQlite DB search where

SQlite DB search where

Edittexte yazdýðým isime göre veritabanýnda nasýl arama yapabilirim.
sample:phone book application
my code;
SQLiteDatabase vt = VtArac.getReadableDatabase(); Cursor VTYeri =
vt.query(DatabaseHelper.VT_TABLO, new String[]{ "Id", "banka", "sira",
"kod", "aktif", "rea", "kap", "Ryzde", "Kyzde"}, "Id" + "=" + "1", null,
null, null,null, null); startManagingCursor(VTYeri);
while(VTYeri.moveToNext()) { String Id_Degiskeni =
VTYeri.getString((VTYeri.getColumnIndex("Id")));
IDDD.setText(Id_Degiskeni.toString()); String banka_Degiskeni =
VTYeri.getString((VTYeri.getColumnIndex("banka")));
editText1.setText(banka_Degiskeni.toString()); String sira_Degiskeni =
VTYeri.getString((VTYeri.getColumnIndex("sira")));
editText2.setText(sira_Degiskeni.toString()); String kod_Degiskeni =
VTYeri.getString((VTYeri.getColumnIndex("kod")));
editText3.setText(kod_Degiskeni.toString()); String aktif_Degiskeni =
VTYeri.getString((VTYeri.getColumnIndex("aktif")));
aktif.setText(aktif_Degiskeni.toString()); String rea_Degiskeni =
VTYeri.getString((VTYeri.getColumnIndex("rea")));
reaktif.setText(rea_Degiskeni.toString()); String kap_Degiskeni =
VTYeri.getString((VTYeri.getColumnIndex("kap")));
kapasitif.setText(kap_Degiskeni.toString()); String Ryzde_Degiskeni =
VTYeri.getString((VTYeri.getColumnIndex("Ryzde")));
Ryuzde.setText(Ryzde_Degiskeni.toString()); String Kyzde_Degiskeni =
VTYeri.getString((VTYeri.getColumnIndex("Kyzde")));
Kyuzde.setText(Kyzde_Degiskeni.toString()); } } });

filtering a listbox using a textbox in ms access 2010

filtering a listbox using a textbox in ms access 2010

I would like to filter a listbox using a textbox in MS Access 2010. Can
anyone show me how to fix what I have below so that the textbox input
actually filters the listbox?
I have a listbox named lstbxClients whose contents I want to filter using
input from a textbox called txtFilterClients. The rowsource property of
lstbxClients is set to:
SELECT Clients.ClientNumber, Clients.FullName FROM Clients ORDER BY
Clients.[FullName];
The image below shows the layout, along with the property sheet and
expression builder open to illustrate the expression that I added to the
On Change event of txtFilterClients:

(trying to define a S3 function using UseMethod)

(trying to define a S3 function using UseMethod)

I am new to the programming R. I defined a function called liw.mstreeClass
and I defined as below, but when I run the program I am keep getting the
following errors:
# define method: lcosts(generic dispatch)
liw.mstreeClass <- function(nb, data, method, p) UseMethod("nbcosts"){
Error: unexpected '{' in "liw.mstreeClass <- function(nb, data, method, p)
UseMethod("nbcosts"){"
if(method=="penrose") { liw <-
mat2listw(penroseDis.mstreeClass((scale(data))))
return(liw)}
Error: object 'method' not found } Error: unexpected '}' in " }"
could someone help me? thanks :)

Bootstrap 3 button-group and input-group in one row

Bootstrap 3 button-group and input-group in one row

if you have a look at the following example, you can see that the
input-group is bwloe the button-group:
http://bootply.com/81723
I already tried putting both groups into floating divs, but the browsers
still break the row. I noticed that ".btn-group, .btn-group-vertical"
contain a "display: inline-block". After commenting this line out, the row
doesn't break, but i don't have a space between both div (although I
thought to get one by "padding-right: 16px")

Oracle return custom type as SQL rows in package

Oracle return custom type as SQL rows in package

I'm aiming to define a custom type for an employee (ID and name), and then
a custom type for a table of employees. I have created a function within a
package that returns the table of employees type. All of this compiles
fine.
The problem is when I try to call the function and retrieve the results as
SQL rows, Oracle produces the error:
ORA-00902: invalid datatype
Package specification:
type t_employee is record
(
id number,
name varchar2(300),
);
type t_employees is table of t_employee index by pls_integer;
function get_employees(input1 varchar2) return t_employees;
Package body:
function get_employees(input1 varchar2)
return t_employees
is
employee_list t_employees;
begin
employee_list(1).id := 123;
employee_list(1).name := 'Stan';
employee_list(2).id := 456;
employee_list(2).name := 'Jan';
return employee_list;
end get_employees;
I call it through the apex SQL Workshop like so:
select * from table(my_pkg.get_employees('some input'))
This then gives the invalid datatype error. How can I return this custom
type as SQL rows (in the same way as if I was querying a standard table)?

Tuesday, 17 September 2013

pagination not working after doing filter inKendo grid

pagination not working after doing filter inKendo grid

I am having an mvc application and my view is .cshtml. I am making a Kendo
grid by using DataSource with server binding , I have made my own
pagination for setting the page size . I ran into one issue that when i
filtered the data and then done my own pagination then it does not work as
in Kendo grid in url there comes Grid-page-size which set first times and
it never changed .
How can i solve this ? It will be appreciable if anyone solved this problem?
Here is my code for grid :-
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(o => o.info).Title("Info").Width("150px");
columns.Bound(o => o.name).Title("Name").Width("90px");
columns.Bound(o => o.address).Title("Address").Width("100px");
columns.Bound(o => o.city).Title("City").Width("85px");
columns.Bound(o => o.state).Title("State").Width("90px");
})
.DataSource(dataSource => dataSource.Server()
.PageSize(Convert.ToInt16(ViewData["PageSize"]))
).Pageable(pager => pager
.Refresh(true)
.Numeric(true)
).Scrollable(scrolling => scrolling.Height("*"))
.Sortable()
.Resizable(resizing => resizing.Columns(true))
.Filterable(filtering => filtering.Enabled(true))
.ColumnMenu()
)

how to change to a new activity from a button click inside a fragmenttab

how to change to a new activity from a button click inside a fragmenttab

Hi i'm working on a app that has swipe tabs inside the tabs there is
buttons so for example fragmenttab1 has Algabra button i want it when the
user clicks this button it takes them to AlgabraHome.class i have no idea
how to do this any help would be amazing!
fragmanttab1.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/algabra"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="Algabra" />
<Button
android:id="@+id/geomtery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/algabra"
android:layout_below="@+id/algabra"
android:layout_marginTop="75dp"
android:text="geomtery" />
</RelativeLayout>
FragmentTab1.java
package com.androidbegin.absviewpagertutorial;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.actionbarsherlock.app.SherlockFragment;
public class FragmentTab1 extends SherlockFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Get the view from fragmenttab1.xml
View view = inflater.inflate(R.layout.fragmenttab1, container,
false);
return view;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
setUserVisibleHint(true);
}
}
if you need anything else please let me know
i'm new to android development and am learning so no non helpful comments
please :)
Thanks

on ajax the echo function is not working

on ajax the echo function is not working

I got problem in output of ajax, its not working but when i play it
seperate on new page it works. I did noConflict and other things but not
working still please help..
this is what i want to echo when ajax call -
<link href="http://xoxco.com/projects/code/tagsinput/jquery.tagsinput.css"
rel="stylesheet" type="text/css">
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
var dam123 = jQuery.noConflict();
</script>
<script type="text/javascript"
src="http://xoxco.com/projects/code/tagsinput/jquery.tagsinput.js"></script>
<script type="text/javascript">
var dam123 = jQuery.noConflict();
</script>
<script type="text/javascript">
dam123(function() {
dam123("#tags_1").tagsInput({
// my parameters here
});
});
</script>
<body onload="javascript://dam123();">
<input id="tags_1" value="alpha,beta,gamma" />

neo4j cypher index query

neo4j cypher index query

I was used to use node_auto_index( condition ) to search for nodes using
indexes, but now i used batch-import (
https://github.com/jexp/batch-import/ ) and it created indexes with
specific names ( type, code, etc ). So, how to do a cypher query using
indexes on multiple properties ?
old query example :
START n = node : node_auto_index( 'type: NODE_TYPE AND code: NODE_CODE' )
RETURN n;
how to do the 'same' query but without node_auto_index and specific index
names ?
START n = node : type( "type = NODE_TYPE" ) RETURN n;

How to output currency symbols with Prawn?

How to output currency symbols with Prawn?

I am trying to output currency symbols in Prawn with a helper method like
this:
def price(number)
@view.number_to_currency(number, :unit => "&euro;")
end
I then use it like this:
price(@invoice.total)
Unfortunately it's not working and instead of € I get &euro; in my PDF
documents.
(The same number_to_currency function works great outside of Prawn by the
way.)
Can anybody help?

MATLAB/Octave - Problems with mesh plot

MATLAB/Octave - Problems with mesh plot

I am trying to mesh the following function in Octave:
function C = istep(x)
A = x < 0.75
B = x > 0.25
C = A & B
endfunction
D = rand(10);
mesh(istep(D));
using 10x10 (random) matrix as an input. The mesh function however fails
and fires
invalid value for array property "zdata"
Note: Meshing D itself works fine. The function istep also returns 10x10
"matrix" with expected values. I suspect the error lies in the fact that
the internal format of the output is not treated as a matrix, but rather
as a data "array" or something more abstract. I am not sure how to change
it however.
Also, multiplying the output by eye(size(D)) solves the issue and allows
to plot the matrix (i suspect it casts the output to matrix
automatically). I do not find this very elegant though and would like to
avoid it if possible.
Edit: spy() works fine directly on the output, without need of
multiplication by eye()
Question: What shall I change in the code so I am able to plot the matrix
istep(D)?

Sunday, 15 September 2013

Optimal number of database connections (node-mysql)

Optimal number of database connections (node-mysql)

By default, node-mysql limits the maximum number of mysql connections in a
connection pool to 10.
Is there an optimal number of connections I should set it to? ( is there a
number beyond which performance degrades, instead of increasing? )
Thanks

Google Script for Spreadsheet - how can I prompt the user to select a range?

Google Script for Spreadsheet - how can I prompt the user to select a range?

I've been doing a lot of work with Google Script to automate some peer
evaluation processes.
One result is a spreadsheet with a lot of review data that I need to sort,
group and summarize. The script is working fine for the hard-coded sort
column.
But I really want to be able to sort on different columns at different
times, and I'd like the sort/group/summarize script to prompt the user to
select the sort/group column at runtime.
I've explored the UI stuff a bit, but I haven't seen how to prompt the
user to select a range (or column or anything else) on the sheet.
Thanks in advance.

Yii url rewriting is not working for Multi Language Website

Yii url rewriting is not working for Multi Language Website

I am creating a website in two languages i.e. English and French. so i am
using this approach to make it possible.
SEO-conform-multilingual-urls-language-selector-widget
Everything is working fine by using this but url rwrite.
I have tried all of these below mentioned one by one but had no luck to
get desired one.
'<language:(en|es)>/our-services'=>'services/index' and
'<language:(en|es)>/<controller:services>/<action:index>/*'=>'<controller>',
and
'our-services' => 'services/index'
i am calling index function of service controller in navigation bar as
$this->createUrl('/services/index')
and i have already tried it by removing first slash before services and
also by adding last slash after index but no luck.
I need to customize my url for any language i use. yeah for sure url will
be same for both language but the content of pages will be differ as per
language( text is working fine for each language as
`Yii::t('file_name','array_key_name'))
Please help me ASAP

Trigger image transition by hovering over a text link

Trigger image transition by hovering over a text link

OK, I'm a complete rookie and have gleemed the coding I have so far from
various resources online and adapted it to suit my needs, so be gentle :P
Basically, I have a nice CSS transition happening when hovering over an
image. However, I want to put a text link beneath said image, that will
trigger the same image transition when you hover over the text link. Is
this possible? I've been searching for a result for some time now and
still not cracked this one!
CSS
a.home:link {color:#040404; text-decoration:none; font-weight:bold;
font-family:"Lucida Console", Monaco, monospace; font-size:18px;}
a.home:visited {color:#040404; text-decoration:none; font-weight:bold;
font-family:"Lucida Console", Monaco, monospace; font-size:18px;}
a.home:hover {color:#E5712C; text-decoration:none; font-weight:bold;
font-family:"Lucida Console", Monaco, monospace; font-size:18px;}
a.home:active {color:#5F5F5F; text-decoration:none; font-weight:bold;
font-family:"Lucida Console", Monaco, monospace; font-size:18px;}
#crossfade
{
position: relative;
width: 200px;
height: 200px;
border: solid 2px #5f5f5f;
border-radius: 8px;
box-shadow: 0px 10px 5px #888888;
}
#crossfade img
{
position:absolute;
left:0;
opacity: 1;
-webkit-transition: opacity 0.8s ease-in-out;
-moz-transition: opacity 0.8s ease-in-out;
-o-transition: opacity 0.8s ease-in-out;
-ms-transition: opacity 0.8s ease-in-out;
transition: opacity 0.8s ease-in-out;
}
#crossfade img.top:hover {
opacity:0;
}
HTML
<div id="crossfade">
<img class="bottom"
src="http://www.officialdrivingtheory.co.uk/wp-content/uploads/TheoryTest-question.jpg"><a
href="http://www.livingthai.org/wp-content/uploads/2011/10/How-to-test-your-Thai-Language-ability.jpg"</a>
<img class="top"
src="http://www.dandybooksellers.com/acatalog/PracticalTest.jpg"/><a
href="http://www.livingthai.org/wp-content/uploads/2011/10/How-to-test-your-Thai-Language-ability.jpg"</a>
</div></br>
<a class ="home"
href="http://www.livingthai.org/wp-content/uploads/2011/10/How-to-test-your-Thai-Language-ability.jpg">TESTING</a>
You can see what I'm trying to do here: http://jsfiddle.net/WxVE4/1/
I've just used placeholder images and links for now as my site isn't
published yet.
Oh, and if anyone can tell me how to align the text link nice and
centrally beneath the image then that's extra brownie points :D

Comments only posting to most recent status update

Comments only posting to most recent status update

The news feed on the sites dashboard I'm working on has multiple items
from different users; and can also be commented on. However, whenever you
write a comment under each post, it only posts to the post at the top of
the feed (the most recent one). Comments are posted instantly by pressing
the enter key, which then runs this JS code which is on the index.php
page.
$(function(){
$('#comment_body').live( 'keypress' , function (e) {
var boxVal = $(this).val();
var sendTo = $('#to_id').val();
if ( e.keyCode == '13' ) {
e.preventDefault();
$.post( 'instantcom.php' , { 'comment_body' : boxVal ,
'activity_id' : sendTo } , function () {
// reload data or just leave blank
} );
$('#comment_body').val('');
}
} );
});
Then, the HTML for the comment box on each post is as follows:
<p align="center" style="height:45px;">
<input type="text" name="comment_body" id="comment_body"
style="margin-top:12px;border:1px solid blue
!important;width:329px;height:21px;" />
<span class=" glyphicons-icon camera"
style="position:relative;bottom:50px;left:155px;"></span></p>
<input name="type" type="hidden" value="a" />
<input name="activity_id" id="to_id" type="hidden" value="' . $act_item_id
. '" />
The ' . $act_item_id . ' is just a PHP variable which contains the unique
ID of the status update.
So then, any ideas as to why comments are only posting to the most recent
posts instead of the ones they're meant to post to?

Styling your action bar android

Styling your action bar android

The general action bar in android is quite dull is there any way of
editing this bar in terms of colour, style and the position of icons
rather than having icons arranged right to left can you have a single icon
in the middle this is just an equiry about how far can you customize the
action bar or will you just have to nest images in layouts ?

Content is half hidden underneath fixed header, despite changing 'top' margin

Content is half hidden underneath fixed header, despite changing 'top' margin

I have recently altered my header to stay fixed. The header is perfect,
but it hides half of the content. I have tried changing the content's
'top' settings but it does not alter the result.
THE HTML:
<div class="gridContainer clearfix">
<div id="LayoutDiv1">We are here to help</div>
<form action="website.php" method="POST">
<div id="LayoutDiv3"> Names:
<input type="text" name="user"/>
Gender<FONT COLOR="#FF0000">*</FONT>
<select name="Gender[]" double="double">
<option value="Female">Female</option>
<option value="Male">Male</option>
</select>
</div>
<div id="Components"></div>
<div id="Food"><h1>Dietary conditions:</h1>
&nbsp;Gluten Free
<input type="checkbox" name="GlutenFree" value="Yes" />
<br>
&nbsp;&nbsp; Diary Free
<input type="checkbox" name="DairyFree" value="Yes" />
<br>
&nbsp;&nbsp; No Softdrink
<input type="checkbox" name="NoSoftDrink" value="Yes" />
&nbsp;<br>
&nbsp;Halal
<input type="checkbox" name="Halal" value="Yes" />
&nbsp;<br>
&nbsp;Vegetarian
<input type="checkbox" name="Vegetarian" value="Yes" />
&nbsp;&nbsp; <br>
No Nuts
<input type="checkbox" name="NoNuts" value="Yes" />
&nbsp; <br>
Other
<input type="checkbox" name="Other" value="Yes" /></div>
THE CSS:
#LayoutDiv1 {
position: fixed;
height: 75px;
top: 0;
width: 100%;
z-index: 10000;
background:#FFF
}
#LayoutDiv3 {
position: fixed;
height: 30px;
top: 75px;
width: 100%;
z-index: 10002;
background:#FFF
}
#Components {
top: 2000px; //Has no effect, and either does changing the 'top' setting
for each div
within 'components.
}
Thankyou

Saturday, 14 September 2013

Import External Libraries in pycharm

Import External Libraries in pycharm

Hi how do I add external libraries to my python project in python? I
already included the python interpreter but I can't find any option to
include additional libraries. Iam using pycharm 2.7.3 on my Mac Thanks for
the help

Can JQuery and Javascript be used in the same .js file?

Can JQuery and Javascript be used in the same .js file?

I'm trying to create a messaging system that uses ajax that doesn't have
to reload when the message is submitted. I have a .js file that uses an
onclick to open the form to insert your message and then a differant
function to submit the form. Is this not working because I am doing
something wrong or because you cant use JQuery and Javascript in the same
file.
Here is my code:
//I have a button that calls this function with an onclick in my HTML file
function createMessage() {
var form = document.createElement("form");
form.name = "form_input";
form.method = "POST";
form.action = "messages.php";
//I also have a container div in my HTML
container.appendChild(form);
var textarea = document.createElement("textarea");
textarea.name = "message_input";
textarea.action = "messages.php"
textarea.method = "POST";
textarea.cols = 84;
textarea.rows = 16;
textarea.id = "message_input";
form.appendChild(textarea);
var div = document.createElement("div");
div.id = "second_picture";
container.appendChild(div);
var submit = document.createElement("button");
submit.innerHTML = 'Send';
submit.id = 'send_message';
submit.name = 'submit';
form.appendChild(submit);
submit.onclick = submitMessage;
};
function submitMessage() {
$(function() {
$("#send_message").click(function() {
var message = $("input#message_input").val();
var dataString = 'message_input='+ message;
$.ajax({
type: "POST",
url: "messages.php",
data: dataString,
success: function() {
alert('Ok.');
}
});
return false;
});
});
};

How does one read JavaScript API like Mongoose

How does one read JavaScript API like Mongoose

I'm a java developer. I really like to learn javascript. I'm finding it
very difficult to pick-up a library and just learn/use it for two reasons:
1) There is no decent auto-complete. I've tried, eclipse, vjet, nodeclipse
and webstorm...each has its own frustrating set of issues. Maybe the
language is such that, autocomplete is super-difficult. 2) The API
documentation is extremely confusing. I guess it is because I'm new to
JavaScript.
For example, I wanted to figure what the callback function in
mongoose.connect method does and how to declare it. So I checked the api
doc. All it says is that the callback is a function...it doesn't say how
many params it takes, what the values of the params are under various
invocation scenarios...etc.
I feel like I'm missing something...
How does one go about reading these docs?

Private methods vs Lambda in C++

Private methods vs Lambda in C++

My question refers to:
Using a lambda expression versus a private method
Now that lambda functors are part of C++, they could be used to unclutter
a class' interface. How does lambda use vs private method use compare in
C++? Do there exist better alternatives to unclutter class interfaces?

Missing before statement

Missing before statement

I have the following piece of code that I would like to style:
var dateString = val.date; // this display my blog post date e.g.
"2013-09-02 15:04:50"
var split = dateString.split(' ');
output += '<div class="postxt">' (split[0] +" at "+ split[1]) '</div>';
How can I add a span or a div for both split0 & split1
Thanks

View calendar post with fancybox

View calendar post with fancybox

I'm making a planning function for my cms. When you click on an post in
the calendar, I'd like it to show up in a popup like FancyBox. My question
is, what is the best way to do that, so that when you click on a post it
shows that post's content, witch comes from a database?

ontouch method is null pointer exception my application touch in start button

ontouch method is null pointer exception my application touch in start button

class is RadarSceen then method ontouch method is crash is null pointer
exception and this method use start radar and stop radar.then
localRotateAnimation.setDuration(3000L) crash is null pointer exception
public class RadarScreen extends Activity implements View.OnTouchListener {
private static final String APP_TAG = "com.example.ghostsam";
private CountDownTimer countdownHideGhost = null;
private CountDownTimer countdownShowGhost = null;
private DisplayMetrics getDisplay = new DisplayMetrics();
private int getDisplayHeight;
private float getDisplayScale;
private int getDisplayWidth;
private Boolean hideGhosts = Boolean.valueOf(false);
private ImageView ivLogo = null;
private ImageView ivRadar = null;
private ImageView ivRadarGhosts = null;
private ImageView ivSignalButton = null;
private Typeface layoutFontFace;
private Boolean radarRun = Boolean.valueOf(false);
// private RotateAnimation rotateAnimation ;
private RotateAnimation localRotateAnimation;
private boolean settingsGeneralVibrate = true;
private Boolean showGhosts = Boolean.valueOf(false);
private int showGhostsZufallszahl = 0;
private Vibrator vib = null;
public Bitmap drawButton(String paramString1, String paramString2) {
Bitmap localBitmap = Bitmap
.createBitmap(this.getDisplayWidth - (int) (70.0F *
this.getDisplayScale),
(int) (52.0F * this.getDisplayScale),
Bitmap.Config.ARGB_8888);
Canvas localCanvas = new Canvas(localBitmap);
Paint localPaint = new Paint();
localPaint.setTypeface(this.layoutFontFace);
localPaint.setTextAlign(Paint.Align.CENTER);
localPaint.setAntiAlias(true);
localPaint.setColor(Color.parseColor(paramString2));
localCanvas.drawRoundRect(
new RectF(0.0F, 0.0F, localBitmap.getWidth(),
localBitmap.getHeight()), 12.0F,
12.0F, localPaint);
localPaint.setColor(Color.parseColor("#000000"));
localCanvas.drawRoundRect(new RectF(2.0F, 2.0F, -2 +
localBitmap.getWidth(),
-2 + localBitmap.getHeight()), 12.0F, 12.0F, localPaint);
localPaint.setColor(Color.parseColor(paramString2));
localPaint.setAlpha(200);
localPaint.setTextSize(32.0F * this.getDisplayScale);
localPaint.setTextScaleX(1.75F);
localPaint.setFakeBoldText(true);
localCanvas.drawText(paramString1, localBitmap.getWidth() / 2,
36.0F * this.getDisplayScale, localPaint);
return localBitmap;
}
public Bitmap drawRadar(Boolean paramBoolean) {
Bitmap localBitmap = Bitmap
.createBitmap(-50 + this.getDisplayWidth, -50 +
this.getDisplayWidth,
Bitmap.Config.ARGB_8888);
Canvas localCanvas = new Canvas(localBitmap);
Paint localPaint = new Paint();
int i = (int) ((localBitmap.getWidth() - 10.0F *
this.getDisplayScale) / 2.0F
+ 5.0F * this.getDisplayScale);
int j = (int) (i - 5.0F * this.getDisplayScale);
localPaint.setAntiAlias(true);
localPaint.setColor(Color.parseColor("#FFFFFF"));
localPaint.setStyle(Paint.Style.STROKE);
localPaint.setStrokeWidth(3.0F * this.getDisplayScale);
localPaint.setAlpha(75);
for (int k = 0; ; k++) {
if (k > 4) {
localPaint.setAlpha(100);
localPaint.setStyle(Paint.Style.FILL);
localPaint.setShader(new SweepGradient(i, i, 0, -16711936));
if (paramBoolean.booleanValue()) {
RectF localRectF = new RectF();
localRectF.set(i - j, i - j, i + j, i + j);
localCanvas.drawArc(localRectF, 0.0F, 360.0F, true,
localPaint);
}
localPaint.setShader(null);
localPaint.setAlpha(255);
localPaint.setColor(Color.parseColor("#810003"));
localPaint.setStyle(Paint.Style.FILL);
localPaint.setStrokeWidth(0.0F);
localCanvas.drawCircle(i, i, 10.0F * this.getDisplayScale,
localPaint);
return localBitmap;
}
localCanvas.drawCircle(i, i, j - k * 40 *
this.getDisplayScale, localPaint);
}
}
public Bitmap drawRadarGhosts(Boolean paramBoolean) {
Bitmap localBitmap = Bitmap
.createBitmap(-50 + this.getDisplayWidth, -50 +
this.getDisplayWidth,
Bitmap.Config.ARGB_8888);
Canvas localCanvas = new Canvas(localBitmap);
Paint localPaint = new Paint();
if (paramBoolean.booleanValue()) {
int i = (int) ((localBitmap.getWidth() - 10.0F *
this.getDisplayScale) / 2.0F
+ 5.0F * this.getDisplayScale);
int j = (int) (i - 5.0F * this.getDisplayScale);
localPaint.setAntiAlias(true);
localPaint.setAlpha(255);
Random localRandom = new Random();
localPaint.setAlpha(150);
int k = localRandom.nextInt(180);
int m = localRandom.nextInt(j);
int n = i + (int) (Math.cos(3.141592653589793D * k / 180.0D) *
m);
int i1 = i + (int) (Math.sin(3.141592653589793D * k / 180.0D)
* m);
localPaint.setColor(-16711936);
localPaint.setShader(
new RadialGradient(n, i1, 22.0F *
this.getDisplayScale, -16711936, 0,
TileMode.CLAMP));
localCanvas.drawCircle(n, i1, 15.0F * this.getDisplayScale,
localPaint);
if (localRandom.nextInt(50) < 5) {
int i6 = localRandom.nextInt(180);
int i7 = localRandom.nextInt(j);
int i8 = i + (int) (Math.cos(3.141592653589793D * i6 /
180.0D) * i7);
int i9 = i + (int) (Math.sin(3.141592653589793D * i6 /
180.0D) * i7);
localPaint.setShader(
new RadialGradient(i8, i9, 22.0F *
this.getDisplayScale, -16711936, 0,
TileMode.CLAMP));
localCanvas.drawCircle(i8, i9, 15.0F *
this.getDisplayScale, localPaint);
}
if (localRandom.nextInt(75) < 5) {
int i2 = localRandom.nextInt(180);
int i3 = localRandom.nextInt(j);
int i4 = i + (int) (Math.cos(3.141592653589793D * i2 /
180.0D) * i3);
int i5 = i + (int) (Math.sin(3.141592653589793D * i2 /
180.0D) * i3);
localPaint.setShader(
new RadialGradient(i4, i5, 22.0F *
this.getDisplayScale, -16711936, 0,
TileMode.CLAMP));
localCanvas.drawCircle(i4, i5, 15.0F *
this.getDisplayScale, localPaint);
}
}
return localBitmap;
}
public void onCreate(Bundle paramBundle) {
Log.i("com.example.ghostsam", "onStart RadarScreen");
requestWindowFeature(1);
getWindow().setFlags(1024, 1024);
super.onCreate(paramBundle);
setContentView(R.layout.radarscreen);
SharedPreferences localSharedPreferences =
getSharedPreferences("app_prefs", 0);
int i = localSharedPreferences.getInt("appStartCounter", 0);
int j = localSharedPreferences.getInt("appStartFirst", 0);
int k = i + 1;
SharedPreferences.Editor localEditor = localSharedPreferences.edit();
localEditor.putInt("appStartCounter", k);
if (j <= 0) {
localEditor.putInt("appStartFirst", (int)
(System.currentTimeMillis() / 1000L));
}
localEditor.commit();
if ((k == 5) || (k == 10) || (k == 25)) {
AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
localBuilder.setIcon(17301543);
Resources localResources1 = getResources();
Object[] arrayOfObject1 = new Object[1];
arrayOfObject1[0] = "name";
localBuilder.setTitle(localResources1.getString(R.string.app_name,
arrayOfObject1));
Resources localResources2 = getResources();
Object[] arrayOfObject2 = new Object[1];
arrayOfObject2[0] = "name";
localBuilder.setMessage(localResources2
.getString(R.string.dialog_ratemarket_question,
arrayOfObject2));
Resources localResources3 = getResources();
Object[] arrayOfObject3 = new Object[1];
arrayOfObject3[0] = "name";
localBuilder.setPositiveButton(
localResources3.getString(R.string.dialog_button_yes,
arrayOfObject3),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface
paramDialogInterface,
int paramInt) {
Resources localResources =
RadarScreen.this.getResources();
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = "name";
Intent localIntent = new
Intent("android.intent.action.VIEW",
Uri.parse(localResources.getString(R.string.app_marketlink,
arrayOfObject)));
RadarScreen.this.startActivity(localIntent);
paramDialogInterface.dismiss();
}
});
Resources localResources4 = getResources();
Object[] arrayOfObject4 = new Object[1];
arrayOfObject4[0] = "name";
localBuilder.setNegativeButton(
localResources4.getString(R.string.dialog_button_no,
arrayOfObject4),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface
paramDialogInterface,
int paramInt) {
paramDialogInterface.dismiss();
}
});
localBuilder.create().show();
}
}
public boolean onCreateOptionsMenu(Menu paramMenu) {
getMenuInflater().inflate(R.menu.radarscreen, paramMenu);
return true;
}
public void onError(Exception paramException) {
}
public void onIllegalHttpStatusCode(int paramInt, String paramString) {
}
public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent) {
if (paramInt == 4) {
quitApp();
}
for (int i = 1; ; i = 0) {
return true;
}
}
@SuppressLint("NewApi")
public boolean onOptionsItemSelected(MenuItem paramMenuItem) {
switch (paramMenuItem.getItemId()) {
default:
break;
case R.id.radarscreen_menu_moreapps:
Resources localResources2 = getResources();
Object[] arrayOfObject2 = new Object[1];
arrayOfObject2[0] = "name";
startActivity(new Intent("android.intent.action.VIEW",
Uri.parse(localResources2
.getString(R.string.app_marketdeveloperlink,
arrayOfObject2))));
break;
case R.id.radarscreen_menu_rateapp:
Resources localResources1 = getResources();
Object[] arrayOfObject1 = new Object[1];
arrayOfObject1[0] = "name";
startActivity(new Intent("android.intent.action.VIEW",
Uri.parse(
localResources1.getString(R.string.app_marketlink,
arrayOfObject1))));
break;
case R.id.radarscreen_menu_about:
startActivity(new Intent(this, About.class));
break;
case R.id.radarscreen_menu_settings:
startActivity(new Intent(this, Settings.class));
break;
case R.id.radarscreen_menu_quit:
quitApp();
}
return true;
}
public void onResume() {
super.onResume();
Log.i("com.example.ghostsam", "onResume RadarScreen");
getWindowManager().getDefaultDisplay().getMetrics(this.getDisplay);
this.getDisplayWidth = this.getDisplay.widthPixels;
this.getDisplayHeight = this.getDisplay.heightPixels;
this.getDisplayScale = (this.getDisplayWidth / 480.0F);
this.layoutFontFace = Typeface.createFromAsset(getAssets(),
"Roboto-Regular.ttf");
this.settingsGeneralVibrate = PreferenceManager
.getDefaultSharedPreferences(getBaseContext())
.getBoolean("settings_general_vibrate", true);
this.vib = ((Vibrator) getSystemService("vibrator"));
this.ivLogo = ((ImageView) findViewById(R.id.ivLogo));
this.ivLogo.setImageBitmap(Bitmap.createScaledBitmap(
BitmapFactory.decodeResource(getResources(),
R.drawable.logo),
(int) (460.0F * this.getDisplayScale), (int) (68.0F *
this.getDisplayScale),
true));
this.ivSignalButton = ((ImageView)
findViewById(R.id.ivSignalButton));
this.ivSignalButton.setImageBitmap(drawButton("start radar",
"#005F21"));
this.ivSignalButton.setOnTouchListener(this);
this.ivRadar = ((ImageView) findViewById(R.id.ivRadar));
this.ivRadar.setImageBitmap(drawRadar(Boolean.valueOf(false)));
this.ivRadarGhosts = ((ImageView) findViewById(R.id.ivRadarGhosts));
if (this.ivRadarGhosts != null) {
this.ivRadarGhosts.setImageBitmap(drawRadarGhosts(Boolean.valueOf(false)));
}
this.countdownShowGhost = new CountDownTimer(15000L, 1000L) {
public void onFinish() {
RadarScreen.this.showGhosts = Boolean.valueOf(false);
RadarScreen.this.hideGhosts = Boolean.valueOf(false);
if (RadarScreen.this.countdownHideGhost != null) {
RadarScreen.this.countdownHideGhost.start();
}
}
public void onTick(long paramLong) {
Random localRandom = new Random();
if (!RadarScreen.this.showGhosts.booleanValue()) {
RadarScreen.this.showGhosts = Boolean.valueOf(true);
RadarScreen.this.showGhostsZufallszahl = (1000 +
localRandom
.nextInt(10000));
if (localRandom.nextInt(50) >= 10) {
AlphaAnimation localAlphaAnimation2 = new
AlphaAnimation(0.0F, 0.975F);
localAlphaAnimation2.setDuration(1000L);
localAlphaAnimation2.setFillAfter(true);
if (RadarScreen.this.ivRadarGhosts != null) {
RadarScreen.this.ivRadarGhosts.startAnimation(localAlphaAnimation2);
RadarScreen.this.ivRadarGhosts.setImageBitmap(
RadarScreen.this.drawRadarGhosts(Boolean.valueOf(true)));
if (RadarScreen.this.settingsGeneralVibrate) {
RadarScreen.this.vib.vibrate(20L);
}
}
}
}
if ((RadarScreen.this.showGhostsZufallszahl > paramLong)
&& (!RadarScreen.this
.hideGhosts.booleanValue())) {
RadarScreen.this.hideGhosts = Boolean.valueOf(true);
AlphaAnimation localAlphaAnimation1 = new
AlphaAnimation(0.975F, 0.0F);
localAlphaAnimation1.setDuration(1000L);
localAlphaAnimation1.setFillAfter(true);
if (RadarScreen.this.ivRadarGhosts == null) {
return;
}
RadarScreen.this.ivRadarGhosts.startAnimation(localAlphaAnimation1);
}
}
};
this.countdownHideGhost = new CountDownTimer(12500L, 2250L) {
public void onFinish() {
RadarScreen.this.showGhosts = Boolean.valueOf(false);
RadarScreen.this.hideGhosts = Boolean.valueOf(false);
if (RadarScreen.this.countdownShowGhost != null) {
RadarScreen.this.countdownShowGhost.start();
}
}
public void onTick(long paramLong) {
}
};
}
public void onStop() {
super.onStop();
Log.i("com.example.ghostsam", "onStop RadarScreen");
BitmapDrawable localBitmapDrawable1 = (BitmapDrawable)
this.ivLogo.getDrawable();
this.ivLogo.setImageBitmap(null);
this.ivLogo.setImageDrawable(null);
this.ivLogo = null;
Bitmap localBitmap1 = localBitmapDrawable1.getBitmap();
if ((localBitmap1 != null) && (!localBitmap1.isRecycled()))
{
localBitmap1.recycle();
}
BitmapDrawable localBitmapDrawable2 = (BitmapDrawable)
this.ivRadar.getDrawable();
this.ivRadar.setImageBitmap(null);
this.ivRadar.setImageDrawable(null);
this.ivRadar = null;
Bitmap localBitmap2 = localBitmapDrawable2.getBitmap();
if ((localBitmap2 != null) && (!localBitmap2.isRecycled()))
{
localBitmap2.recycle();
}
BitmapDrawable localBitmapDrawable3 = (BitmapDrawable)
this.ivRadarGhosts.getDrawable();
this.ivRadarGhosts.setImageBitmap(null);
this.ivRadarGhosts.setImageDrawable(null);
this.ivRadarGhosts = null;
Bitmap localBitmap3 = localBitmapDrawable3.getBitmap();
if ((localBitmap3 != null) && (!localBitmap3.isRecycled()))
{
localBitmap3.recycle();
}
BitmapDrawable localBitmapDrawable4 = (BitmapDrawable)
this.ivSignalButton
.getDrawable();
this.ivSignalButton.setImageBitmap(null);
this.ivSignalButton.setImageDrawable(null);
this.ivSignalButton = null;
Bitmap localBitmap4 = localBitmapDrawable4.getBitmap();
if ((localBitmap4 != null) && (!localBitmap4.isRecycled()))
{
localBitmap4.recycle();
}
this.countdownHideGhost.cancel();
this.countdownHideGhost = null;
this.countdownShowGhost.cancel();
this.countdownShowGhost = null;
this.radarRun = Boolean.valueOf(false);
this.showGhosts = Boolean.valueOf(false);
this.hideGhosts = Boolean.valueOf(false);
}
public boolean onTouch(View paramView, MotionEvent paramMotionEvent) {
switch (paramMotionEvent.getAction()) {
default:
if (paramView != this.ivSignalButton) {
break;
}
case 0:
if (this.radarRun.booleanValue()) {
if (this.radarRun.booleanValue()) {
if (this.ivSignalButton == null) {
break;
}
this.ivSignalButton.setImageBitmap(drawButton("stop
radar", "#1BA449"));
}
}
case 1:
if (this.ivSignalButton == null) {
break;
}
this.ivSignalButton.setImageBitmap(drawButton("start
radar", "#1BA449"));
}
// while (paramView != this.ivSignalButton);
if (this.radarRun.booleanValue()) {
if (this.ivSignalButton != null) {
this.ivSignalButton.setImageBitmap(drawButton("stop
radar", "#005F21"));
}
if ((paramMotionEvent.getX() <= 0.0F) ||
(paramMotionEvent.getX() >= paramView
.getWidth()) ||
(paramMotionEvent.getY() <= 0.0F) ||
(paramMotionEvent.getY() >= paramView
.getHeight())) {
this.ivSignalButton.setImageBitmap(drawButton("stop
radar", "#005F21"));
}
if (this.ivSignalButton != null) {
this.ivSignalButton.setImageBitmap(drawButton("start
radar", "#005F21"));
}
RotateAnimation localRotateAnimation = new
RotateAnimation(0.0F, 360.0F, 1, 0.5F, 1,
0.5F);
localRotateAnimation.setInterpolator(new LinearInterpolator());
localRotateAnimation.setFillAfter(true);
localRotateAnimation.setRepeatMode(1);
if (!this.radarRun.booleanValue()) {
if (this.ivSignalButton != null) {
this.ivSignalButton.setImageBitmap(drawButton("stop
radar", "#005F21"));
}
}
this.radarRun = Boolean.valueOf(true);
this.radarRun = Boolean.valueOf(false);
if (this.ivRadar != null) {
this.ivRadar.setImageBitmap(drawRadar(Boolean.valueOf(false)));
}
localRotateAnimation.setDuration(10L);
localRotateAnimation.setRepeatCount(0);
if (this.ivRadarGhosts != null) {
this.ivRadarGhosts.setImageBitmap(drawRadarGhosts(Boolean.valueOf(false)));
}
if (this.countdownHideGhost != null) {
this.countdownHideGhost.cancel();
}
if (this.countdownHideGhost != null) {
this.countdownShowGhost.cancel();
}
}
if (this.ivSignalButton == null) {
this.ivSignalButton.setImageBitmap(drawButton("start radar",
"#005F21"));
}
if (this.ivRadar != null) {
this.ivRadar.setImageBitmap(drawRadar(Boolean.valueOf(true)));
}
localRotateAnimation.setDuration(3000L);
localRotateAnimation.setRepeatCount(-1);
if (this.countdownHideGhost == null) {
this.countdownHideGhost.start();
}
this.ivRadar.startAnimation(localRotateAnimation);
return true;
}
}

Friday, 13 September 2013

Error C2061: syntax error : identifier 'acosf' when using cURL

Error C2061: syntax error : identifier 'acosf' when using cURL

I am trying to learn about cURL and found some code online that I wanted
to compile in Visual Studio but I get a series of strange errors. I tried
googling the errors but couldn't find any that related to my issue. I
installed cURL libraries okay but when I try to run this program:
#include <curl/curl.h>
#include <fstream>
#include <sstream>
#include <iostream>
// callback function writes data to a std::ostream
static size_t data_write(void* buf, size_t size, size_t nmemb, void* userp)
{
if(userp)
{
std::ostream& os = *static_cast<std::ostream*>(userp);
std::streamsize len = size * nmemb;
if(os.write(static_cast<char*>(buf), len))
return len;
}
return 0;
}
/**
* timeout is in seconds
**/
CURLcode curl_read(const std::string& url, std::ostream& os, long timeout
= 30)
{
CURLcode code(CURLE_FAILED_INIT);
CURL* curl = curl_easy_init();
if(curl)
{
if(CURLE_OK == (code = curl_easy_setopt(curl,
CURLOPT_WRITEFUNCTION, &data_write))
&& CURLE_OK == (code = curl_easy_setopt(curl, CURLOPT_NOPROGRESS,
1L))
&& CURLE_OK == (code = curl_easy_setopt(curl,
CURLOPT_FOLLOWLOCATION, 1L))
&& CURLE_OK == (code = curl_easy_setopt(curl, CURLOPT_FILE, &os))
&& CURLE_OK == (code = curl_easy_setopt(curl, CURLOPT_TIMEOUT,
timeout))
&& CURLE_OK == (code = curl_easy_setopt(curl, CURLOPT_URL,
url.c_str())))
{
code = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
}
return code;
}
int main()
{
curl_global_init(CURL_GLOBAL_ALL);
std::ofstream ofs("output.html");
if(CURLE_OK == curl_read("http://google.com", ofs))
{
// Web page successfully written to file
}
std::ostringstream oss;
if(CURLE_OK == curl_read("http://google.com", oss))
{
// Web page successfully written to string
std::string html = oss.str();
}
if(CURLE_OK == curl_read("http://google.com", std::cout))
{
// Web page successfully written to standard output (console?)
}
curl_global_cleanup();
}
I get the following list of errors:
1>------ Build started: Project: cURL.c, Configuration: Debug Win32 ------
1> main.c
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\xtgmath.h(111): warning C4602: #pragma pop_macro : 'new'
no previous #pragma push_macro for this identifier
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\xtgmath.h(112): warning C4193: #pragma warning(pop) : no
matching '#pragma warning(push)'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\xtgmath.h(113): warning C4161: #pragma pack(pop...) : more
pops than pushes
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(28): error C2061: syntax error : identifier 'acosf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(28): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(28): error C2061: syntax error : identifier 'asinf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(29): error C2061: syntax error : identifier 'atanf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(29): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(29): error C2061: syntax error : identifier 'atan2f'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(29): error C2061: syntax error : identifier 'ceilf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(30): error C2061: syntax error : identifier 'cosf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(30): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(30): error C2061: syntax error : identifier 'coshf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(30): error C2061: syntax error : identifier 'expf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(31): error C2061: syntax error : identifier 'fabsf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(31): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(31): error C2061: syntax error : identifier 'floorf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(31): error C2061: syntax error : identifier 'fmodf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(32): error C2061: syntax error : identifier 'frexpf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(32): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(32): error C2061: syntax error : identifier 'ldexpf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(32): error C2061: syntax error : identifier 'logf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(33): error C2061: syntax error : identifier 'log10f'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(33): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(33): error C2061: syntax error : identifier 'modff'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(33): error C2061: syntax error : identifier 'powf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(34): error C2061: syntax error : identifier 'sinf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(34): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(34): error C2061: syntax error : identifier 'sinhf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(34): error C2061: syntax error : identifier 'sqrtf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(35): error C2061: syntax error : identifier 'tanf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(35): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(35): error C2061: syntax error : identifier 'tanhf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(37): error C2061: syntax error : identifier 'acosl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(37): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(37): error C2061: syntax error : identifier 'asinl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(38): error C2061: syntax error : identifier 'atanl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(38): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(38): error C2061: syntax error : identifier 'atan2l'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(38): error C2061: syntax error : identifier 'ceill'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(39): error C2061: syntax error : identifier 'cosl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(39): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(39): error C2061: syntax error : identifier 'coshl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(39): error C2061: syntax error : identifier 'expl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(40): error C2061: syntax error : identifier 'fabsl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(40): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(40): error C2061: syntax error : identifier 'floorl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(40): error C2061: syntax error : identifier 'fmodl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(41): error C2061: syntax error : identifier 'frexpl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(41): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(41): error C2061: syntax error : identifier 'ldexpl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(41): error C2061: syntax error : identifier 'logl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(42): error C2061: syntax error : identifier 'log10l'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(42): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(42): error C2061: syntax error : identifier 'modfl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(42): error C2061: syntax error : identifier 'powl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(43): error C2061: syntax error : identifier 'sinl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(43): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(43): error C2061: syntax error : identifier 'sinhl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(43): error C2061: syntax error : identifier 'sqrtl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(44): error C2061: syntax error : identifier 'tanl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(44): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(44): error C2061: syntax error : identifier 'tanhl'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(46): error C2061: syntax error : identifier 'abs'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(46): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(48): error C2061: syntax error : identifier 'acos'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(48): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(48): error C2061: syntax error : identifier 'asin'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(49): error C2061: syntax error : identifier 'atan'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(49): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(49): error C2061: syntax error : identifier 'atan2'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(49): error C2061: syntax error : identifier 'ceil'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(50): error C2061: syntax error : identifier 'cos'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(50): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(50): error C2061: syntax error : identifier 'cosh'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(50): error C2061: syntax error : identifier 'exp'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(51): error C2061: syntax error : identifier 'fabs'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(51): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(51): error C2061: syntax error : identifier 'floor'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(51): error C2061: syntax error : identifier 'fmod'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(52): error C2061: syntax error : identifier 'frexp'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(52): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(52): error C2061: syntax error : identifier 'ldexp'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(52): error C2061: syntax error : identifier 'log'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(53): error C2061: syntax error : identifier 'log10'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(53): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(53): error C2061: syntax error : identifier 'modf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(53): error C2061: syntax error : identifier 'pow'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(54): error C2061: syntax error : identifier 'sin'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(54): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(54): error C2061: syntax error : identifier 'sinh'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(54): error C2061: syntax error : identifier 'sqrt'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(55): error C2061: syntax error : identifier 'tan'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(55): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(55): error C2061: syntax error : identifier 'tanh'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(57): error C2061: syntax error : identifier 'hypot'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(57): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cmath(57): error C2061: syntax error : identifier 'hypotf'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cstdio(36): error C2054: expected '(' to follow 'using'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cstdio(38): error C2061: syntax error : identifier 'using'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cstdio(38): error C2054: expected '(' to follow 'using'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cstdio(39): error C2061: syntax error : identifier
'clearerr'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cstdio(39): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cstdio(39): error C2061: syntax error : identifier
'fclose'
1>c:\program files (x86)\microsoft visual studio
11.0\vc\include\cstdio(39): fatal error C1003: error count exceeds 100;
stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What could be the problem?