Thursday, 3 October 2013

dropdownlist not getting hidden using AsyncpostbackTrigger of UpdatePanel

dropdownlist not getting hidden using AsyncpostbackTrigger of UpdatePanel

There is one DropdownList outside the update panel. The update
Panel:UpdatePanel1 contains a checkbox.
What is required is that when users select the check box, the dropdownlist
should get hidden in an asynchronous manner ( with out any postback ).
With the below setup, when I use the PostBackTrigger , then dropdownlist
gets hidden on checking the checkbox. However, with AsyncPostBackTrigger
it doesn't gets hidden at all. The Check box code behind event does gets
called by the way in both cases.
Why Dropdownlist is not getting hidden when using: AsyncPostBackTrigger ?
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:DropDownList runat="server" ID="ddlCountries"></asp:DropDownList>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:RadioButton ID="radioSelectCountries" Text="Hide Countries"
runat="server"
OnCheckedChanged="radioSelectCountries_CheckedChanged"
AutoPostBack="true" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="radioSelectCountries"
EventName="CheckedChanged" />
</Triggers>
</asp:UpdatePanel>
Code Behind::
protected void radioSelectCountries_CheckedChanged(object sender,
EventArgs e)
{
if (radioSelectCountries.Checked == true)
ddlCountries.Visible = false;
else
ddlCountries.Visible = true;
}

Wednesday, 2 October 2013

my site shows white space on right in mobile chrome but not desktop chrome

my site shows white space on right in mobile chrome but not desktop chrome

site in progress: http://www.scissormanmusic.com
This is the first site I've made since learning Javascript/Jquery so
please be nice to me. I used Bootstrap, Javascript & Jquery to add
responsiveness to my site & it works great on FF24 & Chrome30! But when I
view this site in portrait mode in the mobile version of Chrome on my
Galaxy S3 there's this white space on the right I can't seem to find the
cause of. In landscape mode the white space isn't there & the site looks &
behaves like it should.
I'm using the following meta tags I thought would keep this problem from
happening:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
Quite confused as to why it displays differently between the mobile &
desktop versions of Chrome! And only in portrait mode!
I'd like to also note that because I've used Javascript/JQuery to make my
site responsive, I did not add any @media queries.
Any help would be greatly appreciated. Thank you!

Tomcat opening a lot of instance in memory

Tomcat opening a lot of instance in memory

Well, i have only one tomcat server started, but when i executed the
command "htop" in my ubuntu server i saw that have 16 tomcat6 instances in
memory with the exactly same "command" but PID different. See the image
bellow:

How to bind a not visible value to Hyperlink URL in Gridview

How to bind a not visible value to Hyperlink URL in Gridview

I have a Hyperlink on one column in my gridview. Lets say this column has
different fruits..
Fruits Amount
Apple 2
Banana 1
Kiwi 4
Orange 5
My fruits should be Hyperlink and when i hover or click on the link i want
to send the id's from the fruit to next page and not the Fruitnames.
How can i do that? I only manage to make links to next page where the
names from fruits Comes as Parameter and i dont want that. I also dont
want to make a select on the id's from the fruit because then it Comes as
a new column in my gridview and it's not interesting to see the id's of
the fruits but it important to send them as Parameters because i Need them
on next page.
<asp:HyperLinkField DataNavigateUrlFields="FruitName"
DataTextField="FruitName" HeaderText="Fruits"
DataNavigateUrlFormatString="Cashier.aspx?FruitID={0}" />

Tuesday, 1 October 2013

Moving compass on MKMapview when rotating

Moving compass on MKMapview when rotating

The compass that appears in the top right of the map when rotating is
being hidden by other elements on the screen. I tried moving it in a
manner similar to moving the "legal" label, but if I run:
for(UIView *subview in self.mapView.subviews) {
NSLog(@"Subview : %@", subview);
}
It logs:
2013-10-01 21:15:48.961 MP Staging[6890:60b] Subview : <UIView:
0x1757faa0; frame = (0 0; 320 504); autoresizesSubviews = NO;
gestureRecognizers = <NSArray: 0x18815fd0>; layer = <CALayer: 0x1757fb00>>
2013-10-01 21:15:48.963 MP Staging[6890:60b] Subview :
<MKAttributionLabel: 0x18813a10; baseClass = UILabel; frame = (11 484; 24
11); text = 'Legal'; clipsToBounds = YES; alpha = 0.5; autoresize = RM+TM;
userInteractionEnabled = NO; layer = <CALayer: 0x18813bc0>>
How would I go about moving that compass?

JQuery hide div based on url hash and string

JQuery hide div based on url hash and string

I'm attempting to hide a div based on the url hash tag. I'm using a jquery
plugin called zozo tabs that allows for deep-linking and it shows and
hides divs.
There is a particular div on the page (not in the tab area) I would like
to hide given the url/s. I've searched but cannot figure it out. Please
excuse my javascript noobness!!! I've tried this. No such luck. It doesnt
seem to work. Any help would greatly appreciated.
I've tried php but it doesnt work on the hash
To start the plugin creates this type of url
http://localhost:8888/site/funds/#tabbed-nav=fund-strategy
The html is:
<ul>
<li data-link="fund-strategy"><a>Fund Strategy</a></li>
<li data-link="portfolio-characteristics"><a>Portfolio
Characteristics</a></li>
<li data-link="performance"><a>Performance</a></li>
</ul>
<div class="strategy">This copy shows when the li is clicked on</div>
This is me attempting to hide a div given the url with js
var jQ = jQuery.noConflict();
jQ(document).ready(function() {
var url = document.location.href;
if
(url.indexOf('http://localhost:8888/site/funds/#tabbed-nav=fund-strategy')
>= 0) {
jQ('.fourth').hide();
};
});

Which CSS selector is stronger=?iso-8859-1?Q?=3F_=96_stackoverflow.com?=

Which CSS selector is stronger? – stackoverflow.com

I got this question in job interview. Which selector is stronger #nav
li.current or div #nav li and second a.test or .test .test What is the
answer?

Small question on equivalence relation

Small question on equivalence relation

What is the partition set $G/H$ ???
such that $G$ is a group and $H\subset G$
is it $\lbrace x H; x\in G\rbrace $ ???
Please,
Thank you

Monday, 30 September 2013

rkhunter says apps not checked at users request. Thats ews to me.

rkhunter says apps not checked at users request. Thats ews to me.

I just ran rkhunter for the first time on a new system. I noticed that the
log noted that apps and hidden apps were disabled at the users request. Am
I missing something in the logic or is there something wrong here. Here's
a relevant part of the log. What caused rkhunter to not check hidden
processes and the apps? Or is this normal behavior?
[15:56:55] Info: Test 'hidden_procs' disabled at users request. [15:56:55]
[15:56:55] Info: Test 'suspscan' disabled at users request. [15:56:55]
[15:56:55] Info: Starting test name 'other_malware' [15:56:55] Performing
check for login backdoors [15:56:55] Checking for '/bin/.login' [ Not
found ] [15:56:55] Checking for '/sbin/.login' [ Not found ] [15:56:55]
Checking for login backdoors [ None found ] [15:56:55] [15:56:55]
Performing check for suspicious directories [15:56:55] Checking for
directory '/usr/X11R6/bin/.,/copy' [ Not found ] [15:56:55] Checking for
directory '/dev/rd/cdb' [ Not found ] [15:56:55] Checking for suspicious
directories [ None found ] [15:56:55] [15:56:55] Checking for software
intrusions [ Skipped ] [15:56:55] Info: Check skipped - tripwire not
installed [15:56:55] [15:56:55] Performing check for sniffer log files
[15:56:55] Checking for file '/usr/lib/libice.log' [ Not found ]
[15:56:55] Checking for file '/dev/prom/sn.l' [ Not found ] [15:56:55]
Checking for file '/dev/fd/.88/zxsniff.log' [ Not found ] [15:56:55]
Checking for sniffer log files [ None found ] [15:56:55] [15:56:55] Info:
Starting test name 'trojans' [15:56:55] Performing trojan specific checks
[15:56:55] Checking for enabled inetd services [ Skipped ] [15:56:55]
Info: Check skipped - file '/etc/inetd.conf' does not exist. [15:56:55]
[15:56:55] Performing check for enabled xinetd services [15:56:55]
Checking for enabled xinetd services [ Skipped ] [15:56:55] Info: Check
skipped - file '/etc/xinetd.conf' does not exist. [15:56:55] Info: Apache
backdoor check skipped: Apache modules and configuration directories not
found. [15:56:55] [15:56:55] Info: Starting test name 'os_specific'
[15:56:55] Performing Linux specific checks [15:56:55] Checking loaded
kernel modules [ OK ] [15:56:56] Info: Using modules pathname of
'/lib/modules/3.2.0-54-generic' [15:56:56] Checking kernel module names [
OK ] [15:56:58] [15:56:58] Info: Starting test name 'network' [15:56:58]
Checking the network... [15:56:58] [15:56:58] Performing checks on the
network ports [15:56:58] Info: Starting test name 'ports' [15:56:58]
Performing check for backdoor ports [15:56:58] Checking for TCP port 1524
[ Not found ] [15:56:58] Checking for TCP port 1984 [ Not found ]
[15:56:59] Checking for UDP port 2001 [ Not found ] [15:56:59] Checking
for TCP port 2006 [ Not found ] [15:56:59] Checking for TCP port 2128 [
Not found ] [15:56:59] Checking for TCP port 6666 [ Not found ] [15:56:59]
Checking for TCP port 6667 [ Not found ] [15:56:59] Checking for TCP port
6668 [ Not found ] [15:56:59] Checking for TCP port 6669 [ Not found ]
[15:56:59] Checking for TCP port 7000 [ Not found ] [15:56:59] Checking
for TCP port 13000 [ Not found ] [15:56:59] Checking for TCP port 14856 [
Not found ] [15:56:59] Checking for TCP port 25000 [ Not found ]
[15:56:59] Checking for TCP port 29812 [ Not found ] [15:57:00] Checking
for TCP port 31337 [ Not found ] [15:57:00] Checking for TCP port 32982 [
Not found ] [15:57:00] Checking for TCP port 33369 [ Not found ]
[15:57:00] Checking for TCP port 47107 [ Not found ] [15:57:00] Checking
for TCP port 47018 [ Not found ] [15:57:00] Checking for TCP port 60922 [
Not found ] [15:57:00] Checking for TCP port 62883 [ Not found ]
[15:57:00] Checking for TCP port 65535 [ Not found ] [15:57:00] Checking
for backdoor ports [ None found ] [15:57:00] [15:57:00] Info: Starting
test name 'hidden_ports' [15:57:00] Checking for hidden ports [ Skipped ]
[15:57:00] Info: Unable to find the 'unhide-tcp' command [15:57:00]
[15:57:00] Performing checks on the network interfaces [15:57:00] Info:
Starting test name 'promisc' [15:57:00] Checking for promiscuous
interfaces [ None found ] [15:57:00] [15:57:00] Info: Test
'packet_cap_apps' disabled at users request. [15:57:00] [15:57:00] Info:
Starting test name 'local_host' [15:57:00] Checking the local host...
[15:57:00] [15:57:00] Info: Starting test name 'startup_files' [15:57:00]
Performing system boot checks [15:57:01] Checking for local host name [
Found ] [15:57:01] [15:57:01] Info: Starting test name 'startup_malware'
[15:57:01] Checking for system startup files [ Found ] [15:57:02] Checking
system startup files for malware [ None found ] [15:57:02] [15:57:02]
Info: Starting test name 'group_accounts' [15:57:02] Performing group and
account checks [15:57:02] Checking for passwd file [ Found ] [15:57:02]
Info: Found password file: /etc/passwd [15:57:02] Checking for root
equivalent (UID 0) accounts [ None found ] [15:57:02] Info: Found shadow
file: /etc/shadow [15:57:02] Checking for passwordless accounts [ None
found ] [15:57:02] [15:57:02] Info: Starting test name 'passwd_changes'
[15:57:02] Checking for passwd file changes [ None found ] [15:57:02]
[15:57:02] Info: Starting test name 'group_changes' [15:57:02] Checking
for group file changes [ None found ] [15:57:02] Checking root account
shell history files [ None found ] [15:57:02] [15:57:02] Info: Starting
test name 'system_configs' [15:57:02] Performing system configuration file
checks [15:57:03] Checking for SSH configuration file [ Not found ]
[15:57:03] Checking for running syslog daemon [ Found ] [15:57:03] Info:
Found rsyslog configuration file: /etc/rsyslog.conf [15:57:03] Checking
for syslog configuration file [ Found ] [15:57:03] Checking if syslog
remote logging is allowed [ Not allowed ] [15:57:03] [15:57:03] Info:
Starting test name 'filesystem' [15:57:03] Performing filesystem checks
[15:57:03] Info: SCAN_MODE_DEV set to 'THOROUGH' [15:57:03] Checking /dev
for suspicious file types [ None found ] [15:57:03] Checking for hidden
files and directories [ Warning ] [15:57:03] Warning: Hidden directory
found: /etc/.java [15:57:03] Warning: Hidden directory found: /dev/.udev
[15:57:03] Warning: Hidden file found: /dev/.initramfs: symbolic link to
`/run/initramfs' [15:57:08] [15:57:08] Info: Test 'apps' disabled at users
request. [15:57:08] [15:57:08] System checks summary [15:57:08]
===================== [15:57:08] [15:57:08] File properties checks...
[15:57:09] Files checked: 135 [15:57:09] Suspect files: 1 [15:57:09]
[15:57:09] Rootkit checks... [15:57:09] Rootkits checked : 242 [15:57:09]
Possible rootkits: 0 [15:57:09] [15:57:09] Applications checks...
[15:57:09] All checks skipped [15:57:09] [15:57:09] The system checks
took: 1 minute and 22 seconds [15:57:09] [15:57:09] Info: End date is Mon
Sep 30 15:57:09 EDT 2013

An exercise from Miranda's book

An exercise from Miranda's book

pLet $f(z)=\frac{4z^{2}(z-1)^{2}}{(2z-1)^{2}}$ define a holomorphic map of
degree 4 from $\mathbb{P}^{1}(\mathbb{C})$ to itself. Show that there are
three branch points, and that the three corresponding permutations in
$S_4$ are $\sigma_1=(12)(34)$, $\sigma_2=(13)(24)$ and $\sigma_3=(14)(23)$
up to conjugacy./p pUsing Hurwitz' formula, we have $\sum_{P \in X}
\operatorname{mult}_P F=6$: clearly $0$ is a branch point (and its
preimages are $0$ and $1$), also $\infty$ is a branch point with preimages
$\frac{1}{2}$ and $\infty$. According to the fact that
$\operatorname{mult}_P F=1+\operatorname{ord}_{\Phi_\alpha(q)}
\frac{d}{dz} (h_\alpha F \Phi_\alpha^{-1})$ and
$\Phi_\alpha=h_\alpha=Id_{\mathbb{C}}$ (because I have just studied the
case $\infty$), I have to find the zeroes of the derivative. I obtain the
ramification points $\frac{1 \mp i}{2}$, which images are respectively
$\pm 1$. So I have 4 branch points and not three as required. The cyclic
structure is $(2,1,1,2)$, so which are the corresponding permutations?/p

Alert when the session Expires with primefaces

Alert when the session Expires with primefaces

I want to display in the session has expired I found many methods to
handle session expiration like BalusC's method. but
but I failed to alert a message, please help me !!

keep image in update form

keep image in update form

My update form is not fully working.
These are in my form.
<tr><td>Afbeelding : </td><td><?php echo "<img
src='upload/".$row['img']."' />"; ?><?php echo $row['img']?></tr>
<tr><td></td><td> <input type="file" name="img"
accept="image/jpg,image/gif,image/png" /></tr></td>
if name="img" is empty, the form should keep the image from the line above
can someone help me with this (I am a beginner)
Full code: (php)
<?php
error_reporting(E_ALL^E_NOTICE);
$id = $_GET['id'];
if($id==""){
echo "Geen nummer ingevuld";
exit;
}
mysql_connect("xxxxxx","xxxx","xxxx") or die("Kan geen verbinding maken
met de server!");
mysql_select_db("xxxx") or die("Kan de ingevoerde database niet vinden");
if ($_POST){
$query = "UPDATE auteurs SET
naam = '".$_POST['naam']."',
img = '".$_POST['img']."',
bio = '".$_POST['bio']."'
WHERE
id = $id
";
mysql_query($query) or die("Uitvoeren mislukt!<br>" . mysql_error());
header("location:auteur2.php");
exit;
}
$query = "SELECT naam, img, bio, id from auteurs WHERE id=$id";
$r = mysql_query($query) or die("Uitvoeren query mislukt<br>" .
mysql_error());
$row = mysql_fetch_array($r);
?>

Sunday, 29 September 2013

Taking a class that extends BroadcastReceiver alone

Taking a class that extends BroadcastReceiver alone

There are many examples of classes that extend BroadcastReceiver to be
activated from another class through intent. Class is also extending from
BroadcastReceiver that are activated in an event such as a received text
message. My question is how to activate a class that extends
BroadcastReceiver when you reach a specified time, for example 8:20 a.m.
without an intent. Do not know if I explained.

UINavigationController transparent for UITableView underneath

UINavigationController transparent for UITableView underneath

I have a UINavigationController handling then navigation in my app. I
would like the navigation bar to show the contents of the UITableView as I
scroll up.
I can't seem to get it to be transparent. I have it set to translucent
self.navigationController.navigationBar.translucent = YES;
But still nothing. I'd like to add color, but I'll worry about that later.
I've tried creating a subclass of UINavigationController and specify
self.navigationBar.backgroundColor = [UIColor clearColor];
self.navigationController.navigationBar.translucent = NO;
But again, no luck. This is what my interface builder looks like...

And this is what it looks like when I scroll the text up under the nav
bar. Any suggestions?

Primary-, foreign keys and relationship model

Primary-, foreign keys and relationship model

For my homework, we need to create a sql database model on paper, but I'm
stuck at the following subject:
We have different people, with some data assigned to them:
Person table:
person_id (Primary key)
person_name
person_number
.....
Now we have to create a talent table, for every person has some kind of
talent (IT, Art, singing, ...) and it has to be linked somehow. The catch
here is that a person can have multiple talents(IT and art together).
What's the best way to create this relationship between those 2 tables?

What kinds of library, plugin used on following website

What kinds of library, plugin used on following website

New slide is loaded without reload the page on this site. And Animation is
performed when sliding to new slide. How can it be done without reload
page. Does anyone know what kinds of library or plugin are used on this
website?
http://console-to-chrome.appspot.com/#1

Saturday, 28 September 2013

Bundle install is throwing error when installing coffee-script-source -v '1.6.3'

Bundle install is throwing error when installing coffee-script-source -v
'1.6.3'

I'm using Ruby 2.0.0 and Rails 4 but I'm getting an error with
coffee-script when I generate new rails project
Installing coffee-script-source (1.6.3) Errno::EACCES: Permission denied -
/usr/local/rvm/gems/ruby-2.0.0-p247/build_info/coffee-script-source-1.6.3.info
An error occurred while installing coffee-script-source (1.6.3), and
Bundler cannot continue. Make sure that gem install coffee-script-source
-v '1.6.3' succeeds before bundling.

Not redirecting on successfull login

Not redirecting on successfull login

I have compleated a login form and works 100% on my WAMP server however
when I run it on a live server everything works 100% apart from when i log
in it does not redirect my page to the page it should (just displays a
blank HTML page). It is however logged in because if I enter the url of
the page it sould go it displayes like it should. The path to the file is
correct. I hope my problem is clear. Here is the code for my login form:
<?php include_once "includes/scripts.php"; ?>
<?php
session_start();
include_once ("includes/connect.php");
if (isset($_SESSION['logged_in'])) {
header('location: admin_cms.php');
exit();
}else{
if (isset($_POST['username'], $_POST['password'])){
$username = $_POST['username'];
$password = md5($_POST['password']);
if (empty($username) or empty($password)){
$error = '<p>NOTE: Fields are blank</p>';
}else{
$query = $pdo->prepare("SELECT * FROM users WHERE user_name =
? AND user_password =?");
$query->bindValue(1, $username);
$query->bindValue(2, $password);
$query->execute();
$num = $query->rowCount();
if ($num == 1){
$_SESSION['logged_in'] = true;
header('location: admin_cms.php');
exit();
}else{
$error = "<p>NOTE: The username or password is
incorrect</p>";
}
}
}
?>
<div id="login_container">
<br><img src="images/camelhorst_logo_full.png"
style="margin-top:38px;">
<h1>LOGIN<img src="images/three_column_grid_line.png"
alt="line"></h1>
<form acton = "admin.php" method="post" autocompleate="off">
<label>Username:</label>
<input type="text" name="username" placeholder="Your Username"
required autocomplete="off">
<label>Password:</label>
<input type="password" name="password" placeholder="Your
Password" required autocomplete="off">
<input type="submit" value="Login" name="submit_login">
</form>
<?php if (isset($error))
{echo $error;}?>
<p id="copyright_admin"> © CAMELHORSE CREATIVE STUDIO 2013 </p>
</div><!--login_container-->
<?php } ?>
</body>
</html>
I am sorry if it is a noob question or i am overlooking something simple
but i am very new to PHP

Compare NSDates for time intervals

Compare NSDates for time intervals

I want to update my view but only after a certain time interval since
there are rate limits within my request. Any help would be greatly
appreciated. I save a NSDate :
[[NSUserDefaults standardUserDefaults] setObject:[[NSDate date]
dateByAddingTimeInterval:120.0]
forKey:@"lastProfileUpdate"];
Then I later try to only update info if this time is greater then the
current date by
NSDate *savedDate = [[NSUserDefaults standardUserDefaults]
objectForKey:@"lastProfileUpdate"];
NSLog(@"Old time %@ < now %@",savedDate,[NSDate date]);
if ([[NSDate date] timeIntervalSinceDate:savedDate] >120.0) {
NSLog(@"update info");
[self fetchUserInfo];
return;
}
This is what I log, what am I doing wrong?
Old time 2013-09-28 14:22:33 +0000 < now 2013-09-28 14:29:50 +0000
Edit: I should have logged this before:
NSLog(@"time inteval since date %f",[[NSDate date]
timeIntervalSinceDate:savedDate]);time
inteval since date -84.057351
For some reason after I thought it wasnt working but clearly it is. Thanks

Accessing environment variables with the same name than bash variables

Accessing environment variables with the same name than bash variables

This outputs 1:
A=1; A=2 echo $A
While this outputs 2:
A=1; A=2 python2 -c 'import os; print os.environ["A"]'
In bash, is there any way to read the environment variable instead of the
bash variable without writing helper code (python, perl, etc)?

Friday, 27 September 2013

What is the motivation behind static polymorphism in C++?

What is the motivation behind static polymorphism in C++?

I understand the mechanics of static polymorphism using the Curiously
Recurring Template Pattern. I just do not understand what is it good for.
The declared motivation is:
We sacrifice some flexibility of dynamic polymorphism for speed.
But why bother with something so complicated like:
template <class Derived>
class Base
{
public:
void interface()
{
// ...
static_cast<Derived*>(this)->implementation();
// ...
}
};
class Derived : Base<Derived>
{
private:
void implementation();
};
When you can just do:
class Base
{
public:
void interface();
}
class Derived : public Base
{
public:
void interface();
}
My best guess is that there is no semantic difference in the code and that
it is just a matter of good C++ style.
Herb Sutter wrote in Exceptional C++ style: Chapter 18 that:
Prefer to make virtual functions private.
Accompanied of course with a thorough explanation why this is good style.
In the context of this guideline the first example is good, because:
The void implementation() function in the example can pretend to be
virtual, since it is here to perform customization of the class. It
therefore should be private.
And the second example is bad, since:
We should not meddle with the public interface to perform customization.
My question is:
What am I missing about static polymorphism? Is it all about good C++ style?
When should it be used? What are some guidelines?

How can I add a delete function to this code that stores stuff in localStorage?

How can I add a delete function to this code that stores stuff in
localStorage?

I'm adding names of blogs to localStorage. I use those to make links and
get avatars.
Here's a fiddle that does the adds but I need a nice delete function for
individual entries.
Here's part of what's at the fiddle:
$("button").click(function () {
var id = $("#id").val();
if (id != "") {
var text = 'http://' + id + '.tumblr.com';
} else {
alert('empty');
return false
}
// UPDATE
var blog = JSON.parse(localStorage.getItem("result"));
if (result == null) result = [];
result.push({
id: id,
tumblr: text
});
// SAVE
localStorage.setItem("blog", JSON.stringify(result));
// APPEND
$("#faves").append($("<a></a>").attr("href", text).html(imgstem + id +
imgstemclose));
});
// INIT
var result = JSON.parse(localStorage.getItem("result"));
var stem = 'http://'
var stemclose = '.tumblr.com';
var imgstem = '<img src="http://api.tumblr.com/v2/blog/'
var imgstemclose = '.tumblr.com/avatar/48"/>'
if (result != null) {
for (var i = 0; i < blog.length; i++) {
var item = blog[i];
$("#faves").append($("<a></a>").attr("href", stem + item.id +
stemclose).html(imgstem + item.id + imgstemclose));
}
}
I'm still learning every day so please feel free to make recommendations
that will improve this first pass.
Thanks!

Image transition is only catching at 2 & 4

Image transition is only catching at 2 & 4

I've had some problems with my image transition and its only working
correctly when the 1 and 3 buttons are clicked on but when the 2 and 4 are
clicked on they get stuck and you can see it gets caught up by the other
images before it. I need it to smooth transition for all images not just 2
and get stuck on the other 2
I want it to look like this:
http://tympanus.net/Tutorials/CSS3SlidingImagePanels/index.html
I'm attaching my css to it, but you can also go here to see it in action.
Of course its had some revisions to make it work for the content I have.
But any help would be great. Thanks!!
http://ricapeeka.com/tester/
.cr-container
{
width: 960px;
height: 600px;
position: relative;
margin: 0 auto;
text-align: center;
}
.cr-container label {
font-style: italic;
width: 240px;
height: 30px;
cursor: pointer;
color: #fff;
line-height: 32px;
font-size: 24px;
float: left;
position: relative;
margin-top: 35px;
z-index: 1000;
}
.cr-container label:before {
content: '';
width: 34px;
height: 34px;
background: #1D3867;
position: absolute;
left: 50%;
margin-left: -17px;
border-radius: 50%;
box-shadow: 0 0 0 4px rgba(255,255,255,0.3);
z-index: -1;
}
.cr-container label:after{
width: 1px;
height: 400px;
content: '';
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%,
rgba(255,255,255,0) 100%);
background: -webkit-gradient(linear, left top, left bottom,
color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(255,255,255,0)));
background: -webkit-linear-gradient(top, rgba(255,255,255,1)
0%,rgba(255,255,255,0) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,1)
0%,rgba(255,255,255,0) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,1)
0%,rgba(255,255,255,0) 100%);
background: linear-gradient(top, rgba(255,255,255,1)
0%,rgba(255,255,255,0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr='#ffffffff', endColorstr='#00ffffff',GradientType=0 );
position: absolute;
bottom: -20px;
right: 0px;
}
.cr-container label.cr-label-img-4:after{
width: 0px;
}
.cr-container input.cr-selector-img-1:checked ~ label.cr-label-img-1,
.cr-container input.cr-selector-img-2:checked ~ label.cr-label-img-2,
.cr-container input.cr-selector-img-3:checked ~ label.cr-label-img-3,
.cr-container input.cr-selector-img-4:checked ~ label.cr-label-img-4 {
color: #1D3867;
}
.cr-container input.cr-selector-img-1:checked ~ label.cr-label-img-1:before,
.cr-container input.cr-selector-img-2:checked ~
label.cr-label-img-2:before,
.cr-container input.cr-selector-img-3:checked ~ label.cr-label-img-3:before,
.cr-container input.cr-selector-img-4:checked ~
label.cr-label-img-4:before {
background: #fff;
box-shadow: 0 0 0 4px #1D3867;
}
.cr-container input {
display: none;
}
.cr-bgimg {
width: 960px;
height: 600px;
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
.cr-bgimg {
background-repeat: no-repeat;
background-position: 0 0;
}
.cr-bgimg div {
width: 240px;
height: 100%;
position: relative;
float: left;
overflow: hidden;
background-repeat: no-repeat;
}
.cr-bgimg div span {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: -240px;
z-index: 2;
text-indent: -9000px;
}
.cr-container input.cr-selector-img-1:checked ~ .cr-bgimg,
.cr-bgimg div span:nth-child(1) {
background-image:
url(/wp-content/uploads/2013/09/Education-Page-Element-26.png);
}
.cr-container input.cr-selector-img-2:checked ~ .cr-bgimg,
.cr-bgimg div span:nth-child(2) {
background-image:
url(/wp-content/uploads/2013/09/Education-Page-Element-27.png);
}
.cr-container input.cr-selector-img-3:checked ~ .cr-bgimg,
.cr-bgimg div span:nth-child(3) {
background-image:
url(/wp-content/uploads/2013/09/Education-Page-Element-28.png);
}
.cr-container input.cr-selector-img-4:checked ~ .cr-bgimg,
.cr-bgimg div span:nth-child(4) {
background-image:
url(/wp-content/uploads/2013/09/Education-Page-Element-29.png);
}
.cr-bgimg div:nth-child(1) span {
background-position: 0 0;
}
.cr-bgimg div:nth-child(2) span {
background-position: -240px 0;
}
.cr-bgimg div:nth-child(3) span {
background-position: -480px 0;
}
.cr-bgimg div:nth-child(4) span {
background-position: -720px 0;
}
.cr-container input:checked ~ .cr-bgimg div span {
-webkit-animation: slideOut .6s ease-in-out;
-moz-animation: slideOut .6s ease-in-out;
-o-animation: slideOut .6s ease-in-out;
-ms-animation: slideOut .6s ease-in-out;
animation: slideOut .6s ease-in-out;
}
@-webkit-keyframes slideOut {
0% {
left: 0;
}
100% {
left: 150px;
}
}
@-moz-keyframes slideOut {
0% {
left: 0;
}
100% {
left: 150px;
}
}
@-o-keyframes slideOut {
}
100% {
left: 150px;
}
}
@keyframes slideOut {
0% {
left: 0;
}
100% {
left: 150px;
}
}
.cr-container input.cr-selector-img-1:checked ~ .cr-bgimg div
span:nth-child(1),
.cr-container input.cr-selector-img-2:checked ~ .cr-bgimg div
span:nth-child(2),
.cr-container input.cr-selector-img-3:checked ~ .cr-bgimg div
span:nth-child(3),
.cr-container input.cr-selector-img-4:checked ~ .cr-bgimg div
span:nth-child(4) {
-webkit-transition: left .5s ease-in-out;
-moz-transition: left .5s ease-in-out;
-o-transition: left .5s ease-in-out;
-ms-transition: left .5s ease-in-out;
transition: left .5s ease-in-out;
-webkit-animation: none;
-moz-animation: none;
-o-animation: none;
-ms-animation: none;
animation: none;
left: 0;
z-index: 10;
}
.cr-titles h3 {
color: #fff;
text-shadow: 1px 1px 6px #333;
}
.cr-titles h3 span {
z-index: 10000;
position: absolute;
width: 94.5%;
left: 0;
text-align: center;
opacity: 0;
top: 50%;
-webkit-transition: opacity .8s ease-in-out;
-moz-transition: opacity .8s ease-in-out;
-o-transition: opacity .8s ease-in-out;
-ms-transition: opacity .8s ease-in-out;
transition: opacity .8s ease-in-out;
}
.cr-titles h3 span:nth-child(1) {
font-family: texgyreadventor, Arial, sans-serif;
font-size: 60px;
display: block;
letter-spacing: 7px;
line-height: 40px;
}
.cr-titles h3 span:nth-child(2) {
margin-top: 69px;
background-image:
url(/wp-content/uploads/2013/09/Education-Page-Element-30.png),
url(/wp-content/uploads/2013/09/Education-Page-Element-31.png);
height: 53px;
font-size: 20px;
padding: 26px;
font-style: italic;
font-family: Cambria, Palatino, "Palatino Linotype", "Palatino LT STD",
Georgia, serif;
}
.cr-container input:checked ~ .cr-titles h3 span:nth-child(1) {
opacity: 0;
-webkit-transform: scale(0.5);
-moz-transform: scale(0.5);
-o-transform: scale(0.5);
-ms-transform: scale(0.5);
transform: scale(0.5);
}
.cr-container input.cr-selector-img-1:checked ~ .cr-titles
div:nth-child(1) span:nth- child(1),
.cr-container input.cr-selector-img-2:checked ~ .cr-titles
div:nth-child(2) span:nth-child(1),
.cr-container input.cr-selector-img-3:checked ~ .cr-titles
div:nth-child(3) span:nth-child(1),
.cr-container input.cr-selector-img-4:checked ~ .cr-titles
div:nth-child(4) span:nth-child(1),
.cr-container input.cr-selector-img-1:checked ~ .cr-titles
div:nth-child(1) span:nth-child(2),
.cr-container input.cr-selector-img-2:checked ~ .cr-titles
div:nth-child(2) span:nth-child(2),
.cr-container input.cr-selector-img-3:checked ~ .cr-titles
div:nth-child(3) span:nth-child(2),
.cr-container input.cr-selector-img-4:checked ~ .cr-titles
div:nth-child(4) span:nth- child(2) {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.collegesFrameDescription {
display: block;
width: 900px;
padding: 10px 30px;
color: #fff;
font-size: .85em;
position: absolute;
height: 125px;
z-index: 9;
bottom: 0;
opacity: 0;
text-align: left;
-moz-column-count: 3;
-webkit-column-count: 3;
-ms-column-count: 3;
column-count: 3;
-moz-column-gap: 20px;
-webkit-column-gap: 20px;
-ms-column-gap: 20px;
column-gap: 20px;
}
.cr-container input.cr-selector-img-1:checked ~ .cr-titles
div:nth-child(1) .collegesFrameDescription,
.cr-container input.cr-selector-img-2:checked ~ .cr-titles
div:nth-child(2) .collegesFrameDescription,
.cr-container input.cr-selector-img-3:checked ~ .cr-titles
div:nth-child(3) .collegesFrameDescription,
.cr-container input.cr-selector-img-4:checked ~ .cr-titles
div:nth-child(4) .collegesFrameDescription {
opacity: 1;
-webkit-transition: opacity .8s ease-in-out;
-moz-transition: opacity .8s ease-in-out;
-o-transition: opacity .8s ease-in-out;
-ms-transition: opacity .8s ease-in-out;
transition: opacity .8s ease-in-out;
}
}

How to test selectors on proxy-objects in objective-C?

How to test selectors on proxy-objects in objective-C?

Is there any way to test selectors/methods that are typically accessed
only via proxy objects?
/* Proxy which may forward
* the method to some other object */
id proxy = [UINavigationBar appearance];
/* This condition returns FALSE
* despite the fact that the method will be
* successfully executed at its destination */
if([proxy respondsToSelector:@selector(setBarTintColor:)]){
[[UINavigationBar appearance] setBarTintColor:color];
}

Can visualvm send automatic email notification

Can visualvm send automatic email notification

We are having an web application hosted on Tomcat 6x and would like to
set-up a server health monitoring tool like visualvm which could send us
'Automatic email notifications' incase of any issues with memory or other
aspects. Since we are planning ot use visualvm that comes along with JDK
(1.6 in our environment),
could anyone help us to know if there is way to configure automatic email
notification ?

Unable to create a new core Solr 3.5. Error in default implementation of CREATE

Unable to create a new core Solr 3.5. Error in default implementation of
CREATE

I am running Solr 3.5 and already have two cores set up by my senior. I
need to add a new core. The Solr home is /runtime/local/solr/. This
directory contains the Solr.xml. So I create a new directory here with my
core's name and then run the following
http://localhost:7658/solr/admin/cores?action=CREATE&name=core0&instanceDir=/runtime/local/solr/core0/
And Apache tomcat keeps returning a 400 error with the message
Error executing default implementation of CREATE
and the description says
The request sent by the client was syntactically incorrect (Error
executing default implementation of CREATE).
What is going wrong here. The syntax seems to be correct from what I've
searched on the web.

Thursday, 26 September 2013

Give String To Tag vallue for Button

Give String To Tag vallue for Button

i wanted to give the String value to Button tag for unique identities.
i tried this code won't work
NSString *A;
NSString * B;
NSString * C;
NSString * D;
firstOptionABtn.tag=[A integerValue];
secondOptonBbtn.tag=[B integerValue];
thirdOptionCbtn.tag=[C integerValue];
fourthOptionDbtn.tag=[D integerValue];
}
- (IBAction)BtnClicked:(UIButton *)sender
{
NSLog(@"%ld",(long)sender.tag);
}
i done like this way but it wll print 0 every time where may i wrong.
please help me out this.
thanks in advance.

Wednesday, 25 September 2013

Memory and Storage in Android Devices

Memory and Storage in Android Devices

My android device has the following configuration.

I wish to know the function of each type of memory.As far as PC/Laptops
are considered ROM is type of memory which is configured by the
manufacturer and we cannot write on it. BIOS chip is a ROM. RAM is a
volatile memory which is erased every time power is turned off. Programs
are loaded into the RAM(memory) and are executed bu the processor.Extrenal
memory can be any pther flash memory like a pendrive or a external HDD.
What are the analogous contexts in android. And what is this internal
memory? Whenever I install any app by default it gets installed in this
internal memory and my device give me an option to move the app from this
internal memory to internal SD card. Can anyone point out the
functionalities of these memory types in android?

Thursday, 19 September 2013

JSF How to add a Hide/Show Toggle Javascript to subTable

JSF How to add a Hide/Show Toggle Javascript to subTable

I am running Rich Faces 3.x, and I have a subTable within a dataTable
which I would like to toggle the show/hide preferably using Java script.
What I have so far...
<rich:dataTable id="bookList_dt" [...]>
<rich:column>
<h:graphicImage id="expand" value="/images/expanded.gif"
onclick="toggleDetails(this);"/>
</rich:column>
<rich:column>
<f:facet name="header">ID</f:facet>
<h:outputText value="#{_item.bookId}"/>
</rich:column>
[...]
<rich:subTable value="#{_item.relatedVersions} var="_relatedItem"
id="relatedVersionsList">
<rich:column>
<f:facet name="header">ID</f:facet>
<h:outputText value="#{_relatedItem.bookId}"/>
</rich:column>
[...]
</rich:subTable>
</rich:dataTable>
And my JavaScript so far...
function toggleDetails(image) {
var detailsId = image.id.substring(0, image.id.lastIndexOf(':')) +
':relatedVersionsList';
var details = document.getElementById(detailsId);
if (details.style.display == 'none') {
details.style.display = 'block';
image.src = '#{minusIcon}';
} else {
details.style.display = 'none';
image.src = '#{plusIcon}';
}
Currently I get an error, stating that details is null

Where is my sqlite database stored in android?

Where is my sqlite database stored in android?

I have created a sqlite database in android, I can query it inside my code
but I cannot find it on the filesystem/sdcard.
I have checked the other SO questions, its NOT in data/data/package-name...
I do see a data entry on my app taking up 52kb space, so its there,
furthermore when I run the app again it does not trigger a OnCreate
meaning it already has the DB.
My phone is rooted & I am using a custom jelly bean rom that runs fine for
all intents and purposes.
Any ideas where it could be?
CODE c#
public class SqliteHelper : SQLiteOpenHelper
{
private const string DATABASE_NAME = "Book";
private const int DATABASE_VERSION = 1;
public SqliteHelper(Context ctx)
: base(ctx, DATABASE_NAME, null, DATABASE_VERSION)
{ }
// Method is called during creation of the database
public override void OnCreate(SQLiteDatabase db)
{
db.BeginTransaction();
try
{
db.ExecSQL("CREATE TABLE Chapters (Id INTEGER PRIMARY KEY
AUTOINCREMENT, Name TEXT NOT NULL);");
ContentValues cv = new ContentValues();
cv.Put("Name", "1. Family");
db.Insert("Chapters", null, cv);
cv.Put("Name", "2. Shopping");
db.Insert("Chapters", null, cv);
cv.Put("Name", "3. Work");
db.Insert("Chapters", null, cv);
db.SetTransactionSuccessful();
}
finally
{
db.EndTransaction();
}
//if(db.IsOpen())
// db.Close();
}

Is it possible to make browsers avoid showing you sites from a customized list within the search results?

Is it possible to make browsers avoid showing you sites from a customized
list within the search results?

I hate it when some sites appear again and again within my google (or any
other search engine) list.
For instance, look in google images for "samurai soldier with sword". The
list is plagued with sites trying to sell you such images. You can combat
this by adding their names preceded by a minus sign every time you do a
search. But the list can be enormous, and repeating the process every time
is really annoying, tiring, and time consuming:
"samurai soldier with sword" -depositphotos.com -graphicleftovers.com
-123rf.com
Is not there any firefox plugin or something that allows me to add
"123rf.com" just once and for all in some kind of filter list, and from
that moment never see it again in any of my future search results, as if
the site had completely wiped out of existance?

HTML / javascript image in specific cell

HTML / javascript image in specific cell

Ok here is my questation. im stuck for a while
I have a table 3x3. I wanna to replace couple of images I have no idea
how. In that table I have 4 images, 1st is in middle cell in first row,
saying home, 2nd,3rd,4th are in middle row, 2nd saying software,3rd,
middle image displays my logo, 3rd image says forum, and final 5th, is in
3rd, final row saying about. So I wanna keep the logo image that is in
center of table until user hovers over one of 4 categories, home,
forum,software and about, Then I wanna if user hovers over one of these 4
categories, middle image become image representing image of specific
category, example if user hovers over software button, logo image would be
replaced with image representing software...
Sorry for bad language and I hope you get idea of what I want to do

make library For Draw a line iphone sdk

make library For Draw a line iphone sdk

I am developing a library for a draw a line but UIView's or UIImageView's
touch method not called.
(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
i try but this method not calling in library. this code work fine in demo.

focus() not firing the focus event when called from jQuery(document).ready

focus() not firing the focus event when called from jQuery(document).ready

I have a page with a large form on it and I am trying to assign the form
element that has focus when the page loads. It appears to be working in
that the cursor is place in the selected form element, however, the focus
event is not fired. If I minimize the browser and then maximize it again
the focus event is then fired, but not on jQuery(document).ready(). Any
advice appreciated...
jQuery(document).ready(function()
{
console.log("call focus");
jQuery("#tbl_Employees").find(".employeeinfo:eq(" + IndexEmp +
")").find("tr#trSequence").find("td:eq(5)").children(":first").focus();
});
jQuery(":input").focus(function(e)
{
console.log("enter focus");
});

selecting an option for auditing purposes

selecting an option for auditing purposes

I'm designing a table to audit language (currently there are 15) selection
of users on my website. I have two table style and coding to with them but
I need your expertises to select one over another so please tell me which
is better. Open for other options if you have any.
Thanks
OPTION 1) New record gets inserted into table after user's language
selection.
TABLE
language - varchar(20) - Not Null
CODE
insert into table (language) values ('english');
OPTION 2) Value of relevant language column gets increased by 1 after
user's language selection.
TABLE
language_x - int(11) - Unsigned
language_y - int(11) - Unsigned
language_z - int(11) - Unsigned
...
...
CODE
update table SET language_x = language_x + 1;

Creating tokens from xml in java

Creating tokens from xml in java

How tokenization can be achieved in Java for the below input?
The input is an xml file and need tokens as mentioned in the output.
Sample Input:
<Person>Peter Cathery</Person> lives in
<Location>Melbourne</Location>,
<Location>Australia</Location>
. He is 50 years old and he spent
<Money>$100000</Money>
on his house and any kind of disputes on his house will be part of the
jurisdiction of
<Location>Melbourne</Location>
police station. His date of birth:
<Date>11-12-1982</Date> and he works for
<Organization>IBM Corporation Ltd</Organization>.
Output required:
Token 1: Peter Cathery
Token 2: lives
Token 3: in
Token 4: Melbourne
Token 5: ,

Wednesday, 18 September 2013

Converting one column of data to three in R

Converting one column of data to three in R

Have three variables labeled "User-ID", "ISBN", and "Book-Rating" in the
one column, but prefer three.
Rows: 1,149,903
I read the post about converting one to two, but encountered an error on
the first line of code.
First Line:
User-ID <- df[seq(from = 1, to =nrow(df), by = 3), 1]
Error Message:
Error in seq.default(from = 1, to = nrow(df), by = 3) :
'to' must be of length 1
I saved the .csv file as a data.frame using:
as.data.frame.matrix(BX.Book.Ratings)
Below shows screenshot. Please let me know if I can provide additional
information.
Thank you

how to set my website in order to visit my site without adding "/wordperss"?

how to set my website in order to visit my site without adding "/wordperss"?

When i visit my websiite, I have to type "mysite.com/wordpress". How to
set website in order to visit my site via "mysite.com"? I have tried some
methods, but they didn't work.Editing .htaccess or wp-config.php? Thanks.

_delegate respondsToSelector:selector is not calling the method

_delegate respondsToSelector:selector is not calling the method

I have one class and one view controller. class has _delegate
respondsToSelector:selector. But it is not calling the method(selector).
After viewing my code below, would you please tell what am I doing wrong.
FYI, This code worked before, but suddenly stopped working.
MyClass.h:
@protocol MyClassDelegate <NSObject>
@optional
-(void) receivedEvent:(TripEvent *) event;
@end
@interface MyClass : NSObject<MyClassEngine>
@property(assign) id<MyClassDelegate> delegate;
@property BOOL delegateOnMainThread;
-(id) initWithDelegate:(id<UbiTripRecorderDelegate>) tripDelegate
onMainThread:(BOOL) onMainThread;
- (void) dispatchDelegate:(SEL)selector
withObject:(id)obj;
MyClass.m contains the following code:
#import "MyClass.h"
@implementation MyClass
....
....
-(void) startPlaying {
[self dispatchDelegate:@selector(receivedEvent:) withObject:newEvent];
}
- (void) dispatchDelegate:(SEL)selector withObject:(id)obj {
@try {
if(_delegate && [_delegate respondsToSelector:selector]) {
NSLog(@"I can't come to this point");
}
}
}
I've also added the following code in my view controller:
@interface MyViewController : BaseViewController<MyClassDelegate>
The problem is that the if(_delegate && [_delegate
respondsToSelector:selector]) - logic never return true. Can anybody
please check the code and let me know, if anything is wrong with my code?

Using pointers references

Using pointers references

I need use a var from pointer reference in another function, so, when I
call that I pass the address value, but how can I use this pointer there
(not creating another instance)? Look the code segment:
//Main region - using Product class -> _products = vector<Product>
int main()
{
_products.reserve(2);
for(i=0;i<2;i++)
productRefe.SetProduct(&_products);
return 0;
}
//Method in Product.cpp
void Product::SetProduct(vector<Product> *productsP)
{
vector<Product> products = *productsP;
Product productInsert;
cout << "Type the description: ";
cin >> productInsert.Struct.description;
products.push_back(productInsert);
}
I believe the problem is in the first line in method SetProduct... But,
what can I change to it works? Thanks

I want the first div to fade out and then second to fade by using a dummy submit button

I want the first div to fade out and then second to fade by using a dummy
submit button

I want the <div id="fadeout"> to fadeout when the submit button is
clicked, and then the <div id="fadein"> to fade in to replace the previous
div. Not having much luck at all.
I've tried several methods but just can't figure it out.
Any help is appreciated
<html>
<title>Break Calculator</title>
<head>
<style>
body {
background: #0e415f;
min-width:55em;
max-width:200em;
font-family: Omnes, Myriad Pro, arial, Helvetica;
color: #f1a400;}
.salary_div {
width: 12em;
margin: 0 auto;}
.salary_input{
width: 6em;
height: 1.2em;
font-size: 2em;}
.submit_div {
width: 8em;
margin: 1em auto;}
.header {
width: 55em;
margin: 0 auto;}
.clock {
border: .1em solid #f1a400 double;
border-radius: .1em;
border-style: double;
width: 3.5em;
margin: 20 auto;
font-size: 10em;
text-align:center;}
.money {
border: .1em solid #f1a400 double;
border-radius: .1em;
border-style: double;
width: 3.5em;
margin: 20 auto;
font-size: 10em;
text-align:center;}
.buttons {
width: 24.5em;
margin: 1em auto;}
.button_style{
height:2.5em;
width:6em;
font-size:1.2em;
margin: 0 .3em;
background: #f1a400;
border-radius: .4em;
border: 0;}
</style>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript">
var salary;
var seconds=-1.0; /* To start clock at 0 seconds */
var min=0;
var time;
var secPay;
var timerPay = 0;
function getSalary() {
var salaryAm = document.getElementById("salaries");
salary = salaryAm.value;
secPay = salary/(52*40*60*60); // Weeks * Hours * Minutes *
Seconds *//
}
function timer(){
seconds++;
if(seconds>59){
min++;
document.getElementById("mins").innerHTML=padTimer(min);
seconds=0;}
document.getElementById("secs").innerHTML=padTimer(seconds);
document.getElementById("money").innerHTML=parseFloat(secPay*timerPay++).toFixed(2);
};
function padTimer(x) {
if (x<=9) { x = ("0"+x); }
return x;}
function start(){
if (getSalary()) {
alert("please check input");
} else {
time=setInterval(timer, 1000);
timer();}
};
function pause() {
clearInterval(time);
seconds--;
timerPay--;};
function reset(){
seconds=-1.0;
timerPay=0;
time=0;
if (min !=0){
min=0;}
};
</script>
</head>
<body>
<div class="header"><img src="breakcalc.png"></div>
<div id="fadeout">
<div class="salary_div">
<input id="salaries" type="text" class="salary_input">
</div>
<div class="submit_div">
<a id="submit"><button class="button_style">Submit</button></a>
</div>
</div>
<div id="fadein">
<div class="clock" id="slideout">
<span id="mins" >00</span>:<span id="secs">00</span>
</div>
<div class="money">
<span>$ </span><span id="money">0.00</span>
</div>
<div class="buttons">
<a href="#" id="button" onclick="start()" ondblclick="return
false;"><button class="button_style">Start</button></a>
<a href="#" id="button" onclick="pause()"><button
class="button_style">Stop</button></a>
<a href="#" id="button" onclick="reset()"><button
class="button_style">Reset</button></a>
</div>
</div>
</body>
</html>

Backup a database using sql server 2008

Backup a database using sql server 2008

Why the backup database process stop at executing on 100% and success
message doesn't appear when doing a database backup using sql server 2008?
Please help me...

Xslt array and / or loop

Xslt array and / or loop

I have following question, basically i just would like to create a custom
array, something like - Yellow | Red | Green
And after loop through this items using for-each and printing the values,
i created something like this:
<xsl:variable name="Colors">
<m>Yellow</m>
<m>Red</m>
<m>Green</m>
</xsl:variable>
And then i try to loop on it:
<xsl:for-each select="$Colors">
<xsl:value-of select ="current()" />
</xsl:for-each>
But i get this error: Exrpession must evalutate to a node-set $Colors
Any idea, what could be wrong?

Starting application on boot completed

Starting application on boot completed

The following is the code I'm using for starting my Application when
device is turned on.
public class BootReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Log.i("BootReceiver","intent received");
Intent myIntent = new Intent(context, ACT_Home.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);
}
}
and in the Manifest (as <Application> child):
<receiver android:name="host.alarmmanager.BootReceiver">
<intent-filter >
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
The permissions inside the Manifest are the following:
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
This works fine on Android 3.2.2, but if I try the same application on
Android 4.0.3 the broadcast receiver does not receive anything. Also the
first line inside the onReceive method is not execeuted. Why this happens?

Tuesday, 17 September 2013

Android, to join and ImageView and a TextView drawing a line on the screen by touch

Android, to join and ImageView and a TextView drawing a line on the screen
by touch

I am not sure what method to use for my goal.
I want to make and app for children where they can see images of animals
and relate those images with the name of the animals by using they fingers
to draw a line between the image and the name.
Should I got the info from OnTouchListener and then, what I use to draw
the line following the finger, and, at the end, should I create a kind of
map with coordinates for write and wrong or maybe I can use the touch
listener of the imageView and the TextView?
I would apreciate any guidelines.
Thanks.

Count no of occurences of elements in single row

Count no of occurences of elements in single row

I got a requirement like i need to find number of occurences of particular
value in a single row of an oracle table.
Say my source table looks likes this,
ID score1 score2 score3 score4 score5
---------------------------------------------
aa -1 65 -1 -1 82
bb -1 65 99 14 82
I need a query which will return the results like,
ID score1 score2 score3 score4 score5 count ( count of -1
occurences)
------------------------------------------------------
aa -1 65 -1 -1 82 3
bb -1 65 99 14 82 1
And the version of oracle i'm using is Oracle 10g (so using PIVOT options
ruled out).can anyone help me out solving this issue.

Using 1 PFQuery (parse.com) for multi page app

Using 1 PFQuery (parse.com) for multi page app

I'm new to Objective c and right now I have a multi page app. Each page
has a UITableView that is populated with the same PFQuery as the others.
This results in API calls for each page. Is there a way to have the
PFQuery in its own class so when I start/refresh the app, it populates all
pages with just one query?

Keyword Automatic Clicker (JavaScript)

Keyword Automatic Clicker (JavaScript)

I would like a JavaScript code that will allow me to specify a certain
keyword and have Twitter click on a link that contains that keyword. The
script should be made for Google Chrome and has to work with the internet
Twitter source, TweetDeck. I have tried this but to no avail.
set myKeyword to "Jordan"
tell application "Google Chrome" tell window 1 to tell active tab set URL
to "https://web.tweetdeck.com//" delay 3 set num_links to (execute
javascript "document.links.length") - 1 repeat with i from 0 to num_links
set myLink to execute javascript "document.links[" & i & "].href" if
myLink contains myKeyword then execute javascript "document.links[" & i &
"].click()" end if end repeat end tell end tell

ASP.net StoreFront Bad Add Product WSI request

ASP.net StoreFront Bad Add Product WSI request

So I fixed a couple of errors that were being spit out, now all I'm
getting is an HTTP 400, anyone have any idea what's wrong?
< POST http://192.168.122.3/ASPDNSF0/ipx.asmx
User-Agent
: libwww-perl/6.05
Content-Type: application/soap+xml; charset="utf-8"
SOAPAction: "http://www.aspdotnetstorefront.com/DoItUsernamePwd"
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap12:Body>
<DoItUsernamePwd xmlns="http://www.aspdotnetstorefront.com/">
<AuthenticationEMail>admin@aspdotnetstorefront.com</AuthenticationEMail>
<AuthenticationPassword>Admin$11</AuthenticationPassword>
<XmlInputRequestString>
<ASPDotNetStorefrontImport Version="9.2">
<Product action="Add">
<Name>my product name</Name>
<SKU>1234</SKU>
<Description><![CDATA[please
add some <b>data</b>]]></Description>
</Product>
</ASPDotNetStorefrontImport>
</XmlInputRequestString>
</DoItUsernamePwd>
</soap12:Body>
</soap12:Envelope>
> HTTP/1.1 400 Bad Request
Cache-Control: private
Date: Tue, 17 Sep 2013 23:06:04 GMT
Server: Microsoft-IIS/7.0
Content-Type: text/html
Client-Date: Tue, 17 Sep 2013 21:06:04 GMT
Client-Peer: 192.168.122.3:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Bad Request

Python - Remove very last character in file

Python - Remove very last character in file

After looking all over the internet, I've come to this.
Let's say I have a already made text file that reads: Hello World
Well I want to remove the very last character --In this cased-- from the
text file.
So now the text file should look like this: Hello Worl
But I have no idea how to do this.
All I want, more or less, is a single backspace function for text files on
my hdd.
This needs to work on Linux as that's what I'm using. Thanks!

uploading image file error

uploading image file error

this php script is retuning errors when I try and upload a file. I'm using
XAMPP on a win xp machine. I believe I've set sharing permissions
correctly.
the script:
//For images
if (isset($_FILES['image300x100']) &&
!empty($_FILES['image300x100']['tmp_name'])) {
$name = $_FILES['image300x100']['name']; // getting the name of the file
$tempName = $_FILES['image300x100']['tmp_name']; // getting the
temporary file name.
$allowedExt = array('jpg', 'jpeg', 'png', 'gif' );// specifying the
allowed extentions
$a = explode('.', $name);
$fileExt = strtolower(end($a)); unset($a);//
$fileSize = $_FILES['image300x100']['size'];
$filePath = "";
switch($category){
case 1 : $filePath =
"c:/www/Perspect/categories/politics/articleImages"; break;
//etc etc etc
}
$path = $filePath;
} else{
$errors[] = 'no file selected';
}
$moveResult = move_uploaded_file($tempName, $filePath);
left as it is the error is:
Warning: move_uploaded_file(): The second argument to copy() function
cannot be a directory in C:\www\Dev\admin\addNewArticle.php on line 62
Warning: move_uploaded_file(): Unable to move
'C:\Server\XAMPP\tmp\php62C.tmp' to
'c:/www/Dev/categories/bla/articleImages' in
C:\www\Dev\admin\addNewArticle.php on line 62
I removed the c:/from the path which I thought was the correct path but
that gave a result of:
temp nameC:\Server\XAMPP\tmp\php62E.tmp filepath
www/Dev/categories/bla/articleImages
Warning: move_uploaded_file(www/Dev/categories/bla/articleImages): failed
to open stream: No such file or directory in
C:\www\Dev\admin\addNewArticle.php on line 62
Warning: move_uploaded_file(): Unable to move
'C:\Server\XAMPP\tmp\php62E.tmp' to 'www/Dev/categories/bla/articleImages'
in C:\www\Dev\admin\addNewArticle.php on line 62
Any help hugely appreciated

Sunday, 15 September 2013

Is it possible to use Youtube API with HybridAuth?

Is it possible to use Youtube API with HybridAuth?

I am trying out HybridAuth and I wonder whether it supports somehow
Youtube API. However, I did not find anything about it despite of
searching hard. Does anybody know the answer to me question?

(node) warning: possible EventEmitter memory leak detected

(node) warning: possible EventEmitter memory leak detected

I wrote a little scraper script built on top of cheerio.js and request.js
to get contact information (URLs and emails) off of an booking agency's
site. While it does run and returns all the information I need, I'm
getting the following warning 5 times in a row while running it:
(node) warning: possible EventEmitter memory leak detected. 11 listeners
added. Use emitter.setMaxListeners() to increase limit.
Trace
at Socket.EventEmitter.addListener (events.js:160:15)
at Socket.Readable.on (_stream_readable.js:689:33)
at Socket.EventEmitter.once (events.js:179:8)
at Request.onResponse
(/home/max/Desktop/scraping/node_modules/request/request.js:625:25)
at ClientRequest.g (events.js:175:14)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1689:21)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete]
(http.js:120:23)
at Socket.socketOnData [as ondata] (http.js:1584:20)
at TCP.onread (net.js:525:27)
My instinct is telling me I am probably getting this warning because of
the fact that I nested a request with in another request. I am not certain
though but what I do know is that the warning shows up right when the
nested request located in one of the getArtistInfo() function's cheerio.js
.each() loop is called. (look at code below to see what I mean)
Here is the code for my scraper:
var request = require('request');
var cheerio = require('cheerio');
var url = 'http://www.primarytalent.com/';
var getManyArtistsInfo = function(url){
request(url, (function(){
return function(err, resp, body) {
if(err)
throw err;
$ = cheerio.load(body);
// TODO: scraping goes here
$('#rosterlists div li a').each(function(){
var urlCap = this[0]['attribs']['href'].slice(1);
var artistURL = url.concat(urlCap);
console.log(artistURL);
getArtistInfo(artistURL);
});
}
})());
}
var getArtistInfo = function(artistURL){
request(artistURL, (function(){
return function(err, resp, body) {
if(err)
throw err;
$ = cheerio.load(body);
console.log("NOW SCRAPING artist's PAGE")
var artistName = "";
$('#content #col3-1 h1').each(function(){
artistName = this.text();
console.log(artistName);
});
$('#content #col3-1 #links li a').each(function(){
var socialURL = this.attr('href');
var siteURL = "";
var facebookURL = "";
var twitterURL = "";
var soundcloudURL = "";
var bandcampURL = "";
var myspaceURL = "";
switch(socialURL) {
case socialURL.indexOf("facebook"):
facebookURL = socialURL;
console.log(facebookURL);
break;
case socialURL.indexOf("twitter"):
twitterURL = socialURL;
console.log(twitterURL);
break;
case socialURL.indexOf("soundcloud"):
soundcloudURL = socialURL;
console.log(soundcloudURL);
break;
case socialURL.indexOf("bandcamp"):
bandcampURL = socialURL;
console.log(bandcampURL);
break;
case socialURL.indexOf("myspace"):
myspaceURL = socialURL;
console.log(myspaceURL);
break;
default:
siteURL = socialURL;
console.log(siteURL)
}
});
// get agentURL
$('#content #col3-1 .contacts li a').each(function(){
var agentURL = url + this.attr('href').slice(1);
console.log("Agent url is : " + agentURL);
request(agentURL, artistName, (function(){
return function(err, resp, body) {
if(err)
throw err;
$ = cheerio.load(body);
console.log("NOW SCRAPING AGENT'S PAGE")
var agentName = $('#content #col3-1 #details li h1').text();
console.log(agentName + ' reps ' + artistName);
var agentEmail = $('#content #col3-1 #details li
a').attr("href").slice(7);
console.log(agentEmail);
var agentPhone = $('#content #col3-1 #details li').last().text();
console.log(agentPhone);
var agentArtistList = [];
$('#content #col3-1 #artists li a').each(function(){
agentArtistList.push(this.text());
});
console.log(agentName + ' represents ' +
agentArtistList.length + ' artists!');
}
})(agentURL, artistName));
});
}
})(artistURL));
}
getManyArtistsInfo(url);
Did I make spaghetti mess here?
How can I stop this EventEmitter memory leak issue from happening?

Java class failing a lot of JUnit tests, not sure why

Java class failing a lot of JUnit tests, not sure why

I have a class that I need to modify so that it passes a bunch of JUnit
test cases given to us by the professor. I am not sure why they are
failing. I have moved everything I can into the constructor and I have
switched around the order of the functions to no luck.
Here is my class that I must modify
public class DayOfWeek1 {
int myMonth, myDayOfMonth, myYear, myAdjustment, numericDayOfWeek,
remainderSeven;
/*
* @param what the date was
*/
public DayOfWeek1(int month, int dayOfMonth, int year){
myMonth = month;
myDayOfMonth = dayOfMonth;
myYear = year;
remainderSeven = 0;
if(myMonth==1){
myAdjustment = 1;
if(myYear%4==0){
myAdjustment=0;
}
}
if(myMonth==2){
myAdjustment = 4;
if(myYear%4==0){
myAdjustment=3;
}
}
if(myMonth==3){
myAdjustment = 4;
}
if(myMonth==4){
myAdjustment = 0;
}
if(myMonth==5){
myAdjustment = 2;
}
if(myMonth==6){
myAdjustment = 5;
}
if(myMonth==7){
myAdjustment = 0;
}
if(myMonth==8){
myAdjustment = 3;
}
if(myMonth==9){
myAdjustment = 6;
}
if(myMonth==10){
myAdjustment = 1;
}
if(myMonth==11){
myAdjustment = 4;
}
if(myMonth==12){
myAdjustment = 6;
}
int fourDivides = myYear / 4;
numericDayOfWeek = myAdjustment + myDayOfMonth + (myYear-1900) +
fourDivides;
remainderSeven = numericDayOfWeek % 7;
}
/*
* @return the month in a string
*/
public String getMonthString(){
if(myMonth==1){
return "January";
}
if(myMonth==2){
return "February";
}
if(myMonth==3){
return "March";
}
if(myMonth==4){
return "April";
}
if(myMonth==5){
return "May";
}
if(myMonth==6){
return "June";
}
if(myMonth==7){
return "July";
}
if(myMonth==8){
return "August";
}
if(myMonth==9){
return "September";
}
if(myMonth==10){
return "October";
}
if(myMonth==11){
return "November";
}
if(myMonth==12){
return "December";
}
else{
return "NO_VALUE";
}
}
public int getDayOfMonth(){
return myDayOfMonth;
}
/*
* @return what year it was
*/
public int getYear(){
return myYear;
}
public int getNumericDayOfWeek(){
return remainderSeven;
}
public String getDayOfWeek(){
//numericDayOfWeek = this.getNumericDayOfWeek();
if(numericDayOfWeek==0){
return "Saturday";
}
if(numericDayOfWeek==1){
return "Sunday";
}
if(numericDayOfWeek==2){
return "Monday";
}
if(numericDayOfWeek==3){
return "Tuesday";
}
if(numericDayOfWeek==4){
return "Wednesday";
}
if(numericDayOfWeek==5){
return "Thursday";
}
if(numericDayOfWeek==6){
return "Friday";
}
else{
return "NO_VALUE";
}
}
/*
* @return the numeric day of the week
*/
/*
* returns what day of the week it was
*/
/*
* @return the month in an int
*/
public int getMonth(){
return myMonth;
}
/*
* @return what day of the month it was
*/
}
Here is one of the classes given to us by the professor, I think it acts
as a passer between my class and the test cases
package dayofweek;
/**
* Require API to conform to is:
*
* public DayOfWeek(int month, int dayOfMonth, int year) constructor
* public int getNumericDayOfWeek() (where Saturday = 0, É, Friday = 6,
NO_VALUE = -1)
* public String getDayOfWeek() (where "Saturday", "Sunday", É, "Friday",
null)
* public int getMonth() (where January=1, December=12)
* public String getMonthString()
* public int getDayOfMonth()
* public int getYear()
*
*/
public class DayOfWeek
{
public final static int NO_VALUE = -1;
private int myDOWnum;
private String myDOWstring;
public DayOfWeek(int month, int dayOfMonth, int year)
{
if (month == 1 && dayOfMonth == 1 && year == 1900)
{
myDOWnum = 2;
myDOWstring = "Monday";
}
else
{
myDOWnum = NO_VALUE;
myDOWstring = null;
}
}
public int getNumericDayOfWeek()
{
return myDOWnum;
}
public String getDayOfWeek()
{
return myDOWstring;
}
public int getMonth()
{
return NO_VALUE;
}
public String getMonthString()
{
return null;
}
public int getDayOfMonth()
{
return NO_VALUE;
}
public int getYear()
{
return NO_VALUE;
}
}
and here is a JUnit class that fails every test case
package dayofweektesting;
import dayofweek.DayOfWeek;
import static org.junit.Assert.*;
import org.junit.Test;
/**
* Test cases for "Day of week" lab assuming requirements set
* at top of DayOfWeek class
*
* Test valid leap years
*
*
*/
public class TestValidLeapYears {
/**
* Test valid 2/29/XXXX dates
*/
@Test
public void firstValidLeapYear() {
DayOfWeek dow = new DayOfWeek(2, 29, 1904);
assertTrue(dow.getDayOfWeek().compareTo("Monday") == 0);
assertTrue(dow.getNumericDayOfWeek() == 2);
}
@Test
public void secondValidLeapYear() {
DayOfWeek dow = new DayOfWeek(2, 29, 1908);
assertTrue(dow.getDayOfWeek().compareTo("Saturday") == 0);
assertTrue(dow.getNumericDayOfWeek() == 0);
}
@Test
public void thirdValidLeapYear() {
DayOfWeek dow = new DayOfWeek(2, 29, 1912);
assertTrue(dow.getDayOfWeek().compareTo("Thursday") == 0);
assertTrue(dow.getNumericDayOfWeek() == 5);
}
@Test
public void fourthValidLeapYear() {
DayOfWeek dow = new DayOfWeek(2, 29, 1916);
assertTrue(dow.getDayOfWeek().compareTo("Tuesday") == 0);
assertTrue(dow.getNumericDayOfWeek() == 3);
}
/**
* Test boundary dates of2/28/XXXX and 3/1/XXXX for valid leap years
*/
@Test
public void firstValidLeapYearBoundaries() {
DayOfWeek dow = new DayOfWeek(2, 28, 1904);
assertTrue(dow.getDayOfWeek().compareTo("Sunday") == 0);
assertTrue(dow.getNumericDayOfWeek() == 1);
dow = new DayOfWeek(3, 1, 1904);
assertTrue(dow.getDayOfWeek().compareTo("Tuesday") == 0);
assertTrue(dow.getNumericDayOfWeek() == 3);
}
@Test
public void secondValidLeapYearBoundaries() {
DayOfWeek dow = new DayOfWeek(2, 28, 1908);
assertTrue(dow.getDayOfWeek().compareTo("Friday") == 0);
assertTrue(dow.getNumericDayOfWeek() == 6);
dow = new DayOfWeek(3, 1, 1908);
assertTrue(dow.getDayOfWeek().compareTo("Sunday") == 0);
assertTrue(dow.getNumericDayOfWeek() == 1);
}
}

Javascript client C++ server game

Javascript client C++ server game

I have a question which path should I follow.
I want to develop real time online game via webbrowsers.
I would want to write game server using C++ with TCP sockets listening.
The client side game will be written in javascript. The only problem I
dont know how to communicate javascript with c++ server using TCP sockets.
I have considered using Socket.IO but as far as I know this library does
not have option to just connect to real TCP server, push bytes through and
read incoming ones. Instead I would need to use some wrapper like Node.JS
server which I want to avoid.
Anyone could guide me which path I should take?

Creating a method

Creating a method

protected void calculateRateButton_Click(object sender, EventArgs e)
{
//declare variables and retrieve user inputs
int nbPeopleInt;
string roomTypeString;
int nbNightsInt;
nbNightsInt = int.Parse(nbNightsTextBox.Text);
nbPeopleInt = int.Parse(nbPeopleDropDownList.Text);
roomTypeString = roomTypeDropDownList.Text;
int totalFareInt = calculateRoomBooking(roomTypeString, nbPeopleInt,
nbNightsInt);
}
private int calculateRoomBooking(string RoomType, int nbNights, int
nbPeople)
{
int totalFareInt = 0;
int dailyRateInt = 0;
// set daily rate based on selected room type
switch (RoomType)
{
case "Standard":
dailyRateInt = 100;
break;
case "Superior":
dailyRateInt = 150;
break;
case "Luxury":
dailyRateInt = 175;
break;
}
// calculation of booking rate
totalFareInt = dailyRateInt * nbNightsInt + 10 * (nbPeopleInt - 1)
* nbNightsInt;
// display booking rate
totalRateTextBox.Text = totalFareInt.ToString();
}
protected void roomDetailsButton_Click(object sender,
ImageClickEventArgs e)
{
// go to room details page
Response.Redirect("RoomDetails.aspx");
}
}
however, it always say that dailyRateInt, nbNightsInt, nbPeopleInt is not
defined with this line:
totalFareInt = dailyRateInt * nbNightsInt + 10 * (nbPeopleInt - 1) *
nbNightsInt;
But I did define them above as you guys can see
please helps

Custom ASP.NET MVC 4 project template puts solution file in project directory?

Custom ASP.NET MVC 4 project template puts solution file in project
directory?

I have created a custom project template for ASP.NET MVC 4 but when I use
the template the solution file, .nuget folder and packages.config ends up
in the same directory as the web project. I guess this is some setting in
either the ProjectTemplate.csproj och in the *.vstemplate file?
This is the content of my ProjectTemplate.csproj
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == ''
">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DEC78F42-230B-45C3-A932-72D05500075B}</ProjectGuid>
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>$safeprojectname$</RootNamespace>
<AssemblyName>$safeprojectname$</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
and this is my *.vstemplate file
<TemplateData>
<Name>CommonProject</Name>
<Description>An ASP.NET MVC 4 project template</Description>
<Icon></Icon>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>Web</ProjectSubType>
<TemplateGroupID>Web</TemplateGroupID>
<TemplateID>8e9f1b5e-75a2-4bf1-8d1c-ab03c2c4d828</TemplateID>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>CommonProject</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<PromptForSaveOnCreation>true</PromptForSaveOnCreation>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<RequiredFrameworkVersion>4.0</RequiredFrameworkVersion>
</TemplateData>
Any ideas what's missing in my template to get the behaviour I want?

Python: Set Color for Tkinter Button using .grid()

Python: Set Color for Tkinter Button using .grid()

using the Python 2.7 Tkinter Grid Layouter, i would like to do something like
root.button = Button(root, bg = 'green', ....)
root.button.grid(...)
in order to get a green button. Running this, it doesn't bring up any
errors, but the button does not take the desired color. Any suggestions
greatly appreciated!

Saturday, 14 September 2013

How do i make paging using jquery ajax for rhomobile app

How do i make paging using jquery ajax for rhomobile app

I have a table where i need to show records in pagination manner.
Let say i have 200 records, i need to show 10 records on each page. I have
used Paginate to get data from Rhom.
MyModel.paginate(:page => 1, :per_page => 10)
So how can i use the ajax call to fetch the next page records without
changing the view.
Help is appreciated.

Trouble with jquery link in html5 file

Trouble with jquery link in html5 file

So here's my html code (Important part is in the triple quotations):
<!DOCTYPE html>
<html>
<head>
<title>To Do</title>
<link rel="stylesheet" type="text/css" href="ToDoApp.css"/>
"""<script type="text/javascript" src="ToDoApp.js"></script>
<script
src="//ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>"""
</head>
<body>
<h2>To Do</h2>
<form name="checkListForm">
<input type="text" name="checkListItem"/>
</form>
<div id="button">Add!</div>
<br/>
<div class="list">
<ol></ol>
</div>
<div class = "counter">
<h4>Things to do:</h4>
</div>
<div class = "comment"></div>
</body>
</html>
and my .css connection is working perfectly, but my .js/jquery connection
is just not functioning. I've tried looking up correct html syntax for
including a link, and I tried alternating among a few different links to
the jquery library. Is there something I'm missing here, have I put the
link in the wrong place, or is the syntax funky? Thanks in advance for any
help.

How to tell at which offset Delphi aligns my record fields

How to tell at which offset Delphi aligns my record fields

Delphi can align records on word, double-word and quad-word bouderies,
depending on the {$A} setting and the version of Delphi.
If I have to following (bad) code:
ofSize = $00; <<-- hardcoded will break if I unpack the record.
ofMSB = $01;
ofPtrDigits = $02;
ofSign = $06;
MinSizeBigint: Byte = 10;
type
TBigint = packed record
Size: Byte;
MSB: Byte;
PtrDigits: Pointer;
Sign: TSignValue;
How do I transform it into this:
type
TBigint = record
PtrDigits: Pointer; (*should be `array of cardinal`, but never mind
that*)
Size: Byte;
MSB: Byte;
Sign: TSignValue;
ofSize = OffsetOf(TBigInt.Size);
ofMSB = OffsetOf(TBigInt.Size);
ofPtrDigits = OffsetOf(TBigInt.Size);
ofSign = OffsetOf(TBigInt.Size);
Is there a function that will fill in the offsets for me using some
compiler magic?

Rails does not load assets located in public directory in production

Rails does not load assets located in public directory in production

Hello i have assets in public directory (because of simplicity)
in layout i load
<link href="/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="/assets/css/jumbotron.css" rel="stylesheet">
<link href="/assets/css/application.css" rel="stylesheet">
and in Development it works well but in Production assets are not loaded.
My Development.rb
Web::Application.configure do
config.cache_classes = false
config.whiny_nils = true
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = false
config.active_support.deprecation = :log
config.action_dispatch.best_standards_support = :builtin
config.active_record.mass_assignment_sanitizer = :strict
config.active_record.auto_explain_threshold_in_seconds = 0.5
config.assets.compress = false
config.assets.debug = true
end
My Production.rb
Web::Application.configure do
config.cache_classes = false
config.consider_all_requests_local = true # default false,
zobrazuje errory
config.action_controller.perform_caching = false # default true
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = true # default false
config.assets.digest = true
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
end

Is there any plugin or add-in for VS 2012 which adds macro preprocessor for C# like in C++

Is there any plugin or add-in for VS 2012 which adds macro preprocessor
for C# like in C++

I know about #defines in C# but they are really poor, i am interested is
there any real macro code preprocessors for C#? That's just my old secret
dream..

what is the MOST efficient way for palindrome detection for a string? [on hold]

what is the MOST efficient way for palindrome detection for a string? [on
hold]

I am talking about such a string like of 1000000 characters (its length up
to 1000000), also hardly keeping in mind the time and memory limits which
makes also the o(n) algorithms have not good result!!

Unable to connect using SQLPLUS from the client to the server. Error raised as "Could not resolve the Connect Identifier specified"

Unable to connect using SQLPLUS from the client to the server. Error
raised as "Could not resolve the Connect Identifier specified"

I have 2 different servers. Both are having the Listener and TNSNAMES
files correctly configured, and the listener.ora and tnsnames.ora files
are also similar. And for example the service names are serv_name1 and
serv_name2. And the remote login parameters are also the same as shown
below:
SQL> show parameter remote;
remote_dependencies_mode string TIMESTAMP
remote_listener string
remote_login_passwordfile string EXCLUSIVE
remote_os_authent boolean FALSE
remote_os_roles boolean FALSE
result_cache_remote_expiration integer 0
The listener also is up and running. The Tnsping on both the servers with
their respective service names are pinging. I am able to connect to both
the servers using SQL Developer. And using SQLPLUS, I am able to connect
from a client system to server1 using serv_name1, but I'm unable to
connecto to server2 using serv_name2.

How to insert data to a new table based on condtion using INTO CLAUSE?

How to insert data to a new table based on condtion using INTO CLAUSE?

I am using SQL SERVER 2012.I am new to T-SQL.
I have a table called tblEmp,where phone no of some employee is NULL.
I want to copy all these data to a new table using INTO CLAUSE , But in
the new table it should replace all the NULL phone nos with a string 'NA'
I think this can be done by CASE statement.

Friday, 13 September 2013

Setup Mule web server and REST to SOAP proxy

Setup Mule web server and REST to SOAP proxy

I'm new to Mule and am trying to setup a web server [in Mule] to "replace"
an existing Java server - which simply proxies for a SOAP web service. So:
Web client (js/html) requests a static resource
Mule Server must return the static resource
or
Web client uses Jquery Ajax (json) request with path starting with "api/"
Mule Server must forward the request to the Java server (to use the old API)
or
Web client uses Jquery Ajax request with path starting with "sapi/"
Mule Server must translate the request to XML and call the SOAP server
(for new api calls)
I'm struggling to find a good starting point:
I've played with Ajax connectors (and end-points) and can get the static
content served - but not sure where to go with the api calls (don't want
to force the client app to use mule.js)
I've played with HTTP end points, and I can't get the static content
served (implicit Content-Type issue)
Any help will be appreciated...