HDF5 example not working
I tried building the first example here and got errors. Right on the first
line there's a missing include statement, but I managed to figure out it
should be
#include "hdf5.h"
But even after fixing that I got more errors:
$ h5cc ./example1.c
./example1.c: In function 'main':
./example1.c:66:4: error: too few arguments to function 'H5Dcreate2'
In file included from /usr/include/hdf5.h:27:0,
from ./example1.c:6:
/usr/include/H5Dpublic.h:104:14: note: declared here
Any idea how to solve it?
Busher
Sunday, 1 September 2013
how to get top li from top of ul with jQuery pixel
how to get top li from top of ul with jQuery pixel
guys I have one ul that this ul has 5 li. this lies has these styles :
position: relative;
height: 50px;
width: 193px;
left: 0;
right: 0;
margin: 10px 0;
cursor: pointer;
and ul has these styles:
width: 200px;
height: 100%;
padding: 0;
margin: 0;
overflow-y: auto;
overflow-x: hidden;
list-style: none;
margin-left: 3px;
I want get top for any lies from top ul but when to use this code:
$('ul li').each(function(){
console.log($(this).css('top'));
});
show me this : 'auto' why??? I want to get pixel value
guys I have one ul that this ul has 5 li. this lies has these styles :
position: relative;
height: 50px;
width: 193px;
left: 0;
right: 0;
margin: 10px 0;
cursor: pointer;
and ul has these styles:
width: 200px;
height: 100%;
padding: 0;
margin: 0;
overflow-y: auto;
overflow-x: hidden;
list-style: none;
margin-left: 3px;
I want get top for any lies from top ul but when to use this code:
$('ul li').each(function(){
console.log($(this).css('top'));
});
show me this : 'auto' why??? I want to get pixel value
Saturday, 31 August 2013
How to inject jQuery or JavaScript to an iFrame?
How to inject jQuery or JavaScript to an iFrame?
I am trying to build a HTML,CSS, jQuery/JavaScript editor... How can I
inject JavaScript or jQuery into an iFrame? I tried searching all related
answers here, but none of the solutions is helping...
here's what I am talking about...#css, #js are textareas, while #iframe_id
is an iframe used to preview the changes.
css_code = $('#css').val();
js_code = $('#js').val();
css_content = "<style>" + css_code + "</style>"; // working
js_content = "<script>" + js_code + "</script>"; // does not work
$('#iframe_id').contents().find('head').append(css_content); // working
$('#iframe_id').contents().find('body').append(js_content); // does not work
The following works but only if I use core JavaScript, not sure
why...frame[0] basically is the same iframe (#iframe_id)...
var js_content = jsEditor.getValue();
frames[0].window.eval(js_content); // works only when JavaScript is
entered (not jQuery)
It may be something to do with the 'script' tags, maybe jQuery has a
problem with it...not sure why.
I am trying to build a HTML,CSS, jQuery/JavaScript editor... How can I
inject JavaScript or jQuery into an iFrame? I tried searching all related
answers here, but none of the solutions is helping...
here's what I am talking about...#css, #js are textareas, while #iframe_id
is an iframe used to preview the changes.
css_code = $('#css').val();
js_code = $('#js').val();
css_content = "<style>" + css_code + "</style>"; // working
js_content = "<script>" + js_code + "</script>"; // does not work
$('#iframe_id').contents().find('head').append(css_content); // working
$('#iframe_id').contents().find('body').append(js_content); // does not work
The following works but only if I use core JavaScript, not sure
why...frame[0] basically is the same iframe (#iframe_id)...
var js_content = jsEditor.getValue();
frames[0].window.eval(js_content); // works only when JavaScript is
entered (not jQuery)
It may be something to do with the 'script' tags, maybe jQuery has a
problem with it...not sure why.
Code to draw a star
Code to draw a star
I looked up how to draw a star in Java, and I found the following code:
public void paint(Graphics g) {
drawStar(g,Color.BLACK,5,300,300,100,1…
drawStar(g,Color.RED,6,100,100,20,20);
drawStar(g,Color.BLUE,9,200,400,40,40)…
drawStar(g,Color.YELLOW,27,400,200,10,…
drawStar(g,Color.GREEN,400,300,300,250…
}
public double circleX(int sides, int angle) {
double coeff = (double)angle/(double)sides;
return Math.cos(2*coeff*Math.PI-halfPI);
}
public double circleY(int sides, int angle) {
double coeff = (double)angle/(double)sides;
return Math.sin(2*coeff*Math.PI-halfPI);
}
public void drawStar(Graphics g, Color c, int sides, int x, int y, int w,
int h) {
Color colorSave = g.getColor();
g.setColor(c);
for(int i = 0; i < sides; i++) {
int x1 = (int)(circleX(sides,i) * (double)(w)) + x;
int y1 = (int)(circleY(sides,i) * (double)(h)) + y;
int x2 = (int)(circleX(sides,(i+2)%sides) * (double)(w)) + x;
int y2 = (int)(circleY(sides,(i+2)%sides) * (double)(h)) + y;
g.drawLine(x1,y1,x2,y2);
}
}
}
halfPI is defined as a private static variable outside the body
I don't quite get the logic behind these methods. Could someone offer an
explanation?
I looked up how to draw a star in Java, and I found the following code:
public void paint(Graphics g) {
drawStar(g,Color.BLACK,5,300,300,100,1…
drawStar(g,Color.RED,6,100,100,20,20);
drawStar(g,Color.BLUE,9,200,400,40,40)…
drawStar(g,Color.YELLOW,27,400,200,10,…
drawStar(g,Color.GREEN,400,300,300,250…
}
public double circleX(int sides, int angle) {
double coeff = (double)angle/(double)sides;
return Math.cos(2*coeff*Math.PI-halfPI);
}
public double circleY(int sides, int angle) {
double coeff = (double)angle/(double)sides;
return Math.sin(2*coeff*Math.PI-halfPI);
}
public void drawStar(Graphics g, Color c, int sides, int x, int y, int w,
int h) {
Color colorSave = g.getColor();
g.setColor(c);
for(int i = 0; i < sides; i++) {
int x1 = (int)(circleX(sides,i) * (double)(w)) + x;
int y1 = (int)(circleY(sides,i) * (double)(h)) + y;
int x2 = (int)(circleX(sides,(i+2)%sides) * (double)(w)) + x;
int y2 = (int)(circleY(sides,(i+2)%sides) * (double)(h)) + y;
g.drawLine(x1,y1,x2,y2);
}
}
}
halfPI is defined as a private static variable outside the body
I don't quite get the logic behind these methods. Could someone offer an
explanation?
File size limit for boost memory mapped files?
File size limit for boost memory mapped files?
I am using the below code to open files which are approximately 400 to
800MB in size:
#include <boost\interprocess\file_mapping.hpp>
#include <boost\interprocess\mapped_region.hpp>
#include <iostream>
#include <vector>
#include <string>
using namespace boost::interprocess;
using namespace std;
int main(){
file_mapping fm("C:\\test\\1.txt",read_only);
mapped_region region(fm,read_only);
const char* const data = static_cast<const char*>(region.get_address());
const size_t max_size = region.get_size();
cout << max_size;
int b;
cin >> b;
}
If I point the above code to a small file I get no exception. However,
when looking at the several-hundred-MB-files (on an external USB) I get an
exception:
Unhandled exception at at 0x7521C41F in ReadingFiles.exe: Microsoft C++
exception: boost::interprocess::interprocess_exception at memory location
0x0040FBD4.
I have 2.4GB of RAM free- so it shouldnt be that I have run out of memory?
I am using the below code to open files which are approximately 400 to
800MB in size:
#include <boost\interprocess\file_mapping.hpp>
#include <boost\interprocess\mapped_region.hpp>
#include <iostream>
#include <vector>
#include <string>
using namespace boost::interprocess;
using namespace std;
int main(){
file_mapping fm("C:\\test\\1.txt",read_only);
mapped_region region(fm,read_only);
const char* const data = static_cast<const char*>(region.get_address());
const size_t max_size = region.get_size();
cout << max_size;
int b;
cin >> b;
}
If I point the above code to a small file I get no exception. However,
when looking at the several-hundred-MB-files (on an external USB) I get an
exception:
Unhandled exception at at 0x7521C41F in ReadingFiles.exe: Microsoft C++
exception: boost::interprocess::interprocess_exception at memory location
0x0040FBD4.
I have 2.4GB of RAM free- so it shouldnt be that I have run out of memory?
uistatus bar like original apple status bar
uistatus bar like original apple status bar
i need to customize uistatus bar like it's original apple status bar with
blue tint color(messages window), but to put there my
configs(time,icons,operator). I already make uiimage,put there labels,but
cannot properly pick up text color with right shadows, can someone help me
with font and color ?
i need to customize uistatus bar like it's original apple status bar with
blue tint color(messages window), but to put there my
configs(time,icons,operator). I already make uiimage,put there labels,but
cannot properly pick up text color with right shadows, can someone help me
with font and color ?
Scrapping using Nokogiri
Scrapping using Nokogiri
I am not able to scrap the price of the product and the output which I get
is as follow for each price
<div class="pu-final">
<span class="fk-font-17 fk-bold">Rs. 1999</span>
</div>
My code is given below
require 'rubygems'
require 'nokogiri'
require 'open-uri'
url =
"http://www.flipkart.com/mens-footwear/shoes/casual-shoes/pr?sid=osp,cil,nit,e1f"
doc = Nokogiri::HTML(open(url))
puts doc.at_css("title").text
doc.css(".gu4,.browse-product").each do |item|
title = item.at_css(".fk-display-block,.title").text
puts title
puts "================="
price = item.at_css(".pu-final")
puts price
end
I am not able to scrap the price of the product and the output which I get
is as follow for each price
<div class="pu-final">
<span class="fk-font-17 fk-bold">Rs. 1999</span>
</div>
My code is given below
require 'rubygems'
require 'nokogiri'
require 'open-uri'
url =
"http://www.flipkart.com/mens-footwear/shoes/casual-shoes/pr?sid=osp,cil,nit,e1f"
doc = Nokogiri::HTML(open(url))
puts doc.at_css("title").text
doc.css(".gu4,.browse-product").each do |item|
title = item.at_css(".fk-display-block,.title").text
puts title
puts "================="
price = item.at_css(".pu-final")
puts price
end
Subscribe to:
Comments (Atom)