java.lang.NumberFormatException: For input string:
I'm trying to convert a String timestamp to an Integer one and I'm using
postgres as DB.
@Column(name = "connecte_timestamp")
private Integer timestamp;
SimpleDateFormat formater = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
Date aujourdhui = new Date();
this.timestamp = Integer.parseInt(formater.format(aujourdhui)
.replace("-", "").replace(" ", "").replace(":", ""));
the timestamp have bigint as a type in the DB. When I run my app, I get
the following stack trace :
java.lang.NumberFormatException: For input string: "01092013062024" at
java.lang.NumberFormatException.forInputString(Unknown Source) at
java.lang.Integer.parseInt(Unknown Source) at
java.lang.Integer.parseInt(Unknown Source) at
com.forum.beans.Connecte.(Connecte.java:26) at
com.forum.servlets.ListageForums.doGet(ListageForums.java:32) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
java.lang.Thread.run(Unknown Source)
Any help please ?
Saturday, 31 August 2013
implementing a "findM" in Haskell?
implementing a "findM" in Haskell?
I am looking for a function that basically is like mapM on a list -- it
performs a series of monadic actions taking every value in the list as a
parameter -- and each monadic function returns m (Maybe b). However, I
want it to stop after the first parameter that causes the function to
return a Just value, not execute any more after that, and return that
value.
Well, it'll probably be easier to just show the type signature:
findM :: (Monad m) => (a -> m (Maybe b)) -> [a] -> m (Maybe b)
where b is the first Just value. The Maybe in the result is from the
finding (in case of an empty list, etc.), and has nothing to do with the
Maybe returned by the Monadic function.
I can't seem to implement this with a straightforward application of
library functions. I could use
findM f xs = fmap (fmap fromJust . find isJust) $ mapM f xs
which will work, but I tested this and it seems that all of the monadic
actions are executed before calling find, so I can't rely on laziness
here.
ghci> findM (\x -> print x >> return (Just x)) [1,2,3]
1
2
3
-- returning IO (Just 1)
What is the best way to implement this function that won't execute the
monadic actions after the first "just" return? Something that would do:
ghci> findM (\x -> print x >> return (Just x)) [1,2,3]
1
-- returning IO (Just 1)
or even, ideally,
ghci> findM (\x -> print x >> return (Just x)) [1..]
1
-- returning IO (Just 1)
I am looking for a function that basically is like mapM on a list -- it
performs a series of monadic actions taking every value in the list as a
parameter -- and each monadic function returns m (Maybe b). However, I
want it to stop after the first parameter that causes the function to
return a Just value, not execute any more after that, and return that
value.
Well, it'll probably be easier to just show the type signature:
findM :: (Monad m) => (a -> m (Maybe b)) -> [a] -> m (Maybe b)
where b is the first Just value. The Maybe in the result is from the
finding (in case of an empty list, etc.), and has nothing to do with the
Maybe returned by the Monadic function.
I can't seem to implement this with a straightforward application of
library functions. I could use
findM f xs = fmap (fmap fromJust . find isJust) $ mapM f xs
which will work, but I tested this and it seems that all of the monadic
actions are executed before calling find, so I can't rely on laziness
here.
ghci> findM (\x -> print x >> return (Just x)) [1,2,3]
1
2
3
-- returning IO (Just 1)
What is the best way to implement this function that won't execute the
monadic actions after the first "just" return? Something that would do:
ghci> findM (\x -> print x >> return (Just x)) [1,2,3]
1
-- returning IO (Just 1)
or even, ideally,
ghci> findM (\x -> print x >> return (Just x)) [1..]
1
-- returning IO (Just 1)
AngularJS - ng-checked isn't triggering ng-change
AngularJS - ng-checked isn't triggering ng-change
Basically I have a table and each row have a text input and a checkbox,
the checkbox assign a default value to the input. The problem I'm having
is that I want to have a checkbox to check all checkboxes, and I've done
it, but it's not evaluating the expression in ngChange.
This is what I have:
1) Controller.js:
$scope.formData = {};
$scope.def_income = [];
$scope.master = false;
$scope.formData.income = [{ from:"", to:"", income:"" }]
$scope.addSal = function () {
this.formData.income.push({from:'',to:'',income:''});
};
$scope.delSal = function (index) {
if (index != 0) this.formData.income.splice(index,1);
}
$scope.masterToggle = function () {
this.master = this.master ? false : true;
}
$scope.defIncome = function (index) {
if (this.def_income[index]) this.formData.income[index].income="Default";
else this.formData.income[index].income = "";
}
2) index.html:
<a href="" ng-click="addSal()">Add</a>
<a href="" ng-model="master" ng-click="masterToggle()">Check all</a>
<table>
<thead>
<th>From</th>
<th>To</th>
<th>Income</th>
</thead>
<tbody>
<tr ng-repeat="income in formData.income">
<td><input kendo-date-picker class="form-control"
ng-model="income.from" placeholder="From" /></td>
<td><input kendo-date-picker class="form-control"
ng-model="income.to" /></td>
<td><input class="form-control" ng-model="income.income" /></td>
<td>Default income <input type="checkbox"
ng-model="def_income[$index]" ng-checked="master"
ng-change="defIncome($index)" /></td>
<td><a href="" ng-show="$index != 0"
ng-click="delSal($index)">Delete</a></td>
</tr>
</tbody>
</table>
The problem is that when masterToggle function is executed, it effectively
toggle the $scope.master value, and it's evaluated in ng-checked, the
checkboxes are checked, but the defIncome function that should be
evaluated when the checkbox value changes isn't.
Im really new to AngularJS (less than a week) so if I'm applying some bad
practices please feel free to point them out :)
Basically I have a table and each row have a text input and a checkbox,
the checkbox assign a default value to the input. The problem I'm having
is that I want to have a checkbox to check all checkboxes, and I've done
it, but it's not evaluating the expression in ngChange.
This is what I have:
1) Controller.js:
$scope.formData = {};
$scope.def_income = [];
$scope.master = false;
$scope.formData.income = [{ from:"", to:"", income:"" }]
$scope.addSal = function () {
this.formData.income.push({from:'',to:'',income:''});
};
$scope.delSal = function (index) {
if (index != 0) this.formData.income.splice(index,1);
}
$scope.masterToggle = function () {
this.master = this.master ? false : true;
}
$scope.defIncome = function (index) {
if (this.def_income[index]) this.formData.income[index].income="Default";
else this.formData.income[index].income = "";
}
2) index.html:
<a href="" ng-click="addSal()">Add</a>
<a href="" ng-model="master" ng-click="masterToggle()">Check all</a>
<table>
<thead>
<th>From</th>
<th>To</th>
<th>Income</th>
</thead>
<tbody>
<tr ng-repeat="income in formData.income">
<td><input kendo-date-picker class="form-control"
ng-model="income.from" placeholder="From" /></td>
<td><input kendo-date-picker class="form-control"
ng-model="income.to" /></td>
<td><input class="form-control" ng-model="income.income" /></td>
<td>Default income <input type="checkbox"
ng-model="def_income[$index]" ng-checked="master"
ng-change="defIncome($index)" /></td>
<td><a href="" ng-show="$index != 0"
ng-click="delSal($index)">Delete</a></td>
</tr>
</tbody>
</table>
The problem is that when masterToggle function is executed, it effectively
toggle the $scope.master value, and it's evaluated in ng-checked, the
checkboxes are checked, but the defIncome function that should be
evaluated when the checkbox value changes isn't.
Im really new to AngularJS (less than a week) so if I'm applying some bad
practices please feel free to point them out :)
Rails Model user adding player to user pinboard
Rails Model user adding player to user pinboard
I'm creating a sports application which allows users to create pinboards,
as many as they like. The users can then add say their favorite player to
a specified pinboard. So for example User: Jack, creates a new pinboard
called "My favorite defenders", He can then go and find his favorite
defenders, say Kevin Garnet, and add/pin garnet to his "My favorite
defenders" Pinboard.
I have a Users model, a Pinboards Model and a Players model. I tried the
following association but didn't work as I wanted. User has_many
:pinboards has_many :pins, through: pinboards, source: :player
Pinboard belongs_to :user belongs_to :player I know a player can't have
many pinboards and a pinboard will hold many players. How can I get the
behavior i want; User creates pinboard---user adds player to pinboard.
I'm creating a sports application which allows users to create pinboards,
as many as they like. The users can then add say their favorite player to
a specified pinboard. So for example User: Jack, creates a new pinboard
called "My favorite defenders", He can then go and find his favorite
defenders, say Kevin Garnet, and add/pin garnet to his "My favorite
defenders" Pinboard.
I have a Users model, a Pinboards Model and a Players model. I tried the
following association but didn't work as I wanted. User has_many
:pinboards has_many :pins, through: pinboards, source: :player
Pinboard belongs_to :user belongs_to :player I know a player can't have
many pinboards and a pinboard will hold many players. How can I get the
behavior i want; User creates pinboard---user adds player to pinboard.
How to target individually nested elements using CSS
How to target individually nested elements using CSS
I'm trying to target each span individually in a structure like below.
I've tried nth-child() & nth-of-type() but I've have no luck, it was only
applying the first style to all of the spans. Anyone no know how to do
this without giving each a separate IDs?
<div>
<div>
<span></span>
</div>
<div>
<span></span>
</div>
<div>
<span></span>
</div>
</div>
I'm trying to target each span individually in a structure like below.
I've tried nth-child() & nth-of-type() but I've have no luck, it was only
applying the first style to all of the spans. Anyone no know how to do
this without giving each a separate IDs?
<div>
<div>
<span></span>
</div>
<div>
<span></span>
</div>
<div>
<span></span>
</div>
</div>
Why isn't heigh:auto working for site container
Why isn't heigh:auto working for site container
I have been developing a site using absolute height values and was curious
as to why height:auto isn't working for me, can anyone shred some light on
this.
HTML Structure
<div id="site-content">
<div id="menuconatiner"></div>
<div id="review-container"></div>
</div>
CSS
#site-content{
webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
margin: 0 auto;
width: 938px;
padding-bottom:20px;
background-color:white;}
#menuconatiner{
margin:5px;
float:left;
width:190px;}
I have been developing a site using absolute height values and was curious
as to why height:auto isn't working for me, can anyone shred some light on
this.
HTML Structure
<div id="site-content">
<div id="menuconatiner"></div>
<div id="review-container"></div>
</div>
CSS
#site-content{
webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
margin: 0 auto;
width: 938px;
padding-bottom:20px;
background-color:white;}
#menuconatiner{
margin:5px;
float:left;
width:190px;}
Do i need to signup in PHPMailer to use SMTP?
Do i need to signup in PHPMailer to use SMTP?
I need to send bulk of emails. About 50 emails at a time. Do i need to
signup in PHPMailer to use SMTP?
I need to send bulk of emails. About 50 emails at a time. Do i need to
signup in PHPMailer to use SMTP?
Friday, 30 August 2013
html contact form focus returns to second text box and wont go to next one
html contact form focus returns to second text box and wont go to next one
This is the page having issues I really hope you guys can help me.
http://pensamientoscristianos.org/contacto/
<form action="http://pensamientoscristianos.org/send.php" ... method="post">
<div class="style3" style="height: 390px">
<label for="name"><br>Nombre :*</label>
<input name="name" type="text" id="name"/>
<label for="email"><br><br>E-mail:*</label>
<input name="email" type="text" id="email" />
<label for="Phone"><br> <br>Telefono:</label>
<input name="Phone" type="text" id="Phone" />
<label for="comments"><br><br> Tu mensaje:* </strong></label>
<textarea id="comments" name="comments" rows="18"
cols="90"></textarea></span><br>
<img id="captcha"
src="http://pensamientoscristianos.org/securimage/securimage_show.php"
alt="CAPTCHA Image" /><br>
<label for="captcha">Escribe los caracteres de la imagen aqui</label>
<input name="captcha_code" type="text" size="6" maxlength="40" /><br><a
href="#" onclick="document.getElementById('captcha').src =
'http://pensamientoscristianos.org/securimage/securimage_show.php?' +
Math.random(); return false">[ Trata una imagen diferente ]</a>
<INPUT TYPE="image" align="left"
SRC="http://pensamientoscristianos.org/images/enviar.jpg" ALT="Enviar!"/>
</div>
</form>
This is the page having issues I really hope you guys can help me.
http://pensamientoscristianos.org/contacto/
<form action="http://pensamientoscristianos.org/send.php" ... method="post">
<div class="style3" style="height: 390px">
<label for="name"><br>Nombre :*</label>
<input name="name" type="text" id="name"/>
<label for="email"><br><br>E-mail:*</label>
<input name="email" type="text" id="email" />
<label for="Phone"><br> <br>Telefono:</label>
<input name="Phone" type="text" id="Phone" />
<label for="comments"><br><br> Tu mensaje:* </strong></label>
<textarea id="comments" name="comments" rows="18"
cols="90"></textarea></span><br>
<img id="captcha"
src="http://pensamientoscristianos.org/securimage/securimage_show.php"
alt="CAPTCHA Image" /><br>
<label for="captcha">Escribe los caracteres de la imagen aqui</label>
<input name="captcha_code" type="text" size="6" maxlength="40" /><br><a
href="#" onclick="document.getElementById('captcha').src =
'http://pensamientoscristianos.org/securimage/securimage_show.php?' +
Math.random(); return false">[ Trata una imagen diferente ]</a>
<INPUT TYPE="image" align="left"
SRC="http://pensamientoscristianos.org/images/enviar.jpg" ALT="Enviar!"/>
</div>
</form>
Redirect htaccess rule
Redirect htaccess rule
I wish to redirect a website link onto another.
my htaccess rule up to now is
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
RewriteRule ^/the-terminal/demo/
http://example.com/wordpress/project-overview/ [R,L]
I wish to redirect the link http://example.com/wordpress/the-terminal/demo
to http://example.com/wordpress/project-overview
Kindly provide me a solution. You will be a lifesaver.
Thanks
I wish to redirect a website link onto another.
my htaccess rule up to now is
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
RewriteRule ^/the-terminal/demo/
http://example.com/wordpress/project-overview/ [R,L]
I wish to redirect the link http://example.com/wordpress/the-terminal/demo
to http://example.com/wordpress/project-overview
Kindly provide me a solution. You will be a lifesaver.
Thanks
Thursday, 29 August 2013
Domain login (windows 7) takes long time on Welcome page
Domain login (windows 7) takes long time on Welcome page
Log into the domain from Windows 7 is taking quite long time. Is there a
way to analyse how long it spends on each stage, e.g. authentication,
roaming profile downloading?
I have tried turning on boot log. It does give a long list of processes
(binaries) get called, but it does not seem to give intuitive information
in this aspect. Any suggestions? Thanks.
Log into the domain from Windows 7 is taking quite long time. Is there a
way to analyse how long it spends on each stage, e.g. authentication,
roaming profile downloading?
I have tried turning on boot log. It does give a long list of processes
(binaries) get called, but it does not seem to give intuitive information
in this aspect. Any suggestions? Thanks.
Wednesday, 28 August 2013
GruopBox & RadioButton
GruopBox & RadioButton
Could anyone explain me how the compiler knows to perform appropriate
method when we select RadioButtons in this example ?
Example of Visual C# 2012 How to Program 5th Edition fig. 14.28
Could anyone explain me how the compiler knows to perform appropriate
method when we select RadioButtons in this example ?
Example of Visual C# 2012 How to Program 5th Edition fig. 14.28
CSS :after used to make arrow for links not working for submit button
CSS :after used to make arrow for links not working for submit button
Ive used the CSS :after selector to create an arrow for my links. This
works fine but now I want to do the same thing to form inputs.
If I use the same class on the submit button then the :after is ignored,
im assuming because the element cant contain other other elements.
If I apply the class to a div containing the submit button then it looks
fine, but the arrow and padding outside of the actual submit button isnt
clickable.
Is there a solution to this?
http://jsfiddle.net/jn7Vj/5/
.button-style {
background: -moz-linear-gradient(top, #02AD85, #019975);
background: -webkit-linear-gradient(top, #02AD85, #019975);
background: linear-gradient(top, #02AD85, #019975);
padding: 0.7em;
border-radius: 0.5em;
border-bottom: 4px solid #003E30;
box-shadow: 0 2px 0px #252D42;
font-size: 15px; //findme
margin-top: 15px;
display: inline-block;
margin-top: 10px; //findme
border-top: none;
border-right: none;
border-left: none;
color: white;
font-size: 12px;
}
.button-style:after {
content: '';
display: inline-block;
width: 0px;
height: 0px;
border-style: solid;
border-width: 0.4em 0 0.4em 0.7em;
border-color: transparent transparent transparent #FFF;
margin-left: 0.75em;
}
.button-style input {
background: none;
border: none;
color: white;
font-size: 12px;
margin: 0;
padding: 0;
}
<a href="#" class="button-style">Here is a link</a>
<form class="webform-client-form" enctype="multipart/form-data"
action="/cchetwood/4/contact" method="post" id="webform-client-form-4"
accept-charset="UTF-8"><div><div class="form-item webform-component
webform-component-textfield" id="webform-component-full-name">
<input type="text" id="edit-submitted-preferred-times-to-contact-optional"
name="submitted[preferred_times_to_contact_optional]" value="" size="60"
maxlength="128" class="form-text">
<input type="submit" class="button-style" value="Submit">
<div class="button-style">
<input type="submit" value="Submit">
</div>
</form>
Ive used the CSS :after selector to create an arrow for my links. This
works fine but now I want to do the same thing to form inputs.
If I use the same class on the submit button then the :after is ignored,
im assuming because the element cant contain other other elements.
If I apply the class to a div containing the submit button then it looks
fine, but the arrow and padding outside of the actual submit button isnt
clickable.
Is there a solution to this?
http://jsfiddle.net/jn7Vj/5/
.button-style {
background: -moz-linear-gradient(top, #02AD85, #019975);
background: -webkit-linear-gradient(top, #02AD85, #019975);
background: linear-gradient(top, #02AD85, #019975);
padding: 0.7em;
border-radius: 0.5em;
border-bottom: 4px solid #003E30;
box-shadow: 0 2px 0px #252D42;
font-size: 15px; //findme
margin-top: 15px;
display: inline-block;
margin-top: 10px; //findme
border-top: none;
border-right: none;
border-left: none;
color: white;
font-size: 12px;
}
.button-style:after {
content: '';
display: inline-block;
width: 0px;
height: 0px;
border-style: solid;
border-width: 0.4em 0 0.4em 0.7em;
border-color: transparent transparent transparent #FFF;
margin-left: 0.75em;
}
.button-style input {
background: none;
border: none;
color: white;
font-size: 12px;
margin: 0;
padding: 0;
}
<a href="#" class="button-style">Here is a link</a>
<form class="webform-client-form" enctype="multipart/form-data"
action="/cchetwood/4/contact" method="post" id="webform-client-form-4"
accept-charset="UTF-8"><div><div class="form-item webform-component
webform-component-textfield" id="webform-component-full-name">
<input type="text" id="edit-submitted-preferred-times-to-contact-optional"
name="submitted[preferred_times_to_contact_optional]" value="" size="60"
maxlength="128" class="form-text">
<input type="submit" class="button-style" value="Submit">
<div class="button-style">
<input type="submit" value="Submit">
</div>
</form>
php switch statement using text box
php switch statement using text box
I am trying to use a switch statement to make it so that when that
specific word is typed into the text box it will display the available
models of that car
for example
if the user entered "Volkswagen" it should echo "The available models are
Beetle and Polo"
here is the code i have so far,
<form action="switch.php" method="post">
<input type="text" name="cars" id="cars" />
<input type="submit" />
<?php
$i = $_POST;
?>
<?php
switch ($i) {
case "Volkswagen":
echo "The available models are Beetle and Polo";
break;
case "Renault":
echo "The Available models are Megane and Clio";
break;
case "Land Rover":
echo "The Available models are Range Rover Sport and Defender";
break;
}
?>
</form>
I am trying to use a switch statement to make it so that when that
specific word is typed into the text box it will display the available
models of that car
for example
if the user entered "Volkswagen" it should echo "The available models are
Beetle and Polo"
here is the code i have so far,
<form action="switch.php" method="post">
<input type="text" name="cars" id="cars" />
<input type="submit" />
<?php
$i = $_POST;
?>
<?php
switch ($i) {
case "Volkswagen":
echo "The available models are Beetle and Polo";
break;
case "Renault":
echo "The Available models are Megane and Clio";
break;
case "Land Rover":
echo "The Available models are Range Rover Sport and Defender";
break;
}
?>
</form>
How can I update my database with current time stamp in every 5 sec
How can I update my database with current time stamp in every 5 sec
I have one database name user also having a last_seen field. I want to
update this field in every 5sec with current time stamp.
I have one database name user also having a last_seen field. I want to
update this field in every 5sec with current time stamp.
Tuesday, 27 August 2013
How does Visual Studio process the App_Code folder specially?
How does Visual Studio process the App_Code folder specially?
How does Visual Studio process the App_Code folder when a change is made
or detected in it? Not IIS or ASP.NET.
I want to gain a better understanding of why Visual Studio freezes for
long periods of time whenever I save a code file inside a large App_Code
folder of a website project and not elsewhere. Alternatively, I could ask:
why does Visual Studio not exhibit these freezes when processing a code
file inside a class library that is equally large?
Ideally I would like to see official documentation cited from Microsoft of
the issue at hand of processing the App_Code folder in Visual Studio and
what happens that differs in Visual Studio compared to e.g. class library
processing.
How does Visual Studio process the App_Code folder when a change is made
or detected in it? Not IIS or ASP.NET.
I want to gain a better understanding of why Visual Studio freezes for
long periods of time whenever I save a code file inside a large App_Code
folder of a website project and not elsewhere. Alternatively, I could ask:
why does Visual Studio not exhibit these freezes when processing a code
file inside a class library that is equally large?
Ideally I would like to see official documentation cited from Microsoft of
the issue at hand of processing the App_Code folder in Visual Studio and
what happens that differs in Visual Studio compared to e.g. class library
processing.
Linking to an ID not detected
Linking to an ID not detected
So by far I have this code in html:
<body>
<div id="header"><h1>WE VOICE</h1>
<ul>
<li><a href="#one">First</a></li>
<li><a href="#two">Second</a></li>
<li><a href="#three">Third</a></li>
<li><a href="#four">Fourth</a></li>
</ul>
</div>
<div id="content">
<div id="one" class="content first"><h3 class="h3">Content
Title</h3><p style="color:#711928">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Praesent vel sapien libero. Donec
tristique velit et placerat faucibus. Nunc nisi nibh, tincidunt
vitae tincidunt vel, euismod ac lorem. Nunc ornare bibendum augue,
a rutrum sapien euismod sed. Donec euismod lacus sed diam
convallis.</p><p style="color:#711928">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Praesent vel sapien libero. Donec
tristique velit et placerat faucibus. Nunc nisi nibh, tincidunt
vitae tincidunt vel, euismod ac lorem. Nunc ornare bibendum augue,
a rutrum sapien euismod sed. Donec euismod lacus sed diam
convallis.Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Praesent vel sapien libero. Donec tristique velit et placerat
faucibus. Nunc nisi nibh, tincidunt vitae tincidunt vel, euismod
ac lorem. Nunc ornare bibendum augue, a rutrum sapien euismod sed.
Donec euismod lacus sed diam convallis.</p></div>
<div id="two" class="content second"><h3 class="h3">Content
Title</h3><p style="color:#222222">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Praesent vel sapien libero. Donec
tristique velit et placerat faucibus. Nunc nisi nibh, tincidunt
vitae tincidunt vel, euismod ac lorem. Nunc ornare bibendum augue,
a rutrum sapien euismod sed. Donec euismod lacus sed diam
convallis, quis sollicitudin ligula vehicula. Nunc ultricies
sapien consectetur, placerat magna id, ullamcorper leo. Phasellus
aliquam ligula eget tortor tincidunt, eu sodales mi
aliquet.</p></div>
<div id="three" class="content third"><h3 class="h3">Content
Title</h3><p>Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Praesent vel sapien libero. Donec tristique velit et
placerat faucibus. Nunc nisi nibh, tincidunt vitae tincidunt vel,
euismod ac lorem. Nunc ornare bibendum augue, a rutrum sapien
euismod sed. Donec euismod lacus sed diam convallis, quis
sollicitudin ligula vehicula. Nunc ultricies sapien consectetur,
placerat magna id, ullamcorper leo. Phasellus aliquam ligula eget
tortor tincidunt, eu sodales mi aliquet. Sed fringilla iaculis
aliquam. Proin in turpis neque. Fusce sit amet nisl eu ligula
semper hendrerit. Nulla a tincidunt augue. Donec interdum interdum
ultricies. In lacinia neque et dui adipiscing, eu iaculis urna
aliquet. Nullam vestibulum leo in turpis semper bibendum. Donec
sem tortor, viverra ut pellentesque vitae, fringilla ut
metus.</p></div>
<div id="four" class="content four"><h3 class="h3">Content
Title</h3><p>Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Praesent vel sapien libero. Donec tristique velit et
placerat faucibus. Nunc nisi nibh, tincidunt vitae tincidunt vel,
euismod ac lorem. Nunc ornare bibendum augue, a rutrum sapien
euismod sed. Donec euismod lacus sed diam convallis, quis
sollicitudin ligula vehicula. Nunc ultricies sapien consectetur,
placerat magna id, ullamcorper leo. Phasellus aliquam ligula eget
tortor tincidunt, eu sodales mi aliquet. Sed fringilla iaculis
aliquam. Proin in turpis neque. Fusce sit amet nisl eu ligula
semper hendrerit. Nulla a tincidunt augue. Donec interdum interdum
ultricies. In lacinia neque et dui adipiscing, eu iaculis urna
aliquet. Nullam vestibulum leo in turpis semper bibendum. Donec
sem tortor, viverra ut pellentesque vitae, fringilla ut
metus.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Praesent vel sapien libero. Donec tristique velit et
placerat faucibus. Nunc nisi nibh, tincidunt vitae tincidunt vel,
euismod ac lorem. Nunc ornare bibendum augue, a rutrum sapien
euismod sed. Donec euismod lacus sed diam convallis, quis
sollicitudin ligula vehicula. Nunc ultricies sapien consectetur,
placerat magna id, ullamcorper leo. Phasellus aliquam ligula eget
tortor tincidunt, eu sodales mi aliquet. Sed fringilla iaculis
aliquam. Proin in turpis neque. Fusce sit amet nisl eu ligula
semper hendrerit. Nulla a tincidunt augue. Donec interdum interdum
ultricies. In lacinia neque et dui adipiscing, eu iaculis urna
aliquet. Nullam vestibulum leo in turpis semper bibendum. Donec
sem tortor, viverra ut pellentesque vitae, fringilla ut
metus.</p></div>
<div id="footer"><h2>Website designed</h2><p>by Pau Olivé
Montejo</p></div>
</div>
</body>
The problem is that in the buttons I made editing the <li> the link is not
displayed, it appears like a simple button without any link.
So by far I have this code in html:
<body>
<div id="header"><h1>WE VOICE</h1>
<ul>
<li><a href="#one">First</a></li>
<li><a href="#two">Second</a></li>
<li><a href="#three">Third</a></li>
<li><a href="#four">Fourth</a></li>
</ul>
</div>
<div id="content">
<div id="one" class="content first"><h3 class="h3">Content
Title</h3><p style="color:#711928">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Praesent vel sapien libero. Donec
tristique velit et placerat faucibus. Nunc nisi nibh, tincidunt
vitae tincidunt vel, euismod ac lorem. Nunc ornare bibendum augue,
a rutrum sapien euismod sed. Donec euismod lacus sed diam
convallis.</p><p style="color:#711928">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Praesent vel sapien libero. Donec
tristique velit et placerat faucibus. Nunc nisi nibh, tincidunt
vitae tincidunt vel, euismod ac lorem. Nunc ornare bibendum augue,
a rutrum sapien euismod sed. Donec euismod lacus sed diam
convallis.Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Praesent vel sapien libero. Donec tristique velit et placerat
faucibus. Nunc nisi nibh, tincidunt vitae tincidunt vel, euismod
ac lorem. Nunc ornare bibendum augue, a rutrum sapien euismod sed.
Donec euismod lacus sed diam convallis.</p></div>
<div id="two" class="content second"><h3 class="h3">Content
Title</h3><p style="color:#222222">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Praesent vel sapien libero. Donec
tristique velit et placerat faucibus. Nunc nisi nibh, tincidunt
vitae tincidunt vel, euismod ac lorem. Nunc ornare bibendum augue,
a rutrum sapien euismod sed. Donec euismod lacus sed diam
convallis, quis sollicitudin ligula vehicula. Nunc ultricies
sapien consectetur, placerat magna id, ullamcorper leo. Phasellus
aliquam ligula eget tortor tincidunt, eu sodales mi
aliquet.</p></div>
<div id="three" class="content third"><h3 class="h3">Content
Title</h3><p>Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Praesent vel sapien libero. Donec tristique velit et
placerat faucibus. Nunc nisi nibh, tincidunt vitae tincidunt vel,
euismod ac lorem. Nunc ornare bibendum augue, a rutrum sapien
euismod sed. Donec euismod lacus sed diam convallis, quis
sollicitudin ligula vehicula. Nunc ultricies sapien consectetur,
placerat magna id, ullamcorper leo. Phasellus aliquam ligula eget
tortor tincidunt, eu sodales mi aliquet. Sed fringilla iaculis
aliquam. Proin in turpis neque. Fusce sit amet nisl eu ligula
semper hendrerit. Nulla a tincidunt augue. Donec interdum interdum
ultricies. In lacinia neque et dui adipiscing, eu iaculis urna
aliquet. Nullam vestibulum leo in turpis semper bibendum. Donec
sem tortor, viverra ut pellentesque vitae, fringilla ut
metus.</p></div>
<div id="four" class="content four"><h3 class="h3">Content
Title</h3><p>Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Praesent vel sapien libero. Donec tristique velit et
placerat faucibus. Nunc nisi nibh, tincidunt vitae tincidunt vel,
euismod ac lorem. Nunc ornare bibendum augue, a rutrum sapien
euismod sed. Donec euismod lacus sed diam convallis, quis
sollicitudin ligula vehicula. Nunc ultricies sapien consectetur,
placerat magna id, ullamcorper leo. Phasellus aliquam ligula eget
tortor tincidunt, eu sodales mi aliquet. Sed fringilla iaculis
aliquam. Proin in turpis neque. Fusce sit amet nisl eu ligula
semper hendrerit. Nulla a tincidunt augue. Donec interdum interdum
ultricies. In lacinia neque et dui adipiscing, eu iaculis urna
aliquet. Nullam vestibulum leo in turpis semper bibendum. Donec
sem tortor, viverra ut pellentesque vitae, fringilla ut
metus.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Praesent vel sapien libero. Donec tristique velit et
placerat faucibus. Nunc nisi nibh, tincidunt vitae tincidunt vel,
euismod ac lorem. Nunc ornare bibendum augue, a rutrum sapien
euismod sed. Donec euismod lacus sed diam convallis, quis
sollicitudin ligula vehicula. Nunc ultricies sapien consectetur,
placerat magna id, ullamcorper leo. Phasellus aliquam ligula eget
tortor tincidunt, eu sodales mi aliquet. Sed fringilla iaculis
aliquam. Proin in turpis neque. Fusce sit amet nisl eu ligula
semper hendrerit. Nulla a tincidunt augue. Donec interdum interdum
ultricies. In lacinia neque et dui adipiscing, eu iaculis urna
aliquet. Nullam vestibulum leo in turpis semper bibendum. Donec
sem tortor, viverra ut pellentesque vitae, fringilla ut
metus.</p></div>
<div id="footer"><h2>Website designed</h2><p>by Pau Olivé
Montejo</p></div>
</div>
</body>
The problem is that in the buttons I made editing the <li> the link is not
displayed, it appears like a simple button without any link.
Place ads on top of Iframe
Place ads on top of Iframe
I am looking to place publisher ads on top of my videos.user can able to
close publisher ad and play video..something like nowvideo.eu
Example.
<iframe width="560" height="349"
src="http://www.youtube.com/embed/SpBVJk6AtDk" frameborder="0"
allowfullscreen></iframe>
I am looking to place publisher ads on top of my videos.user can able to
close publisher ad and play video..something like nowvideo.eu
Example.
<iframe width="560" height="349"
src="http://www.youtube.com/embed/SpBVJk6AtDk" frameborder="0"
allowfullscreen></iframe>
Why do softwares install themselves in /usr/lib?
Why do softwares install themselves in /usr/lib?
I have been using Linux servers for years now and I keep on being confused
by the Filesystem Hierarchy Standard. Usually, I can live with the
confusion. But now that I am developing my own software for Linux, I need
to understand where it is supposed to be installed by package managers.
I was pretty convinced that /opt was the perfect location for my
application. But after having investigate my Debian filesystem, I'm not
sure anymore : a lot of softwares are actually installed in /usr/lib ! To
name a few : MySQL, MySQLWorkbench, Nautilus, Rythmbox...
According to the FHS, /usr/lib is supposed to contain "Libraries for
programming and packages" and "includes object files, libraries, and
internal binaries that are not intended to be executed directly by users
or shell scripts" (See here).
A lot of softwares located in /usr/lib of my debian server are not
libraries or internal binaries but full-fledged user executable softwares
!
I'm still on track to have my application installed in /opt. But I really
would like to understand if this is correct and, above all, why.
Thanks by advance for your kind advices,
Eric.
I have been using Linux servers for years now and I keep on being confused
by the Filesystem Hierarchy Standard. Usually, I can live with the
confusion. But now that I am developing my own software for Linux, I need
to understand where it is supposed to be installed by package managers.
I was pretty convinced that /opt was the perfect location for my
application. But after having investigate my Debian filesystem, I'm not
sure anymore : a lot of softwares are actually installed in /usr/lib ! To
name a few : MySQL, MySQLWorkbench, Nautilus, Rythmbox...
According to the FHS, /usr/lib is supposed to contain "Libraries for
programming and packages" and "includes object files, libraries, and
internal binaries that are not intended to be executed directly by users
or shell scripts" (See here).
A lot of softwares located in /usr/lib of my debian server are not
libraries or internal binaries but full-fledged user executable softwares
!
I'm still on track to have my application installed in /opt. But I really
would like to understand if this is correct and, above all, why.
Thanks by advance for your kind advices,
Eric.
How can I detect if a USB device is connect to my android phone by pressing a button?
How can I detect if a USB device is connect to my android phone by
pressing a button?
I am writing an app on my android phone (Samsung s3) to communicate with a
device. The device connects to my phone via usb. I have a button on the
app that sends data from my phone to the device. If the cable is connected
the button works. However if the device is not connected to my phone, the
app crashes. I want to test if a usb device is connected to my phone
before I sending the command to the device. Please how do I do this?
pressing a button?
I am writing an app on my android phone (Samsung s3) to communicate with a
device. The device connects to my phone via usb. I have a button on the
app that sends data from my phone to the device. If the cable is connected
the button works. However if the device is not connected to my phone, the
app crashes. I want to test if a usb device is connected to my phone
before I sending the command to the device. Please how do I do this?
Ubuntu 12.04 with Linux 3.5.0-39-generic has issues booting
Ubuntu 12.04 with Linux 3.5.0-39-generic has issues booting
I've been trying to get this working for days now and none of the posts
I've found on this site (or any other) have been able to help me fix this,
so sorry if this is a repost. I'm currently trying to dual-boot Windows 7
and Ubuntu on a desktop with a Gigabyte Z87N motherboard and an NVIDIA
GTX760 video card. When I try to boot Ubuntu "normally" (not in recovery
mode) I'm left with a blank screen with a blinking underscore. If I try to
run in recovery mode, then I get a lot of text output and then this:
[ 4.429609] [drm:drm_pci_agp_init] *ERROR* Cannot initialize the
agpgart module.
[ 4.429667] DRM:Fill_in_dev failed.
The system always comes to a complete halt (and again a blinking
underscore at the bottom of the screen) after those two lines print.
Sometimes, more lines print after that, but they always vary and dont seem
to be part of the problem (they seem to just be normal messages about
other drivers loading).
I followed these instructions to install my nvidia drivers.
but that didn't work (obviously). Pleeaaase help me. I know that the two
error messages above have been addressed before, but I haven't found any
fixes that work.
I've tried to boot with the "nomodeset" option but that doesn't seem to
change anything. I've also tried to boot with "text nomodeset" and gotten
the same results.
I forgot to mention that this all happens when I use the HDMI port on my
graphics card. If I use the HDMI port on my motherboard, Ubuntu boots just
fine. Another interesting thing I noted is that I don't see the
motherboard logo or the grub menu (where I choose between Ubuntu and
Windows) if I use the motherboard's HDMI. The screen just stays completely
black until I see the Ubuntu login page.
Also, I have an entry in grub called "Previous Linux versions" which lets
me boot into Linux 3.5.0-23-generic. I would boot into recovery mode here
before and it used to work, but for some reason even that doesn't work
now.
Sorry for the unorganized post...I'm not sure how to organize all this
random info that I have. Please let me know if you need any more
information, and thanks in advance if you can help me!
I've been trying to get this working for days now and none of the posts
I've found on this site (or any other) have been able to help me fix this,
so sorry if this is a repost. I'm currently trying to dual-boot Windows 7
and Ubuntu on a desktop with a Gigabyte Z87N motherboard and an NVIDIA
GTX760 video card. When I try to boot Ubuntu "normally" (not in recovery
mode) I'm left with a blank screen with a blinking underscore. If I try to
run in recovery mode, then I get a lot of text output and then this:
[ 4.429609] [drm:drm_pci_agp_init] *ERROR* Cannot initialize the
agpgart module.
[ 4.429667] DRM:Fill_in_dev failed.
The system always comes to a complete halt (and again a blinking
underscore at the bottom of the screen) after those two lines print.
Sometimes, more lines print after that, but they always vary and dont seem
to be part of the problem (they seem to just be normal messages about
other drivers loading).
I followed these instructions to install my nvidia drivers.
but that didn't work (obviously). Pleeaaase help me. I know that the two
error messages above have been addressed before, but I haven't found any
fixes that work.
I've tried to boot with the "nomodeset" option but that doesn't seem to
change anything. I've also tried to boot with "text nomodeset" and gotten
the same results.
I forgot to mention that this all happens when I use the HDMI port on my
graphics card. If I use the HDMI port on my motherboard, Ubuntu boots just
fine. Another interesting thing I noted is that I don't see the
motherboard logo or the grub menu (where I choose between Ubuntu and
Windows) if I use the motherboard's HDMI. The screen just stays completely
black until I see the Ubuntu login page.
Also, I have an entry in grub called "Previous Linux versions" which lets
me boot into Linux 3.5.0-23-generic. I would boot into recovery mode here
before and it used to work, but for some reason even that doesn't work
now.
Sorry for the unorganized post...I'm not sure how to organize all this
random info that I have. Please let me know if you need any more
information, and thanks in advance if you can help me!
Why do large organisations still not sign various EXEs?
Why do large organisations still not sign various EXEs?
We run a controlled Windows 7 environment and have several applications
that are digitally signed by the publisher that run under user context
fine. However, even now we still get vendors large and small providing us
with non signed exe which we have to create "hash rules" in AppLocker that
need updating every time the software is updating.
In some cases we get an application from a vendor that has a mixture of
both signed and unsigned executables. This infuriates me!
I was just wondering, why would these companies not simply sign all their
software? Is it just sloppy development or is there a genuine reason such
as a cost per exe signed?
We run a controlled Windows 7 environment and have several applications
that are digitally signed by the publisher that run under user context
fine. However, even now we still get vendors large and small providing us
with non signed exe which we have to create "hash rules" in AppLocker that
need updating every time the software is updating.
In some cases we get an application from a vendor that has a mixture of
both signed and unsigned executables. This infuriates me!
I was just wondering, why would these companies not simply sign all their
software? Is it just sloppy development or is there a genuine reason such
as a cost per exe signed?
Monday, 26 August 2013
ASP.Net MVC verses WebAPI loading of initial Angular model
ASP.Net MVC verses WebAPI loading of initial Angular model
I have finished a few MVC partial views which load their data using calls
to a webapi Get method, to preload the data used by the angular
controller.
This method works but it feels more logical to do this via the initial
asp.net-MVC Partial view load via @Model for example. Rather than waiting
for the page to load and angular to call the get method of my webservice i
could have prepopulated the Model, but im not sure how this would pass the
data to Angular using this method.
I have finished a few MVC partial views which load their data using calls
to a webapi Get method, to preload the data used by the angular
controller.
This method works but it feels more logical to do this via the initial
asp.net-MVC Partial view load via @Model for example. Rather than waiting
for the page to load and angular to call the get method of my webservice i
could have prepopulated the Model, but im not sure how this would pass the
data to Angular using this method.
My WNA3100 disk drive won't work
My WNA3100 disk drive won't work
I have tried anything will you please help me. I have tried sudo apt-get
etc but it still won't work
I have tried anything will you please help me. I have tried sudo apt-get
etc but it still won't work
Logitech Cordless Optical Track Man not working
Logitech Cordless Optical Track Man not working
I've just brought out of the cupboard a Logitech Cordless Optical Track
Man. It's not been used since I was using 10.04. I'm now using 12.04. It
doesn't work at all now. lsusb shows: Bus 002 Device 011: ID 046d:c508
Logitech, Inc. Cordless Trackball dmesg|grep Logitech shows:
[27065.831759] usb 2-1.6.7.2: Manufacturer: Logitech [27065.836101] input:
Logitech USB Receiver as
/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.7/2-1.6.7.2/2-1.6.7.2:1.0/input/input12
[27065.836354] hid-generic 0003:046D:C508.0004: input,hidraw3: USB HID
v1.10 Mouse [Logitech USB Receiver] on usb-0000:00:1d.0-1.6.7.2/input0
tail -f /var/log/Xorg.0.log shows: [ 27106.064] (II) evdev: Logitech USB
Receiver: Adding scrollwheel support [ 27106.064] () evdev: Logitech USB
Receiver: YAxisMapping: buttons 4 and 5 [ 27106.064] () evdev: Logitech
USB Receiver: EmulateWheelButton: 4, EmulateWheelInertia: 10,
EmulateWheelTimeout: 200 [ 27106.064] () Option "config_info"
"udev:/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.7/2-1.6.7.2/2-1.6.7.2:1.0/input/input12/event12"
[ 27106.064] (II) XINPUT: Adding extended input device "Logitech USB
Receiver" (type: MOUSE, id 13) [ 27106.064] (II) evdev: Logitech USB
Receiver: initialized for relative axes. [ 27106.064] () Logitech USB
Receiver: (accel) keeping acceleration scheme 1 [ 27106.064] () Logitech
USB Receiver: (accel) acceleration profile 0 [ 27106.064] () Logitech USB
Receiver: (accel) acceleration factor: 2.000 [ 27106.064] (**) Logitech
USB Receiver: (accel) acceleration threshold: 4
Any ideas?
I've just brought out of the cupboard a Logitech Cordless Optical Track
Man. It's not been used since I was using 10.04. I'm now using 12.04. It
doesn't work at all now. lsusb shows: Bus 002 Device 011: ID 046d:c508
Logitech, Inc. Cordless Trackball dmesg|grep Logitech shows:
[27065.831759] usb 2-1.6.7.2: Manufacturer: Logitech [27065.836101] input:
Logitech USB Receiver as
/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.7/2-1.6.7.2/2-1.6.7.2:1.0/input/input12
[27065.836354] hid-generic 0003:046D:C508.0004: input,hidraw3: USB HID
v1.10 Mouse [Logitech USB Receiver] on usb-0000:00:1d.0-1.6.7.2/input0
tail -f /var/log/Xorg.0.log shows: [ 27106.064] (II) evdev: Logitech USB
Receiver: Adding scrollwheel support [ 27106.064] () evdev: Logitech USB
Receiver: YAxisMapping: buttons 4 and 5 [ 27106.064] () evdev: Logitech
USB Receiver: EmulateWheelButton: 4, EmulateWheelInertia: 10,
EmulateWheelTimeout: 200 [ 27106.064] () Option "config_info"
"udev:/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.7/2-1.6.7.2/2-1.6.7.2:1.0/input/input12/event12"
[ 27106.064] (II) XINPUT: Adding extended input device "Logitech USB
Receiver" (type: MOUSE, id 13) [ 27106.064] (II) evdev: Logitech USB
Receiver: initialized for relative axes. [ 27106.064] () Logitech USB
Receiver: (accel) keeping acceleration scheme 1 [ 27106.064] () Logitech
USB Receiver: (accel) acceleration profile 0 [ 27106.064] () Logitech USB
Receiver: (accel) acceleration factor: 2.000 [ 27106.064] (**) Logitech
USB Receiver: (accel) acceleration threshold: 4
Any ideas?
Add meta tag to search results
Add meta tag to search results
In the search results I use author_name=something in the url to restrict
the results. The Problem is that domain.com/?s=searchterm and
domain.com/?s=searchterm&author_name=something have the same meta tags.
How can I add the author_name value to the meta tags?
In the search results I use author_name=something in the url to restrict
the results. The Problem is that domain.com/?s=searchterm and
domain.com/?s=searchterm&author_name=something have the same meta tags.
How can I add the author_name value to the meta tags?
Convert string to Unicode hex representation and back in C++
Convert string to Unicode hex representation and back in C++
I want to convert a string into a string which contains all characters of
the given string in their Unicode hex notation and back again. Target
language is C/C++.
For example, given the German word Hände, I want to be able to convert
this string into it's Unicode hex notation U+0068 U+00E4 U+006E U+0064
U+0065, and from it back to its original representation Hände.
How can this be accomplished?
Thank you!
I want to convert a string into a string which contains all characters of
the given string in their Unicode hex notation and back again. Target
language is C/C++.
For example, given the German word Hände, I want to be able to convert
this string into it's Unicode hex notation U+0068 U+00E4 U+006E U+0064
U+0065, and from it back to its original representation Hände.
How can this be accomplished?
Thank you!
Port forwarding does not work with ubuntu server 13.04
Port forwarding does not work with ubuntu server 13.04
I'm trying to run nodejs app in my ubuntu server, that is running behind
TP-Link router. Server is set up as DMZ host in this router, so, router
should forward all connection to any port to this server. There is apache
and ssh running and forwarding works fine. But no way to reach port 4000
for example. I'm using 0.0.0.0:4000 to create server, so I can reach it
via local network (as a 192.168.1.100:4000), but not from the internet.
There is a difference between ports 80, 22 and 4000 in netstat output,
that I don't understand:
tcp6 0 0 :::80 :::* LISTEN
17175/apache2
tcp6 0 0 :::22 :::* LISTEN
9476/sshd
.........
tcp 0 0 0.0.0.0:4000 0.0.0.0:* LISTEN
17196/node
It's only difference, that I found. Any suggestion why can't I use port
4000? Ubuntu server is just fresh installed, there was ubuntu desktop
before and were working well.
I'm trying to run nodejs app in my ubuntu server, that is running behind
TP-Link router. Server is set up as DMZ host in this router, so, router
should forward all connection to any port to this server. There is apache
and ssh running and forwarding works fine. But no way to reach port 4000
for example. I'm using 0.0.0.0:4000 to create server, so I can reach it
via local network (as a 192.168.1.100:4000), but not from the internet.
There is a difference between ports 80, 22 and 4000 in netstat output,
that I don't understand:
tcp6 0 0 :::80 :::* LISTEN
17175/apache2
tcp6 0 0 :::22 :::* LISTEN
9476/sshd
.........
tcp 0 0 0.0.0.0:4000 0.0.0.0:* LISTEN
17196/node
It's only difference, that I found. Any suggestion why can't I use port
4000? Ubuntu server is just fresh installed, there was ubuntu desktop
before and were working well.
jquery : add option value in array object
jquery : add option value in array object
i using jquery datatables , i have 2x table with aoColumns option and 1x
without aoColumns
so i want do the following
if(aoColumns != false)
add option in array
i tried that but it didnt work
function
Data_Table_Function(file,Language,ServerParams,Row_Call_Back,pagation,columns_sort,aoColumnDefs){
var Options_Data_Table = {};
Options_Data_Table = {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": file,
"sPaginationType": "full_numbers",
"bPaginate": true,
"oLanguage": Language,
"iDisplayLength": 25,
"aLengthMenu": [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "Çáßá"]
],
"fnServerParams": ServerParams,
"aaSorting": [[ 0, "desc" ]],
"fnRowCallback": Row_Call_Back,
"fnDrawCallback": pagation,
"bInfo": false,
"aoColumnDefs":aoColumnDefs
};
if(columns_sort)
Options_Data_Table.push("aoColumns" : columns_sort);
return Options_Data_Table;
}
i using jquery datatables , i have 2x table with aoColumns option and 1x
without aoColumns
so i want do the following
if(aoColumns != false)
add option in array
i tried that but it didnt work
function
Data_Table_Function(file,Language,ServerParams,Row_Call_Back,pagation,columns_sort,aoColumnDefs){
var Options_Data_Table = {};
Options_Data_Table = {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": file,
"sPaginationType": "full_numbers",
"bPaginate": true,
"oLanguage": Language,
"iDisplayLength": 25,
"aLengthMenu": [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "Çáßá"]
],
"fnServerParams": ServerParams,
"aaSorting": [[ 0, "desc" ]],
"fnRowCallback": Row_Call_Back,
"fnDrawCallback": pagation,
"bInfo": false,
"aoColumnDefs":aoColumnDefs
};
if(columns_sort)
Options_Data_Table.push("aoColumns" : columns_sort);
return Options_Data_Table;
}
Sunday, 25 August 2013
How to scroll up one line in terminal?
How to scroll up one line in terminal?
When I enter several lines command and the cursor is at the end of the
last line. But I if I want to edit the last line command, how can I do it.
For now I can only type © several times till I reach the beginning of the
line and then move to the line above.
The command is like this:
➜ src git:(master) ./configure --with-features=huge \
> --enable-rubyinterp \
> --enable-pythoninterp \
> --enable-perlinterp \
> --enable-cscope
When I enter several lines command and the cursor is at the end of the
last line. But I if I want to edit the last line command, how can I do it.
For now I can only type © several times till I reach the beginning of the
line and then move to the line above.
The command is like this:
➜ src git:(master) ./configure --with-features=huge \
> --enable-rubyinterp \
> --enable-pythoninterp \
> --enable-perlinterp \
> --enable-cscope
Error message in Words With Friends is preventing download? - "You already own this item."
Error message in Words With Friends is preventing download? - "You already
own this item."
My phone broke and I am trying to get Word With Friends working again...
The addons that I purchased are of course not on new phone.
What ways can I get them again? (I still have the Google Play purchase
emails)
I tried to purchase the Ultimate Play Pack again and it say I already have
it, It may be related to WWF was moved to my data originally. how can I
rebuy or just download my already purchased pack?
I am trying to setup my replaced phone back up for Words With Friends as
it was before. I am getting this error "You already own this item." when
trying to re-purchase the Ultimate Play Pack.
How do I get past this and/or re-purchase ultimate pack and other items?
I have a few apps that I want back on my phone will I have to re-purchase
them or is there a way get re-installed with or without repurchasing?
Thank you, ~ Lee
own this item."
My phone broke and I am trying to get Word With Friends working again...
The addons that I purchased are of course not on new phone.
What ways can I get them again? (I still have the Google Play purchase
emails)
I tried to purchase the Ultimate Play Pack again and it say I already have
it, It may be related to WWF was moved to my data originally. how can I
rebuy or just download my already purchased pack?
I am trying to setup my replaced phone back up for Words With Friends as
it was before. I am getting this error "You already own this item." when
trying to re-purchase the Ultimate Play Pack.
How do I get past this and/or re-purchase ultimate pack and other items?
I have a few apps that I want back on my phone will I have to re-purchase
them or is there a way get re-installed with or without repurchasing?
Thank you, ~ Lee
Table Of Vector's Means By Two Factors
Table Of Vector's Means By Two Factors
I am learning R, and I promise you I have searched high and low for an
answer to this. It is so simple, but for some reason I cannot figure it
out for the life of me!
I have a dataframe containing one numeric vector and two factors:
team.weight <- c(150,160,120,100) # player's weight
team.jersey <- factor(c("blue", "green", "blue", "blue")) # player's
jersey color
team.sex <- factor(c("male", "female", "female", "male")) # player's sex
team <- data.frame(team.jersey, team.sex, team.weight)
I want to display a table (I forget what it is called) that shows the
average weight of all players, that is, mean(team.weight), for each
combination of levels for the two factor tables.
I can do this manually, but there has to be a better way!
mean(team.weight[c(team.jersey[1],team.sex[1])])
mean(team.weight[c(team.jersey[1],team.sex[2])])
mean(team.weight[c(team.jersey[1],team.sex[3])])
mean(team.weight[c(team.jersey[1],team.sex[4])])
mean(team.weight[c(team.jersey[2],team.sex[1])])
mean(team.weight[c(team.jersey[2],team.sex[2])])
mean(team.weight[c(team.jersey[2],team.sex[3])])
mean(team.weight[c(team.jersey[2],team.sex[4])])
mean(team.weight[c(team.jersey[3],team.sex[1])])
mean(team.weight[c(team.jersey[3],team.sex[2])])
mean(team.weight[c(team.jersey[3],team.sex[3])])
mean(team.weight[c(team.jersey[3],team.sex[4])])
mean(team.weight[c(team.jersey[4],team.sex[1])])
mean(team.weight[c(team.jersey[4],team.sex[2])])
mean(team.weight[c(team.jersey[4],team.sex[3])])
mean(team.weight[c(team.jersey[4],team.sex[4])])
Any help would be greatly appreciated. I know the answer is dumb, but I
cannot understand what it is.
I am learning R, and I promise you I have searched high and low for an
answer to this. It is so simple, but for some reason I cannot figure it
out for the life of me!
I have a dataframe containing one numeric vector and two factors:
team.weight <- c(150,160,120,100) # player's weight
team.jersey <- factor(c("blue", "green", "blue", "blue")) # player's
jersey color
team.sex <- factor(c("male", "female", "female", "male")) # player's sex
team <- data.frame(team.jersey, team.sex, team.weight)
I want to display a table (I forget what it is called) that shows the
average weight of all players, that is, mean(team.weight), for each
combination of levels for the two factor tables.
I can do this manually, but there has to be a better way!
mean(team.weight[c(team.jersey[1],team.sex[1])])
mean(team.weight[c(team.jersey[1],team.sex[2])])
mean(team.weight[c(team.jersey[1],team.sex[3])])
mean(team.weight[c(team.jersey[1],team.sex[4])])
mean(team.weight[c(team.jersey[2],team.sex[1])])
mean(team.weight[c(team.jersey[2],team.sex[2])])
mean(team.weight[c(team.jersey[2],team.sex[3])])
mean(team.weight[c(team.jersey[2],team.sex[4])])
mean(team.weight[c(team.jersey[3],team.sex[1])])
mean(team.weight[c(team.jersey[3],team.sex[2])])
mean(team.weight[c(team.jersey[3],team.sex[3])])
mean(team.weight[c(team.jersey[3],team.sex[4])])
mean(team.weight[c(team.jersey[4],team.sex[1])])
mean(team.weight[c(team.jersey[4],team.sex[2])])
mean(team.weight[c(team.jersey[4],team.sex[3])])
mean(team.weight[c(team.jersey[4],team.sex[4])])
Any help would be greatly appreciated. I know the answer is dumb, but I
cannot understand what it is.
java swing, necessary calls in main method
java swing, necessary calls in main method
When studying for an exam I stumbled upon some lines in java graphics that
aren't really clear to me. So i started to glance and check some other
programs and they were without those lines.
example:
public static void main(String[] args){
SwingUtilities.invokeLater(new Runnable(){//unknown
public void run(){ //lines
JPanel panel = new DrawingPanel();
...
}
now i know that Runnable and run have to deal with threads, but i don't
know why and how do these two lines work
When studying for an exam I stumbled upon some lines in java graphics that
aren't really clear to me. So i started to glance and check some other
programs and they were without those lines.
example:
public static void main(String[] args){
SwingUtilities.invokeLater(new Runnable(){//unknown
public void run(){ //lines
JPanel panel = new DrawingPanel();
...
}
now i know that Runnable and run have to deal with threads, but i don't
know why and how do these two lines work
Saturday, 24 August 2013
Getting the name of a variable as a string
Getting the name of a variable as a string
This thread discusses how to get the name of a function as a string in
Python: How to get the function name as string in Python?
How can I do the same for a variable? (note that Python variables do not
have the attribute __name__, at least in Python 2.7.x)
In other words, if I have a variable such as:
foo = dict()
foo['bar'] = 2
I am looking for a function/attribute, e.g. retrieve_name:
retrieve_name(foo)
that returns the string 'foo'
Since people are asking why I want to do this, here is an example. I would
like to create a DataFrame in Pandas from this list, where the column
names are given by the names of the actual dictionaries:
# List of dictionaries for my DataFrame
list_of_dicts = [n_jobs, users, queues, priorities]
This thread discusses how to get the name of a function as a string in
Python: How to get the function name as string in Python?
How can I do the same for a variable? (note that Python variables do not
have the attribute __name__, at least in Python 2.7.x)
In other words, if I have a variable such as:
foo = dict()
foo['bar'] = 2
I am looking for a function/attribute, e.g. retrieve_name:
retrieve_name(foo)
that returns the string 'foo'
Since people are asking why I want to do this, here is an example. I would
like to create a DataFrame in Pandas from this list, where the column
names are given by the names of the actual dictionaries:
# List of dictionaries for my DataFrame
list_of_dicts = [n_jobs, users, queues, priorities]
Can I get multiple booster packs from one game?
Can I get multiple booster packs from one game?
Is it possible to get multiple booster packs from the same game? I've just
got one that I sold on the market and now I can't even find the game
listed in the badges page on my profile.
Is it possible to get multiple booster packs from the same game? I've just
got one that I sold on the market and now I can't even find the game
listed in the badges page on my profile.
Select all fields where fieldone is not equal to null + Propel
Select all fields where fieldone is not equal to null + Propel
I have a question about using the propel ORM and creating a query.
I have a table "locations" with fields:
location
sublocation
postcode
street
number
Now I want to select all the locations where the location field IS NOT
equal to 'null'.
How can I do this? I've tried this but I get back all the results ...
Tried query: $locations = LocationQuery::create()->where('location' !=
null)->find();
I have a question about using the propel ORM and creating a query.
I have a table "locations" with fields:
location
sublocation
postcode
street
number
Now I want to select all the locations where the location field IS NOT
equal to 'null'.
How can I do this? I've tried this but I get back all the results ...
Tried query: $locations = LocationQuery::create()->where('location' !=
null)->find();
Mysterious "Installation Failed" and reboots
Mysterious "Installation Failed" and reboots
Non-programmer here. I've noticed recently a message popping up on my
4.1.2 Galaxy S3 running stock firmware (except I have root) build number
JZO54K.T999UVDMD5. This was happening before I rooted it and before I
installed DroidWall in an attempt to prevent any uncommanded activity.
"Installation Failed" is what it says. I've also happened to have observed
it restarting a few times when I was not touching it. I installed aLogcat
today and set it to "Events" so that hopefully I will get more
information. Any suggestions on how to learn more about what's up would be
appreciated.
Non-programmer here. I've noticed recently a message popping up on my
4.1.2 Galaxy S3 running stock firmware (except I have root) build number
JZO54K.T999UVDMD5. This was happening before I rooted it and before I
installed DroidWall in an attempt to prevent any uncommanded activity.
"Installation Failed" is what it says. I've also happened to have observed
it restarting a few times when I was not touching it. I installed aLogcat
today and set it to "Events" so that hopefully I will get more
information. Any suggestions on how to learn more about what's up would be
appreciated.
Friday, 23 August 2013
Twitter timeline/stream without mentions + Hide mentions from specific account
Twitter timeline/stream without mentions + Hide mentions from specific
account
I've been using Tweetdeck for a good week now because I have to manage 2
accounts, but I run into some problems.
Is it possible to create a timeline/column where you see all Tweets which
aren't mentions. I follow quite a lot of people which mention eachother, I
don't need those conversations in my Timeline.
Is it possible to hide Tweets which mention you from a specific account?
(Example: I mention my second account on my first account, this mention
pops up in the "Mentions column" which is undesired.)
Can't seem to solve these two!
account
I've been using Tweetdeck for a good week now because I have to manage 2
accounts, but I run into some problems.
Is it possible to create a timeline/column where you see all Tweets which
aren't mentions. I follow quite a lot of people which mention eachother, I
don't need those conversations in my Timeline.
Is it possible to hide Tweets which mention you from a specific account?
(Example: I mention my second account on my first account, this mention
pops up in the "Mentions column" which is undesired.)
Can't seem to solve these two!
Why can't wake up this thread
Why can't wake up this thread
I want to test Thread.sleep() method, and I found a interesting thing..
When I invoke main() method , the console will print "UserA sleeping..."
and "UserA waking...", that means the program is awakened , but when I use
a junit method to run the same code as main() method, it won't print
"UserA waking..." ... I will be appreciate anyone can explain it .
package com.lmh.threadlocal;
import org.junit.Test;
public class ThreadTest {
public static void main(String [] args) {
new Thread(new UserA()).start();
}
@Test
public void testWakeup(){
new Thread(new UserA()).start();
}
}
class UserA implements Runnable{
@Override
public void run() {
try {
System.out.println("UserA sleeping...");
Thread.sleep(1000);
System.out.println("UserA waking...");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
I want to test Thread.sleep() method, and I found a interesting thing..
When I invoke main() method , the console will print "UserA sleeping..."
and "UserA waking...", that means the program is awakened , but when I use
a junit method to run the same code as main() method, it won't print
"UserA waking..." ... I will be appreciate anyone can explain it .
package com.lmh.threadlocal;
import org.junit.Test;
public class ThreadTest {
public static void main(String [] args) {
new Thread(new UserA()).start();
}
@Test
public void testWakeup(){
new Thread(new UserA()).start();
}
}
class UserA implements Runnable{
@Override
public void run() {
try {
System.out.println("UserA sleeping...");
Thread.sleep(1000);
System.out.println("UserA waking...");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Functional Unit and Micro-operations Schematics
Functional Unit and Micro-operations Schematics
I'm sitting an exam on Computer Architecture in a few days and i'm stuck
on a particular type of question.
I'm asked to:
Provide a detailed schematic for a functional unti that implements the
following micro-operations
Any help would be great even just a nudge in the right direction.
I'm sitting an exam on Computer Architecture in a few days and i'm stuck
on a particular type of question.
I'm asked to:
Provide a detailed schematic for a functional unti that implements the
following micro-operations
Any help would be great even just a nudge in the right direction.
Jquery transform HTML
Jquery transform HTML
I have the following in my HTML:
<ul class="listagem1">
<li class="grd2"> <span></span>
<ul class="det_imovel">
<ul>
<li><strong>TIPO:</strong> Carro</li>
<li><strong>VALOR:</strong> R$10,00</li>
</ul>
<ul>
<li><strong>ANUNCIO:</strong> Vendo este automóvel</li>
</ul>
</ul>
<div></div>
</li>
</ul>
And I'd like to to change to that another code with one click. In other
words, I need to get all li contents and set it in <p>. However, I can't
make it!
<ul class="listagem1">
<li class="grd2 brd_orange">
<p> <strong>Tipo do Imóvel:</strong>
<br> <strong>Bairro:</strong>
<br> <strong>Finalidade:</strong>
<br> <strong>Anúncio:</strong>
<br> <strong>Valor:</strong>
<br> <strong>Contato:</strong>
<br>
</p>
<div class="bl_bt" style="left:13px;"> <a class="bt_gray
bg_orange_mn" style="margin-left:10px;"> <span
class="ico_detalhes"></span> Detalhes </a>
</div>
</li>
</ul>
Anyone can help me ? It's possible ?
I have the following in my HTML:
<ul class="listagem1">
<li class="grd2"> <span></span>
<ul class="det_imovel">
<ul>
<li><strong>TIPO:</strong> Carro</li>
<li><strong>VALOR:</strong> R$10,00</li>
</ul>
<ul>
<li><strong>ANUNCIO:</strong> Vendo este automóvel</li>
</ul>
</ul>
<div></div>
</li>
</ul>
And I'd like to to change to that another code with one click. In other
words, I need to get all li contents and set it in <p>. However, I can't
make it!
<ul class="listagem1">
<li class="grd2 brd_orange">
<p> <strong>Tipo do Imóvel:</strong>
<br> <strong>Bairro:</strong>
<br> <strong>Finalidade:</strong>
<br> <strong>Anúncio:</strong>
<br> <strong>Valor:</strong>
<br> <strong>Contato:</strong>
<br>
</p>
<div class="bl_bt" style="left:13px;"> <a class="bt_gray
bg_orange_mn" style="margin-left:10px;"> <span
class="ico_detalhes"></span> Detalhes </a>
</div>
</li>
</ul>
Anyone can help me ? It's possible ?
Storing date in .properties file java
Storing date in .properties file java
I am trying to store a date in my config.properties file however the
format is wrong.
try{
prop.setProperty("last_run_time",sdf.format(date));
prop.store(new FileOutputStream("config.properties"),null);
}
catch (Exception e){
e.printStackTrace();
}
The value of sdf.format(date)) is correct e.g. 2013-08-23 02:47 . Issue is
that in the properties file 2013-08-23 02\:47 gets stored. Where does the
'\' come from?
I am trying to store a date in my config.properties file however the
format is wrong.
try{
prop.setProperty("last_run_time",sdf.format(date));
prop.store(new FileOutputStream("config.properties"),null);
}
catch (Exception e){
e.printStackTrace();
}
The value of sdf.format(date)) is correct e.g. 2013-08-23 02:47 . Issue is
that in the properties file 2013-08-23 02\:47 gets stored. Where does the
'\' come from?
series of functions - find the value of x for which the series converges
series of functions - find the value of x for which the series converges
Can you help me to find out, what is the value of x (real) so the
following series converges?
the series is: (n->infinity)
(-1)^n * (log(n+x^2)) * (1/(n^(1/4))
I hope it's clear, I tried to use Leibnitz, Abel and Dirichlet but I just
don't succeed and I'm frustrated.
Can you help me to find out, what is the value of x (real) so the
following series converges?
the series is: (n->infinity)
(-1)^n * (log(n+x^2)) * (1/(n^(1/4))
I hope it's clear, I tried to use Leibnitz, Abel and Dirichlet but I just
don't succeed and I'm frustrated.
Thursday, 22 August 2013
vb.net fastest way to match two long list and get which word is not found
vb.net fastest way to match two long list and get which word is not found
i have "dictionary.txt" file in which it contains all dictionary words i
am trying to syntax highlighting in richtextbox (vb.net) of misspelled
word
is there any way to check misspelled words in richtextbox by using
dictionary.txt file
i am using for loop and checking each word but its taking too much time
Dim p As Integer = 0
For i = 0 To aryTextFile.Length - 1
aryTextFile(i) = aryTextFile(i).Replace(",", "").Replace(".", "")
If wordslistD.Contains(LCase(aryTextFile(i))) Then
Else
MisSpelledList.Add(aryTextFile(i))
End If
ProgressBar1.Value = p
p = p + 1
Next
i have "dictionary.txt" file in which it contains all dictionary words i
am trying to syntax highlighting in richtextbox (vb.net) of misspelled
word
is there any way to check misspelled words in richtextbox by using
dictionary.txt file
i am using for loop and checking each word but its taking too much time
Dim p As Integer = 0
For i = 0 To aryTextFile.Length - 1
aryTextFile(i) = aryTextFile(i).Replace(",", "").Replace(".", "")
If wordslistD.Contains(LCase(aryTextFile(i))) Then
Else
MisSpelledList.Add(aryTextFile(i))
End If
ProgressBar1.Value = p
p = p + 1
Next
What are the advantages/disadvantages of using objects as parameters to other object methods?
What are the advantages/disadvantages of using objects as parameters to
other object methods?
I'm mostly thinking of PHP here, but if you want to refer to other
languages that's fine.
An object has a method that requires data contained in another class of
object.
Should I extract that data from the other object into a variable and then
send just that data to the requesting object?
Or should I pass the entire data-containing object into the data-requiring
object, and then have the requesting object perform the data extraction
operations?
I'm asking because I'm working on a big project that I've written 100% of
the code for, and some of my early code takes string or numeric arguments,
but my later code seems to be leaning toward passing around objects. As I
bump into some old code, I'm wondering if I should convert it to object
parameters.
other object methods?
I'm mostly thinking of PHP here, but if you want to refer to other
languages that's fine.
An object has a method that requires data contained in another class of
object.
Should I extract that data from the other object into a variable and then
send just that data to the requesting object?
Or should I pass the entire data-containing object into the data-requiring
object, and then have the requesting object perform the data extraction
operations?
I'm asking because I'm working on a big project that I've written 100% of
the code for, and some of my early code takes string or numeric arguments,
but my later code seems to be leaning toward passing around objects. As I
bump into some old code, I'm wondering if I should convert it to object
parameters.
PHP regex, how can I make my regex only return one group?
PHP regex, how can I make my regex only return one group?
I have tried the non capturing group option ?:
Here is my data:
hello:"abcdefg"},"other stuff
Here is my regex:
/hello:"(.*?)"}/
Here is what it returns:
Array
(
[0] => Array
(
[0] => hello:"abcdefg"}
)
[1] => Array
(
[0] => abcdefg
)
)
I wonder, how can I make it so that [0] => abdefg and that [1] => doesnt
exist?
Is there any way to do this? I feel like it would be much cleaner and
improve my performance. I understand that regex is simply doing what I
told it to do, that is showing me the whole string that it found, and the
group inside the string. But how can I make it only return abcdefg, and
nothing more? Is this possible to do?
Thanks.
EDIT: I am using the regex on a website that says it uses perl regex. I am
not actually using the perl interpreter
EDIT Again: apparently I misread the website. It is indeed using PHP, and
it is calling it with this function: preg_match_all('/hello:"(.*?)"}/',
'hello:"abcdefg"},"other stuff', $arr, PREG_PATTERN_ORDER);
I apologize for this error, I fixed the tags.
EDIT Again 2: This is the website
http://www.solmetra.com/scripts/regex/index.php
I have tried the non capturing group option ?:
Here is my data:
hello:"abcdefg"},"other stuff
Here is my regex:
/hello:"(.*?)"}/
Here is what it returns:
Array
(
[0] => Array
(
[0] => hello:"abcdefg"}
)
[1] => Array
(
[0] => abcdefg
)
)
I wonder, how can I make it so that [0] => abdefg and that [1] => doesnt
exist?
Is there any way to do this? I feel like it would be much cleaner and
improve my performance. I understand that regex is simply doing what I
told it to do, that is showing me the whole string that it found, and the
group inside the string. But how can I make it only return abcdefg, and
nothing more? Is this possible to do?
Thanks.
EDIT: I am using the regex on a website that says it uses perl regex. I am
not actually using the perl interpreter
EDIT Again: apparently I misread the website. It is indeed using PHP, and
it is calling it with this function: preg_match_all('/hello:"(.*?)"}/',
'hello:"abcdefg"},"other stuff', $arr, PREG_PATTERN_ORDER);
I apologize for this error, I fixed the tags.
EDIT Again 2: This is the website
http://www.solmetra.com/scripts/regex/index.php
hyperlinks do not work in firefox but they work on chrome?
hyperlinks do not work in firefox but they work on chrome?
the hyperlinks in my page do not work on Firefox but they do work on chrome!
I have searched google and closest I could find to my problem was someone
that added some css values to his tables but I do not have any css for my
tables!
when i click on the buttons/hyperlinks on the page, nothing happens and it
seems that the page expands as the scroll bar gets smaller!
I have removed the tables to see if this issue was created by the tables
but it happened even without the tables on the page!
here is the link jsfiddle: http://jsfiddle.net/crf121359/RZhwK/
and here is a small portion of the code for the buttons (black band at the
top) which i suspect to be the cause of the issue but I could be totally
wrong.
HOME
<div id="btns2" style=
" border-right:dashed 1px #fff; width:150px; height:42px;
vertical-align:middle; text-align:center; position:absolute; float:left;
margin-left:174px;">
<span style="position:relative; top:10px; float:left; left:35px;"><a href=
"blog.php">BLOG</a></span>
</div>
<div id="btns2" style=
" border-right:dashed 1px #fff; width:220px; height:42px;
vertical-align:middle; text-align:center; position:absolute; float:left;
margin-left:348px;">
<span style="position:relative; top:10px; float:left; left:24px;"><a href=
"time-difference.php">TIME DIFFERENCE</a></span>
</div>
any help would be great.
the hyperlinks in my page do not work on Firefox but they do work on chrome!
I have searched google and closest I could find to my problem was someone
that added some css values to his tables but I do not have any css for my
tables!
when i click on the buttons/hyperlinks on the page, nothing happens and it
seems that the page expands as the scroll bar gets smaller!
I have removed the tables to see if this issue was created by the tables
but it happened even without the tables on the page!
here is the link jsfiddle: http://jsfiddle.net/crf121359/RZhwK/
and here is a small portion of the code for the buttons (black band at the
top) which i suspect to be the cause of the issue but I could be totally
wrong.
HOME
<div id="btns2" style=
" border-right:dashed 1px #fff; width:150px; height:42px;
vertical-align:middle; text-align:center; position:absolute; float:left;
margin-left:174px;">
<span style="position:relative; top:10px; float:left; left:35px;"><a href=
"blog.php">BLOG</a></span>
</div>
<div id="btns2" style=
" border-right:dashed 1px #fff; width:220px; height:42px;
vertical-align:middle; text-align:center; position:absolute; float:left;
margin-left:348px;">
<span style="position:relative; top:10px; float:left; left:24px;"><a href=
"time-difference.php">TIME DIFFERENCE</a></span>
</div>
any help would be great.
viewpager calls the next view background code
viewpager calls the next view background code
I have a viewpager of 4 screens, where each screen calls a webservice and
displays data. Lets say I'm on the first screen - what happens is it calls
its own webservice and displays the data, and then it calls the webservice
of the next screen, so that when I scroll to the second screen it displays
the correct data, and calls the web service of the third screen.
How do I make it call the correct web service for each screen and stop?
Here is my code sample:
public class MyPagerAdapter extends PagerAdapter {
ListView ListContainer;
// ArrayList<String> grades = new ArrayList<String>();
ArrayList<String> names = new ArrayList<String>();
ViewPager myViewPager;
DBAdapter databaseAdapter;
String connectionCode;
String student_id;
int index;
// State number of pages
public int getCount() {
return 4;
}
public int getNameIndex() {
return index;
}
public void setStudentIndex(int index) {
this.index = index;
}
// Set each screen's content
@Override
public Object instantiateItem(View container, final int position) {
final Context context = container.getContext();
LinearLayout layout = new LinearLayout(context);
ListContainer = new ListView(context);
ListContainer.setId(12345);
// Add elements
ActionBar actionbar = getActionBar();
actionbar.setTitle("connection");
// myViewPager = (ViewPager) findViewById(R.id.Grades);
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
layout.setLayoutParams(p);
ListContainer.setLayoutParams(p);
switch (position) {
case 0:
actionbar.setTitle("connections list");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(
context, android.R.layout.simple_list_item_1, names);
ListContainer.setAdapter(adapter);
ListContainer.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
Name = names.get(arg2);
Cursor cursor = databaseAdapter.getStudentByName(Name);
try {
cursor.moveToFirst();
student_id = cursor.getString(cursor
.getColumnIndexOrThrow("student_id"));
StudentId = student_id;
//setStudentIndex(arg2);
index=arg2;
myViewPager.setCurrentItem(1, false);
} catch (Exception e) {
String x = e.toString();
Toast.makeText(context, e.toString(),
Toast.LENGTH_LONG).show();
}
}
});
break;
case 1:
actionbar.setTitle(Name + "'s Grades");
ArrayAdapter<String> Gradesadapter = new ArrayAdapter<String>(
context, android.R.layout.simple_list_item_1, grades);
ListContainer.setAdapter(Gradesadapter);
ListContainer.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
String month = grades.get(arg2);
if (month.equals("January"))
month = "1";
else if (month.equals("February"))
month = "2";
else if (month.equals("March"))
month = "3";
else if (month.equals("April"))
month = "4";
else if (month.equals("May"))
month = "5";
else if (month.equals("June"))
month = "6";
else if (month.equals("July"))
month = "7";
else if (month.equals("August"))
month = "8";
else if (month.equals("September"))
month = "9";
else if (month.equals("October"))
month = "10";
else if (month.equals("November"))
month = "11";
else if (month.equals("December"))
month = "12";
Intent intent = new Intent(context,
GradesListActivity.class);
intent.putExtra("month", month);
intent.putExtra("student_id", StudentId);
try {
startActivity(intent);
} catch (Exception e) {
}
}
});
break;
case 2:
actionbar.setTitle(Name + "'s messages");
try {
getThereports();
ListContainer = populateReportView(ListContainer);
} catch (Exception e) {
Toast.makeText(context, e.toString(), Toast.LENGTH_LONG)
.show();
}
ListContainer.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
Intent intent = new Intent(Home.this,
ReportActivity.class);
intent.putExtra("feedback_message", reports.get(arg2)
.getFeedback_message());
startActivity(intent);
}
});
break;
case 3:
actionbar.setTitle(Name + "'s school");
try {
schools = new ArrayList<school>();
getTheSchool();
ListContainer = populateSchoolView(ListContainer);
} catch (Exception e) {
Toast.makeText(context, e.toString(), Toast.LENGTH_LONG)
.show();
}
break;
default:break;
}
layout.addView(ListContainer);
((ViewPager) myViewPager).addView(layout, 0); // This is the line I
// added
return layout;
}
I have a viewpager of 4 screens, where each screen calls a webservice and
displays data. Lets say I'm on the first screen - what happens is it calls
its own webservice and displays the data, and then it calls the webservice
of the next screen, so that when I scroll to the second screen it displays
the correct data, and calls the web service of the third screen.
How do I make it call the correct web service for each screen and stop?
Here is my code sample:
public class MyPagerAdapter extends PagerAdapter {
ListView ListContainer;
// ArrayList<String> grades = new ArrayList<String>();
ArrayList<String> names = new ArrayList<String>();
ViewPager myViewPager;
DBAdapter databaseAdapter;
String connectionCode;
String student_id;
int index;
// State number of pages
public int getCount() {
return 4;
}
public int getNameIndex() {
return index;
}
public void setStudentIndex(int index) {
this.index = index;
}
// Set each screen's content
@Override
public Object instantiateItem(View container, final int position) {
final Context context = container.getContext();
LinearLayout layout = new LinearLayout(context);
ListContainer = new ListView(context);
ListContainer.setId(12345);
// Add elements
ActionBar actionbar = getActionBar();
actionbar.setTitle("connection");
// myViewPager = (ViewPager) findViewById(R.id.Grades);
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
layout.setLayoutParams(p);
ListContainer.setLayoutParams(p);
switch (position) {
case 0:
actionbar.setTitle("connections list");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(
context, android.R.layout.simple_list_item_1, names);
ListContainer.setAdapter(adapter);
ListContainer.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
Name = names.get(arg2);
Cursor cursor = databaseAdapter.getStudentByName(Name);
try {
cursor.moveToFirst();
student_id = cursor.getString(cursor
.getColumnIndexOrThrow("student_id"));
StudentId = student_id;
//setStudentIndex(arg2);
index=arg2;
myViewPager.setCurrentItem(1, false);
} catch (Exception e) {
String x = e.toString();
Toast.makeText(context, e.toString(),
Toast.LENGTH_LONG).show();
}
}
});
break;
case 1:
actionbar.setTitle(Name + "'s Grades");
ArrayAdapter<String> Gradesadapter = new ArrayAdapter<String>(
context, android.R.layout.simple_list_item_1, grades);
ListContainer.setAdapter(Gradesadapter);
ListContainer.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
String month = grades.get(arg2);
if (month.equals("January"))
month = "1";
else if (month.equals("February"))
month = "2";
else if (month.equals("March"))
month = "3";
else if (month.equals("April"))
month = "4";
else if (month.equals("May"))
month = "5";
else if (month.equals("June"))
month = "6";
else if (month.equals("July"))
month = "7";
else if (month.equals("August"))
month = "8";
else if (month.equals("September"))
month = "9";
else if (month.equals("October"))
month = "10";
else if (month.equals("November"))
month = "11";
else if (month.equals("December"))
month = "12";
Intent intent = new Intent(context,
GradesListActivity.class);
intent.putExtra("month", month);
intent.putExtra("student_id", StudentId);
try {
startActivity(intent);
} catch (Exception e) {
}
}
});
break;
case 2:
actionbar.setTitle(Name + "'s messages");
try {
getThereports();
ListContainer = populateReportView(ListContainer);
} catch (Exception e) {
Toast.makeText(context, e.toString(), Toast.LENGTH_LONG)
.show();
}
ListContainer.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
Intent intent = new Intent(Home.this,
ReportActivity.class);
intent.putExtra("feedback_message", reports.get(arg2)
.getFeedback_message());
startActivity(intent);
}
});
break;
case 3:
actionbar.setTitle(Name + "'s school");
try {
schools = new ArrayList<school>();
getTheSchool();
ListContainer = populateSchoolView(ListContainer);
} catch (Exception e) {
Toast.makeText(context, e.toString(), Toast.LENGTH_LONG)
.show();
}
break;
default:break;
}
layout.addView(ListContainer);
((ViewPager) myViewPager).addView(layout, 0); // This is the line I
// added
return layout;
}
Wednesday, 21 August 2013
Applescript get list of running apps?
Applescript get list of running apps?
Applescript newbie question again :) I am trying to create a small
applescript that will allow me to select multiple items from a list of
currently running applications and then quit those selected apps.
Something like this works but rather than having to click on each dialog
it would be much easier to chose from a list.
tell application "System Events"
repeat with p in every process
if background only of p is false then
display dialog "Would you like to quit " & name of p & "?" as string
end if
end repeat
end tell
Any and all help would be greatly appreciated!
Thanks!
Applescript newbie question again :) I am trying to create a small
applescript that will allow me to select multiple items from a list of
currently running applications and then quit those selected apps.
Something like this works but rather than having to click on each dialog
it would be much easier to chose from a list.
tell application "System Events"
repeat with p in every process
if background only of p is false then
display dialog "Would you like to quit " & name of p & "?" as string
end if
end repeat
end tell
Any and all help would be greatly appreciated!
Thanks!
Accessing float variable through java array
Accessing float variable through java array
I'm new to Java and i have been writing a program to exercise. Bellow is
the problematic class of the program. I'm trying to manipulate float
variables via the array, but i cant seem to affect them that way (e.g.
array[i] = 1) nor can i get their values(always 0.0), but accessing them
directly (e.g. variable = 1) works. Can anyone tell me what am I doing
wrong? Thank you.
public class Statistics {
private float switchWin, switchLose, stayWin, stayLose, gamesPlayed,
switchWinP, switchLoseP, stayWinP, stayLoseP;
private float statisticsArray[] = {switchWin, switchLose, stayWin,
stayLose, gamesPlayed, switchWinP, switchLoseP, stayWinP, stayLoseP};
public void setSwitchWin() {
switchWin++;
}
public void setSwitchLose() {
switchLose++;
}
public void setStayWin() {
stayWin++;
}
public void setStayLose() {
stayLose++;
}
public void setGamesPlayed() {
gamesPlayed++;
}
public String getSwitchWinPercentage() {
return Float.toString(switchWinP = (switchWin/gamesPlayed)*100);
}
public String getSwitchLosePercentage() {
return Float.toString(switchLoseP = (switchLose/gamesPlayed)*100);
}
public String getStayWinPercentage() {
return Float.toString(stayWinP = (stayWin/gamesPlayed)*100);
}
public String getStayLosePercentage() {
return Float.toString(stayLoseP = (stayLose/gamesPlayed)*100);
}
public String getGamesPlayed() {
return Integer.toString((int) gamesPlayed);
}
public void reset() {
for(int i=0; i<statisticsArray.length; i++) {
System.out.println(statisticsArray[i]);
statisticsArray[i]=0.0f;
System.out.println(statisticsArray[i]);
}
}
}
I'm new to Java and i have been writing a program to exercise. Bellow is
the problematic class of the program. I'm trying to manipulate float
variables via the array, but i cant seem to affect them that way (e.g.
array[i] = 1) nor can i get their values(always 0.0), but accessing them
directly (e.g. variable = 1) works. Can anyone tell me what am I doing
wrong? Thank you.
public class Statistics {
private float switchWin, switchLose, stayWin, stayLose, gamesPlayed,
switchWinP, switchLoseP, stayWinP, stayLoseP;
private float statisticsArray[] = {switchWin, switchLose, stayWin,
stayLose, gamesPlayed, switchWinP, switchLoseP, stayWinP, stayLoseP};
public void setSwitchWin() {
switchWin++;
}
public void setSwitchLose() {
switchLose++;
}
public void setStayWin() {
stayWin++;
}
public void setStayLose() {
stayLose++;
}
public void setGamesPlayed() {
gamesPlayed++;
}
public String getSwitchWinPercentage() {
return Float.toString(switchWinP = (switchWin/gamesPlayed)*100);
}
public String getSwitchLosePercentage() {
return Float.toString(switchLoseP = (switchLose/gamesPlayed)*100);
}
public String getStayWinPercentage() {
return Float.toString(stayWinP = (stayWin/gamesPlayed)*100);
}
public String getStayLosePercentage() {
return Float.toString(stayLoseP = (stayLose/gamesPlayed)*100);
}
public String getGamesPlayed() {
return Integer.toString((int) gamesPlayed);
}
public void reset() {
for(int i=0; i<statisticsArray.length; i++) {
System.out.println(statisticsArray[i]);
statisticsArray[i]=0.0f;
System.out.println(statisticsArray[i]);
}
}
}
How Fix Custom Page Curl Segue & Show Animations in ViewControllers iOS 6?
How Fix Custom Page Curl Segue & Show Animations in ViewControllers iOS 6?
Well the problem that I have now is, how can I create a custom segue, like
a modal partial curl?, but in best way like a real page curl segue?, I
will try create in a better version using, study from another tutorials
but, don't work perfectly or something I do wrong, the other tutorials are
in deprecated versions without Storyboard or not use a simple way.
So I'm using StoryBoard, XCode 4.6.2 for iOS 6, my project have 3 View
Controllers, Im using Navigation Controller, so, each view controller have
an image, with custom animation, each time when start each view
controller, run the animation in the viewDidLoad, so the partial curl I
did Try, are in two Clases, for CurlRight & CurlLeft, so when I run my
Project, the Partial or Page Curl Effect run in a different way, because
my project is in Landscape mode but how can I use the
AnimationOptionTransitionCurl in right left option in landscape? & the
other problem is when I change from View controller to another view
controller, running my application, the Animation for each view controller
not run not move, but if I push any or another button the image appear in
another position like if really moving but not showing in real time WHY?
Im using this code:
// for any ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
if (ES_IPAD())
{
}
else
{
if (ES_IPHONE_5)
{
self.imagen.frame = CGRectMake(200, imagen.frame.origin.y,
imagen.frame.size.width, imagen.frame.size.height);
}
else
{
}
}
[self mostrarAnimacion];
}
- (void) mostrarAnimacion
{
if (ES_IPAD())
{
[UIView animateWithDuration:15.0f delay:1
options:UIViewAnimationOptionRepeat animations:^{
imagen.frame = CGRectMake(1024,imagen.frame.origin.y,
imagen.frame.size.width, imagen.frame.size.height);
} completion:nil];
}
else
{
if (ES_IPHONE_5)
{
[UIView animateWithDuration:25.0f delay:1
options:UIViewAnimationOptionRepeat animations:^{
imagen.frame = CGRectMake(568,imagen.frame.origin.y,
imagen.frame.size.width, imagen.frame.size.height);
} completion:nil];
}
else
{
[UIView animateWithDuration:25.0f delay:1
options:UIViewAnimationOptionRepeat animations:^{
ViewNubes.frame = CGRectMake(480,imagen.frame.origin.y,
imagen.frame.size.width, imagen.frame.size.height);
} completion:nil];
}
}
}
For the Page Curl Effect I create two Clases:
#import "PageCurlDerecha.h"
@implementation PageCurlDerecha
-(void)perform
{
UIViewController *Fuente = (UIViewController *)self.sourceViewController;
UIViewController *Destino = (UIViewController
*)self.destinationViewController;
[UIView transitionWithView:Fuente.navigationController.view duration:2.0
options:UIViewAnimationOptionTransitionCurlUp
animations:^{[Fuente.navigationController pushViewController:Destino
animated:NO];} completion:NULL];
}
@end
the Other Class
@implementation PageCurlIzquierda
-(void)perform
{
UIViewController *Fuente = (UIViewController *)self.sourceViewController;
[UIView transitionWithView:Fuente.navigationController.view duration:2.0
options:UIViewAnimationOptionTransitionCurlDown
animations:^{[Fuente.navigationController popViewControllerAnimated:NO];}
completion:NULL];
}
@end
Any HELP?? T_T?? how can I, get a page corner in right down corner effect
like a paper page???? So please Guys how can I fix this problems? the page
curl for landscape or the animation is like if the left corner from the
paper goes to up or down, but not for right left, & for any change
viewcontrollers the animation or voids for each viewcontroller not
showing, am I Use in wrong way the segues?, or my voids from, viewdidload
or dinunload or view appear are wrong? Thanks a LOT a grettings from
Bolivia YOU ROCK guys YOU ROCK!!! XD
Well the problem that I have now is, how can I create a custom segue, like
a modal partial curl?, but in best way like a real page curl segue?, I
will try create in a better version using, study from another tutorials
but, don't work perfectly or something I do wrong, the other tutorials are
in deprecated versions without Storyboard or not use a simple way.
So I'm using StoryBoard, XCode 4.6.2 for iOS 6, my project have 3 View
Controllers, Im using Navigation Controller, so, each view controller have
an image, with custom animation, each time when start each view
controller, run the animation in the viewDidLoad, so the partial curl I
did Try, are in two Clases, for CurlRight & CurlLeft, so when I run my
Project, the Partial or Page Curl Effect run in a different way, because
my project is in Landscape mode but how can I use the
AnimationOptionTransitionCurl in right left option in landscape? & the
other problem is when I change from View controller to another view
controller, running my application, the Animation for each view controller
not run not move, but if I push any or another button the image appear in
another position like if really moving but not showing in real time WHY?
Im using this code:
// for any ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
if (ES_IPAD())
{
}
else
{
if (ES_IPHONE_5)
{
self.imagen.frame = CGRectMake(200, imagen.frame.origin.y,
imagen.frame.size.width, imagen.frame.size.height);
}
else
{
}
}
[self mostrarAnimacion];
}
- (void) mostrarAnimacion
{
if (ES_IPAD())
{
[UIView animateWithDuration:15.0f delay:1
options:UIViewAnimationOptionRepeat animations:^{
imagen.frame = CGRectMake(1024,imagen.frame.origin.y,
imagen.frame.size.width, imagen.frame.size.height);
} completion:nil];
}
else
{
if (ES_IPHONE_5)
{
[UIView animateWithDuration:25.0f delay:1
options:UIViewAnimationOptionRepeat animations:^{
imagen.frame = CGRectMake(568,imagen.frame.origin.y,
imagen.frame.size.width, imagen.frame.size.height);
} completion:nil];
}
else
{
[UIView animateWithDuration:25.0f delay:1
options:UIViewAnimationOptionRepeat animations:^{
ViewNubes.frame = CGRectMake(480,imagen.frame.origin.y,
imagen.frame.size.width, imagen.frame.size.height);
} completion:nil];
}
}
}
For the Page Curl Effect I create two Clases:
#import "PageCurlDerecha.h"
@implementation PageCurlDerecha
-(void)perform
{
UIViewController *Fuente = (UIViewController *)self.sourceViewController;
UIViewController *Destino = (UIViewController
*)self.destinationViewController;
[UIView transitionWithView:Fuente.navigationController.view duration:2.0
options:UIViewAnimationOptionTransitionCurlUp
animations:^{[Fuente.navigationController pushViewController:Destino
animated:NO];} completion:NULL];
}
@end
the Other Class
@implementation PageCurlIzquierda
-(void)perform
{
UIViewController *Fuente = (UIViewController *)self.sourceViewController;
[UIView transitionWithView:Fuente.navigationController.view duration:2.0
options:UIViewAnimationOptionTransitionCurlDown
animations:^{[Fuente.navigationController popViewControllerAnimated:NO];}
completion:NULL];
}
@end
Any HELP?? T_T?? how can I, get a page corner in right down corner effect
like a paper page???? So please Guys how can I fix this problems? the page
curl for landscape or the animation is like if the left corner from the
paper goes to up or down, but not for right left, & for any change
viewcontrollers the animation or voids for each viewcontroller not
showing, am I Use in wrong way the segues?, or my voids from, viewdidload
or dinunload or view appear are wrong? Thanks a LOT a grettings from
Bolivia YOU ROCK guys YOU ROCK!!! XD
Delete are record when no corresponding record exists in first table
Delete are record when no corresponding record exists in first table
How can I delete non matching rows from a table? I have two tables that
have a majority of related records. Table A must exist in table B. If
table B record does not exist in table A delete table B record.
I am using vb.net to proecss a series of Access database.
How can I delete non matching rows from a table? I have two tables that
have a majority of related records. Table A must exist in table B. If
table B record does not exist in table A delete table B record.
I am using vb.net to proecss a series of Access database.
javascript photo manager that supports uploading/removing photos
javascript photo manager that supports uploading/removing photos
I am looking for an existing solution of a javascript image manager with
operations like - uploading image, removing image, changing order of
images. Is there anything close to that which I could customize?
I am looking for an existing solution of a javascript image manager with
operations like - uploading image, removing image, changing order of
images. Is there anything close to that which I could customize?
Reverse geocode latitude and longitude to country name R: Incorrect ISO3 values
Reverse geocode latitude and longitude to country name R: Incorrect ISO3
values
I am currently working with a dataset with over 27,000 observations. Each
observation has a latitude and longitude value. I am currently using R,
and posted previously about this project: Converting latitude and
longitude to country in R: Error in .checkNumericCoerce2double(obj) :
non-finite coordinates
Now, I am working with the rworldmaps package, and the following code:
library(sp)
library(rworldmap)
coords2country = function(points)
{
countriesSP <- getMap(resolution='low')
#countriesSP <- getMap(resolution='high') #you could use high res map
from rworldxtra if you were concerned about detail
# new changes in worldmap means you have to use this new CRS (bogdan):
pointsSP = SpatialPoints(points, proj4string=CRS(" +proj=longlat
+ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0"))
# use 'over' to get indices of the Polygons object containing each point
indices = over(pointsSP, countriesSP)
# return the ADMIN names of each country
indices$ADMIN
indices$ISO3 #would return the ISO3 code
}
#The function below fixes the NA error
coords2country_NAsafe <- function(points)
{
bad <- with(points, is.na(lon) | is.na(lat))
result <- character(length(bad))
result[!bad] <- coords2country(points[!bad,])
result
}
When I run the following command
coords2country_NAsafe(points)
I obtain ISO3 codes for my observations. However, they are incorrect ISO3
codes. I would like to know why the functions above and the rworldmaps
package would be producing the incorrect ISO3 codes. Furthermore, I would
really appreciate any help in finding a way of obtaining the correct ones
for each observation. In order to better facilitate this, I am providing a
link to a csv file containing the data I am working with here:
https://www.dropbox.com/s/xf72iywaqm2ulsm/points.csv
values
I am currently working with a dataset with over 27,000 observations. Each
observation has a latitude and longitude value. I am currently using R,
and posted previously about this project: Converting latitude and
longitude to country in R: Error in .checkNumericCoerce2double(obj) :
non-finite coordinates
Now, I am working with the rworldmaps package, and the following code:
library(sp)
library(rworldmap)
coords2country = function(points)
{
countriesSP <- getMap(resolution='low')
#countriesSP <- getMap(resolution='high') #you could use high res map
from rworldxtra if you were concerned about detail
# new changes in worldmap means you have to use this new CRS (bogdan):
pointsSP = SpatialPoints(points, proj4string=CRS(" +proj=longlat
+ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0"))
# use 'over' to get indices of the Polygons object containing each point
indices = over(pointsSP, countriesSP)
# return the ADMIN names of each country
indices$ADMIN
indices$ISO3 #would return the ISO3 code
}
#The function below fixes the NA error
coords2country_NAsafe <- function(points)
{
bad <- with(points, is.na(lon) | is.na(lat))
result <- character(length(bad))
result[!bad] <- coords2country(points[!bad,])
result
}
When I run the following command
coords2country_NAsafe(points)
I obtain ISO3 codes for my observations. However, they are incorrect ISO3
codes. I would like to know why the functions above and the rworldmaps
package would be producing the incorrect ISO3 codes. Furthermore, I would
really appreciate any help in finding a way of obtaining the correct ones
for each observation. In order to better facilitate this, I am providing a
link to a csv file containing the data I am working with here:
https://www.dropbox.com/s/xf72iywaqm2ulsm/points.csv
ObservableCollection and DisplayMemberBinding
ObservableCollection and DisplayMemberBinding
I'm trying to fill ListBox by ObservableCollection. But when i add new
item nothing displayed, only empty item adding. There are fragments of my
code: XAML
<ListView ItemsSource="{Binding Points}" SelectedItem="{Binding Point}">
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn Header ="X" Width="100" DisplayMemberBinding = "{Binding
Path=ValueX, Mode=TwoWay}" />
<GridViewColumn Header ="Y" Width="100" DisplayMemberBinding = "{Binding
Path=ValueY, Mode=TwoWay}"/>
</GridView>
</ListView.View>
</ListView>
Window class
var value = new Value();
var viewModel = new ViewModel(value);
DataContext = viewModel;
InitializeComponent();
Value class
private const Point POINT = null;
private readonly ObservableCollection<Point> _points = new
ObservableCollection<Point>();
public Value() {
Point = POINT;
Points = _points;
}
public Point Point { get; set; }
public ObservableCollection<Point> Points { get; private set; }
ViewModel class
private readonly Value _value;
public ViewModel(Value value) {
_value = value;
}
public Point Point {
get { return _value.Point; }
set {
_value.Point = value;
OnPropertyChanged("Point");
}
}
public ObservableCollection<Point> Points {
get { return _value.Points; }
}
private RelayCommand _addCommand;
public ICommand AddCommand {
get {
if (_addCommand == null) {
_addCommand = new RelayCommand(Add);
}
return _addCommand;
}
}
private void Add(object obj) {
Points.Add(new Point(ValueX, ValueY));
ValueX = 0;
ValueY = 0;
}
and Point class
public class Point {
public readonly double ValueX;
public readonly double ValueY;
public Point(double valueX, double valueY) {
ValueX = valueX;
ValueY = valueY;
}
public override string ToString() {
return (ValueX + " " + ValueY);
}
}
When i try to add new item, new item is added but nothing is displayed.
What reason can be here?
I'm trying to fill ListBox by ObservableCollection. But when i add new
item nothing displayed, only empty item adding. There are fragments of my
code: XAML
<ListView ItemsSource="{Binding Points}" SelectedItem="{Binding Point}">
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn Header ="X" Width="100" DisplayMemberBinding = "{Binding
Path=ValueX, Mode=TwoWay}" />
<GridViewColumn Header ="Y" Width="100" DisplayMemberBinding = "{Binding
Path=ValueY, Mode=TwoWay}"/>
</GridView>
</ListView.View>
</ListView>
Window class
var value = new Value();
var viewModel = new ViewModel(value);
DataContext = viewModel;
InitializeComponent();
Value class
private const Point POINT = null;
private readonly ObservableCollection<Point> _points = new
ObservableCollection<Point>();
public Value() {
Point = POINT;
Points = _points;
}
public Point Point { get; set; }
public ObservableCollection<Point> Points { get; private set; }
ViewModel class
private readonly Value _value;
public ViewModel(Value value) {
_value = value;
}
public Point Point {
get { return _value.Point; }
set {
_value.Point = value;
OnPropertyChanged("Point");
}
}
public ObservableCollection<Point> Points {
get { return _value.Points; }
}
private RelayCommand _addCommand;
public ICommand AddCommand {
get {
if (_addCommand == null) {
_addCommand = new RelayCommand(Add);
}
return _addCommand;
}
}
private void Add(object obj) {
Points.Add(new Point(ValueX, ValueY));
ValueX = 0;
ValueY = 0;
}
and Point class
public class Point {
public readonly double ValueX;
public readonly double ValueY;
public Point(double valueX, double valueY) {
ValueX = valueX;
ValueY = valueY;
}
public override string ToString() {
return (ValueX + " " + ValueY);
}
}
When i try to add new item, new item is added but nothing is displayed.
What reason can be here?
Tuesday, 20 August 2013
why Eclipse generate .class file if there is a syntax error in my java source file?
why Eclipse generate .class file if there is a syntax error in my java
source file?
when i am creating my project using eclipse IDE it is generating .class
file while there is a syntax error in my code ?
source file?
when i am creating my project using eclipse IDE it is generating .class
file while there is a syntax error in my code ?
Loading a user control using GetManifestResourceStream
Loading a user control using GetManifestResourceStream
I have a ASP.Net C# (.NetFramework v4.0) WebForms application, which I
compiled and contains a user control.
I want to open the user control using GetManifestResourceStream().
Let us say the DLL is MyWebApp.dll. That would make
String "/bin/MyWebApp.dll"; System.Reflection.Assembly assembly =
System.Reflection.Assembly.LoadFile(assemblyName);
I can load the file with no issues.
Let us assume the following directory structure for the project.
/Controls/MyUserControl1.ascx
There is obviously a C# file associated with that as well.
I marked the ascx file Build Action as "Embed Resource".
I then specify the following:
String resourceName = "Controls/MyUserControl1.ascx"; System.IO.Stream
oStream = assembly.GetManifestResourceStream(resourceName);
Visual Studio 2012 throws an error: "Value cannot be null.\r\nParameter
name: stream"
The actual code does not have "oStream = " but rather "return
GetManifestResourceStream...".
I know that the code should work, so I am doing something dumb, just not
sure what. The larger project is to be able to use the user control from
one assembly inside another web application. See
LoadControl(string) in different assembly?
for more information and details. The answer in that StackOverflow.com
question points to
http://www.cmswire.com/cms/tips-tricks/aspnet-reusing-web-user-controls-and-forms-000915.php
Is it possible that there is a "/", "\", "." difference somewhere, so
maybe "/Controls/MyUserControl1.ascx". I tried a few permutations, just
could not get the stream to load.
I have a ASP.Net C# (.NetFramework v4.0) WebForms application, which I
compiled and contains a user control.
I want to open the user control using GetManifestResourceStream().
Let us say the DLL is MyWebApp.dll. That would make
String "/bin/MyWebApp.dll"; System.Reflection.Assembly assembly =
System.Reflection.Assembly.LoadFile(assemblyName);
I can load the file with no issues.
Let us assume the following directory structure for the project.
/Controls/MyUserControl1.ascx
There is obviously a C# file associated with that as well.
I marked the ascx file Build Action as "Embed Resource".
I then specify the following:
String resourceName = "Controls/MyUserControl1.ascx"; System.IO.Stream
oStream = assembly.GetManifestResourceStream(resourceName);
Visual Studio 2012 throws an error: "Value cannot be null.\r\nParameter
name: stream"
The actual code does not have "oStream = " but rather "return
GetManifestResourceStream...".
I know that the code should work, so I am doing something dumb, just not
sure what. The larger project is to be able to use the user control from
one assembly inside another web application. See
LoadControl(string) in different assembly?
for more information and details. The answer in that StackOverflow.com
question points to
http://www.cmswire.com/cms/tips-tricks/aspnet-reusing-web-user-controls-and-forms-000915.php
Is it possible that there is a "/", "\", "." difference somewhere, so
maybe "/Controls/MyUserControl1.ascx". I tried a few permutations, just
could not get the stream to load.
A type of language that may exist
A type of language that may exist
Is it possible to make a language of code (i suck )
that is so short that a line of code would be:
au'xzmv'ahgosax'mns:sj'an:=
would be blahblahblah blahbksehgihnweigh ebgfinweigniesbgiesbgijewbgij
ewhfewihfnji=: awkjfhj =
it would be like a 20 gig file to store everything like that,
but is it possible?
Is it possible to make a language of code (i suck )
that is so short that a line of code would be:
au'xzmv'ahgosax'mns:sj'an:=
would be blahblahblah blahbksehgihnweigh ebgfinweigniesbgiesbgijewbgij
ewhfewihfnji=: awkjfhj =
it would be like a 20 gig file to store everything like that,
but is it possible?
UN*X : How to escape files containig special characters like -, or spaces
UN*X : How to escape files containig special characters like -, or spaces
The content of a directory:
$ ls -l
total 122639
-rw-r--r-- 1 125578080 Aug 20 17:47 - Diana Krall, Stan Getz & Oscar
Peterson.7z
drwxr-xr-x 4 4096 Aug 20 18:02 Java
I whish to use the file command in this dir, where a lot of various files
are copied
$ file *
The result I expect:
$ file *
- Diana Krall, Stan Getz & Oscar Peterson.7z: 7-zip archive data, version 0.3
java: directory
The result I get:
$ file *
file: illegal option --
file: illegal option -- D
file: illegal option -- a
file: illegal option -- a
file: illegal option --
file: illegal option -- K
file: illegal option -- a
file: illegal option -- l
file: illegal option -- l
file: illegal option -- ,
file: illegal option --
file: illegal option -- S
file: illegal option -- t
file: illegal option -- a
file: illegal option --
file: illegal option -- G
Usage: file [-bchikLNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
[-e testname] [-F separator] [-f namefile] [-m magicfiles]
file ...
file -C [-m magicfiles]
file [--help]
I may type the following specific commands but I don't want, I wish use *:
$ file -- -\ Diana\ Krall\,\ Stan\ Getz\ \&\ Oscar\ Peterson.7z
- Diana Krall, Stan Getz & Oscar Peterson.7z: 7-zip archive data, version 0.3
$ file java
java: directory
How can I escape or protect * ?
The content of a directory:
$ ls -l
total 122639
-rw-r--r-- 1 125578080 Aug 20 17:47 - Diana Krall, Stan Getz & Oscar
Peterson.7z
drwxr-xr-x 4 4096 Aug 20 18:02 Java
I whish to use the file command in this dir, where a lot of various files
are copied
$ file *
The result I expect:
$ file *
- Diana Krall, Stan Getz & Oscar Peterson.7z: 7-zip archive data, version 0.3
java: directory
The result I get:
$ file *
file: illegal option --
file: illegal option -- D
file: illegal option -- a
file: illegal option -- a
file: illegal option --
file: illegal option -- K
file: illegal option -- a
file: illegal option -- l
file: illegal option -- l
file: illegal option -- ,
file: illegal option --
file: illegal option -- S
file: illegal option -- t
file: illegal option -- a
file: illegal option --
file: illegal option -- G
Usage: file [-bchikLNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
[-e testname] [-F separator] [-f namefile] [-m magicfiles]
file ...
file -C [-m magicfiles]
file [--help]
I may type the following specific commands but I don't want, I wish use *:
$ file -- -\ Diana\ Krall\,\ Stan\ Getz\ \&\ Oscar\ Peterson.7z
- Diana Krall, Stan Getz & Oscar Peterson.7z: 7-zip archive data, version 0.3
$ file java
java: directory
How can I escape or protect * ?
How can i redirect output of C++ programme to an exe programme?
How can i redirect output of C++ programme to an exe programme?
I was just experimenting with the brute force attack using C++ and I would
like to redirect each output of the the various combinations to a password
protected winrar file. I know to generate all the possible combinations
but how can i redirect each of these combinations to the winrar file which
asks for a password? I hope the question is clear,I am a student and knows
C++ to an extend.
I was just experimenting with the brute force attack using C++ and I would
like to redirect each output of the the various combinations to a password
protected winrar file. I know to generate all the possible combinations
but how can i redirect each of these combinations to the winrar file which
asks for a password? I hope the question is clear,I am a student and knows
C++ to an extend.
MYSQL query SELECT from one table and join results with other table
MYSQL query SELECT from one table and join results with other table
Newbie here. So I apologize in advance if it's so simple to solve my
problem, but I couldn't find any solution. I have two tables MESSAGES and
USERS:
MESSAGES:
|id|user_id|message|1st number|2nd number|
USERS:
|user_id|name|
I'm trying to display a message and by user_id get username next to the
message. Is it possible to do it in just one query?
At this moment my demo query looks like that but it does not work.
SELECT *
FROM messages
WHERE 1st number BETWEEN $x AND $z
AND 2nd BETWEEN $x AND $z
LEFT JOIN users
ON users.user_id= messages.user_id
ORDER BY time DESC
Newbie here. So I apologize in advance if it's so simple to solve my
problem, but I couldn't find any solution. I have two tables MESSAGES and
USERS:
MESSAGES:
|id|user_id|message|1st number|2nd number|
USERS:
|user_id|name|
I'm trying to display a message and by user_id get username next to the
message. Is it possible to do it in just one query?
At this moment my demo query looks like that but it does not work.
SELECT *
FROM messages
WHERE 1st number BETWEEN $x AND $z
AND 2nd BETWEEN $x AND $z
LEFT JOIN users
ON users.user_id= messages.user_id
ORDER BY time DESC
How Insert two table
How Insert two table
i already write code like this:
$password = md5($password);
mysql_query("INSERT INTO `users`
(username,password,email,pnum,hintque,hintans)
VALUES('$username','$password','$email','$cnum','$hintque','$hintans')");
mysql_query("INSERT INTO `personal`
(userid,fname,lname,address,dob,country,state,city,poscode)
VALUES(LAST_INSERT_ID(),'$fname','$lname','$address','$dob','$country','$state','$city'.'$zip')");
header("location: ../register.php?feedback=Registration
Complete. You May Now Login");
but only first sql success to insert data. for the second one fail. i want
both query triggered on the same time.
i already write code like this:
$password = md5($password);
mysql_query("INSERT INTO `users`
(username,password,email,pnum,hintque,hintans)
VALUES('$username','$password','$email','$cnum','$hintque','$hintans')");
mysql_query("INSERT INTO `personal`
(userid,fname,lname,address,dob,country,state,city,poscode)
VALUES(LAST_INSERT_ID(),'$fname','$lname','$address','$dob','$country','$state','$city'.'$zip')");
header("location: ../register.php?feedback=Registration
Complete. You May Now Login");
but only first sql success to insert data. for the second one fail. i want
both query triggered on the same time.
Monday, 19 August 2013
java serialization and deserializaion
java serialization and deserializaion
I have created a simple program that serializes String input from cmd to a
.ser file.. Part of the requirement is that the program must be able to
append new input and be able to read the new input plus the old input..
But i get StreamCorruptedException if i read after the 2nd input..
here is my run on the CMD.. how do I solve this StreamCorruptedException
and Why does it happen??. codes are given below.
C:\Users\MSI\Desktop\Codes For Java>java WriteFile cc.ser
Enter text and press ^Z or ^D to end.
hah
haha
hahaha
try
^Z
C:\Users\MSI\Desktop\Codes For Java>java WriteFile cc.ser
Enter text and press ^Z or ^D to end.
asd
asd
asd
asd
asd
^Z
C:\Users\MSI\Desktop\Codes For Java>java ReadFile cc.ser
1: haha
2: haha
3: hahaha
4: hahaha
The Error is :
java.io.StreamCorruptedException: invalid type code: AC
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1375)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at ReadFile.main(ReadFile.java:23)
WriteFile.java:
import java.io.*;
public class WriteFile implements java.io.Serializable
{
public static void main(String args[])
{
try
{
File myFile = new File(args[0]);
BufferedReader br = new BufferedReader
(new InputStreamReader(System.in));
ObjectOutputStream oos = new ObjectOutputStream
(new
FileOutputStream(myFile,true));
System.out.println("Enter text and press ^Z or ^D to end.");
String str;
while ((str = br.readLine()) != null)
{
oos.writeObject(str);
}
br.close();
oos.close();
}
catch (IOException i)
{
i.printStackTrace();
}
}}
ReadFile.java:
import java.io.*;
public class ReadFile
{
public static void main(String args[])
{
try
{
int ctr = 0;
File myFile = new File(args[0]);
ObjectInputStream OIS = new ObjectInputStream
(new FileInputStream(
myFile ));
String str;
while ((str = (String)OIS.readObject()) != null)
{
System.out.println(++ctr + ": " + str);
}
OIS.close();
}
catch (EOFException ex)
{
System.out.println("\nEnd of File Reached ");
}
catch (ClassNotFoundException c)
{
System.out.println("The Error is : ");
c.printStackTrace();
}catch (IOException i)
{
System.out.println("The Error is : ");
i.printStackTrace();
}
}}
I have created a simple program that serializes String input from cmd to a
.ser file.. Part of the requirement is that the program must be able to
append new input and be able to read the new input plus the old input..
But i get StreamCorruptedException if i read after the 2nd input..
here is my run on the CMD.. how do I solve this StreamCorruptedException
and Why does it happen??. codes are given below.
C:\Users\MSI\Desktop\Codes For Java>java WriteFile cc.ser
Enter text and press ^Z or ^D to end.
hah
haha
hahaha
try
^Z
C:\Users\MSI\Desktop\Codes For Java>java WriteFile cc.ser
Enter text and press ^Z or ^D to end.
asd
asd
asd
asd
asd
^Z
C:\Users\MSI\Desktop\Codes For Java>java ReadFile cc.ser
1: haha
2: haha
3: hahaha
4: hahaha
The Error is :
java.io.StreamCorruptedException: invalid type code: AC
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1375)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at ReadFile.main(ReadFile.java:23)
WriteFile.java:
import java.io.*;
public class WriteFile implements java.io.Serializable
{
public static void main(String args[])
{
try
{
File myFile = new File(args[0]);
BufferedReader br = new BufferedReader
(new InputStreamReader(System.in));
ObjectOutputStream oos = new ObjectOutputStream
(new
FileOutputStream(myFile,true));
System.out.println("Enter text and press ^Z or ^D to end.");
String str;
while ((str = br.readLine()) != null)
{
oos.writeObject(str);
}
br.close();
oos.close();
}
catch (IOException i)
{
i.printStackTrace();
}
}}
ReadFile.java:
import java.io.*;
public class ReadFile
{
public static void main(String args[])
{
try
{
int ctr = 0;
File myFile = new File(args[0]);
ObjectInputStream OIS = new ObjectInputStream
(new FileInputStream(
myFile ));
String str;
while ((str = (String)OIS.readObject()) != null)
{
System.out.println(++ctr + ": " + str);
}
OIS.close();
}
catch (EOFException ex)
{
System.out.println("\nEnd of File Reached ");
}
catch (ClassNotFoundException c)
{
System.out.println("The Error is : ");
c.printStackTrace();
}catch (IOException i)
{
System.out.println("The Error is : ");
i.printStackTrace();
}
}}
Java: Incompatible Types (int/boolean)
Java: Incompatible Types (int/boolean)
import java.io.*;
public class AdamHmwk4{
public static void main(String [] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int counter1;
int counter2;
int counter3;
String answer = "";
System.out.println("Welcome to Adam's skip-counting program!");
System.out.println("Please input the number you would like to skip
count by.");
counter1 = Integer.parseInt(br.readLine());
System.out.println("Please input the number you would like to start
at.");
counter2 = Integer.parseInt(br.readLine());
System.out.println("Please input the number you would like to
stop at.");
counter3 = Integer.parseInt(br.readLine());
System.out.println("This is skip counting by" +
counter1 + ", starting at" + counter2 + "and ending
at" + counter3 +":");
while(counter2 = counter3){
counter2 = counter2 + counter1;
counter3 = counter2 + counter1;
}
}}
I am trying to make skip-counting program. When I compile this code, the
line "while(counter2 = counter3){" shows up as a Incompatible Types error.
The compiler says it found an "int" but it requires a "boolean". Please
keep in mind that I am a newbie, so I have not learned booleans in my Java
class yet.
import java.io.*;
public class AdamHmwk4{
public static void main(String [] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int counter1;
int counter2;
int counter3;
String answer = "";
System.out.println("Welcome to Adam's skip-counting program!");
System.out.println("Please input the number you would like to skip
count by.");
counter1 = Integer.parseInt(br.readLine());
System.out.println("Please input the number you would like to start
at.");
counter2 = Integer.parseInt(br.readLine());
System.out.println("Please input the number you would like to
stop at.");
counter3 = Integer.parseInt(br.readLine());
System.out.println("This is skip counting by" +
counter1 + ", starting at" + counter2 + "and ending
at" + counter3 +":");
while(counter2 = counter3){
counter2 = counter2 + counter1;
counter3 = counter2 + counter1;
}
}}
I am trying to make skip-counting program. When I compile this code, the
line "while(counter2 = counter3){" shows up as a Incompatible Types error.
The compiler says it found an "int" but it requires a "boolean". Please
keep in mind that I am a newbie, so I have not learned booleans in my Java
class yet.
Android Application - Searchable Spinner
Android Application - Searchable Spinner
Hi I have a Spinner with 934 Items in it and it's too long, to make it
worse it's also just become a multiple select by order of "him that must
be obeyed". I was going to have it manually populate a uneditable
read-only "ListView" below whenever something was picked, but that still
doesn't make it search the spinner.
what I had in my minds eye was something like this
++++++++++++++++++++++++++++++++
+ search text [v]+
++++++++++++++++++++++++++++++++
+ Filtered Choice 1 | |+
+ Filtered Choice 2 | |+
+ Filtered Choice 3 |I|+
++++++++++++++++++++++++++++++++
+ Picked Choice a [delete] +
+ Picked Choice b [delete] +
++++++++++++++++++++++++++++++++
if this is aiming way too high for SO I understand but I was wondering if
there was any projects or tutorials covering this notion? Thanks for any
help.
Hi I have a Spinner with 934 Items in it and it's too long, to make it
worse it's also just become a multiple select by order of "him that must
be obeyed". I was going to have it manually populate a uneditable
read-only "ListView" below whenever something was picked, but that still
doesn't make it search the spinner.
what I had in my minds eye was something like this
++++++++++++++++++++++++++++++++
+ search text [v]+
++++++++++++++++++++++++++++++++
+ Filtered Choice 1 | |+
+ Filtered Choice 2 | |+
+ Filtered Choice 3 |I|+
++++++++++++++++++++++++++++++++
+ Picked Choice a [delete] +
+ Picked Choice b [delete] +
++++++++++++++++++++++++++++++++
if this is aiming way too high for SO I understand but I was wondering if
there was any projects or tutorials covering this notion? Thanks for any
help.
Inaccessible module error in TypeScript declaration file
Inaccessible module error in TypeScript declaration file
C:/Node/Typescript Experiment/node_modules/.bin/tsc.cmd" --sourcemap
mongoose.d.ts --module commonjs
C:/Node/Typescript Experiment/d.ts/mongoose.d.ts(96,35): error TS2049:
Parameter 'res' of exported function is using inaccessible module
C:/Node/Typescript Experiment/d.ts/mongoose.d.ts(97,54): error TS2049:
Parameter 'res' of exported function is using inaccessible module
This is the error, I've included the source code for this as well,
///<reference path='DefinitelyTyped/node/node.d.ts' />
export = M;
declare module M {
export interface Mongoose {
constructor();
set (key: string, value: string): Mongoose;
get (key: string): string;
createConnection(uri?: string, options?: any): Connection;
connect(any): Mongoose;
disconnect(fn: (err?: any) => void ): Mongoose;
model(name: string, schema?: Schema, collection?: string,
skipInit?: boolean): Model;
modelNames(): string[];
plugin(fn: (any) => any, opts?: any): Mongoose;
mongo: any;
version: string;
connection: Connection;
}
export function set(key: string, value: string): Mongoose;
export function get(key: string): string;
export function createConnection(uri ? : string, options?: any):
Connection;
export function connect(any): Mongoose;
export function disconnect(fn: (err?: any) => void ): Mongoose;
export function model(name: string, schema?: Schema, collection?:
string, skipInit?: boolean): Model;
export function modelNames(): string[];
export function plugin(fn: (any) => any, opts?: any): Mongoose;
export var mongo: any;
export var version: string;
export var connection: Connection;
export class Collection {
name: string;
}
export class Connection implements EventEmitter {
constructor(base: Mongoose);
addListener(event: string, listener: Function);
on(event: string, listener: Function);
once(event: string, listener: Function): void;
removeListener(event: string, listener: Function): void;
removeAllListeners(event?: string): void;
setMaxListeners(n: number): void;
listeners(event: string): { Function; }[];
emit(event: string, ...args: any[]): void;
open(connection_string: string,
database?: string,
port?: number,
options?: any,
callback?: (any) => any): Connection;
openSet(uris: string,
database?: string,
options?: any,
callback?: (any) => any): Connection;
close(callback?: (any) => any): Connection;
collection(name: string, options?: any): Collection;
model(name: string, schema?: Schema, collection?: string): Model;
modelNames(): string[];
setProfiling(level: number, ms: number, callback: (any) => any): any;
db: any;
collections: any;
readyState: number;
}
export class Schema {
constructor(definition: any, options?: any);
static Types: {
ObjectId: any;
Mixed: any;
};
methods: any;
statics: any;
path(path: string): any;
virtual(path: string): any;
pre(method: string, callback: (next: (any?) => any) => any): void;
}
export class SchemaType { }
export class VirtualType { }
export class Query<T extends Document> {
exec(): Promise;
exec(operation: string): Promise;
exec(callback: (err: any, res: T[]) => any): Promise;
exec(operation: string, callback: (err: any, res: T[]) => void ):
Promise;
skip(x: number): Query;
limit(x: number): Query;
}
export class Promise { }
export interface Model<T extends Document> {
new (any): Document;
find(conditions: any): Query<T>;
find(conditions: any, fields: any): Query<T>;
find(conditions: any, fields: any, options: any): Query<T>;
find(conditions: any, fields: any, options: any, callback: (err:
any, res: any) => void ): Query<T>;
find(conditions: any, callback: (err: any, res: T[]) => void ):
Query<T>;
find(conditions: any, fields: any, callback: (err: any, res: T[])
=> void ): Query<T>;
findOne(conditions: any): Query<T>;
findOne(conditions: any, fields: any): Query<T>;
findOne(conditions: any, fields: any, options: any): Query<T>;
findOne(conditions: any, fields: any, options: any, callback:
(err: any, res: T) => void ): Query<T>;
findOne(conditions: any, callback: (err: any, res: T) => void ):
Query<T>;
findOne(conditions: any, fields: any, callback: (err: any, res: T)
=> void ): Query<T>;
findById(id: string): Query<T>;
findById(id: string, fields: any): Query<T>;
findById(id: string, fields: any, options: any): Query<T>;
findById(id: string, fields: any, options: any, callback: (err:
any, res: T) => void ): Query<T>;
findById(id: string, callback: (err: any, res: T) => void ):
Query<T>;
findById(id: string, fields: any, callback: (err: any, res: T) =>
void ): Query<T>;
findByIdAndUpdate(id: string): Query<T>;
findByIdAndUpdate(id: string, update: any): Query<T>;
findByIdAndUpdate(id: string, update: any, options: any): Query<T>;
findByIdAndUpdate(id: string, update: any, options: any, callback:
(err: any, res: T[]) => void ): Query<T>;
findByIdAndUpdate(id: string, callback: (err: any, res: T[]) =>
void ): Query<T>;
findByIdAndUpdate(id: string, update: any, callback: (err: any,
res: T[]) => void ): Query<T>;
update(conditions: any,
update: any,
options?: any,
callback?: (err: any, affectedRows: number, raw: any) =>
void ): Query<T>;
update(conditions: any,
update: any,
callback?: (err: any, affectedRows: number, raw: any) =>
void ): Query<T>;
create(doc: any, fn: (err: any, res: T) => void ): void;
collection: Collection;
remove(conditions: any, callback?: (err) => void): Query<T>;
}
/*
export var Model: {
(any);
constructor(doc?: any);
new (any);
find(conditions: any): Query;
find(conditions: any, fields: any): Query;
find(conditions: any, fields: any, options: any): Query;
find(conditions: any, fields: any, options: any, callback: (err: any,
res: any) => void ): Query;
find(conditions: any, callback: (err: any, res: any) => void ): Query;
find(conditions: any, fields: any, callback: (err: any, res: any) =>
void ): Query;
findById(id: string): Query;
findById(id: string, fields: any): Query;
findById(id: string, fields: any, options: any): Query;
findById(id: string, fields: any, options: any, callback: (err: any,
res: any) => void ): Query;
findById(id: string, callback: (err: any, res: any) => void ): Query;
findById(id: string, fields: any, callback: (err: any, res: any) =>
void ): Query;
collection: Collection;
}*/
export interface Document {
_id: string;
update<T extends Document>(doc: any, options: any, callback: (err:
any, affectedRows: number, raw: any) => void ): Query<T>;
save<T extends Document>(fn?: (err: any, res: T) => void ): void;
remove<T extends Document>(callback?: (err) => void ): Query<T>;
}
export class MongooseError { }
export class Types { }
export class SchemaTypes { }
}
Working with NodeJS 10.3 and TypeScript 0.9.1. I am working on trying to
fix a github project here.
C:/Node/Typescript Experiment/node_modules/.bin/tsc.cmd" --sourcemap
mongoose.d.ts --module commonjs
C:/Node/Typescript Experiment/d.ts/mongoose.d.ts(96,35): error TS2049:
Parameter 'res' of exported function is using inaccessible module
C:/Node/Typescript Experiment/d.ts/mongoose.d.ts(97,54): error TS2049:
Parameter 'res' of exported function is using inaccessible module
This is the error, I've included the source code for this as well,
///<reference path='DefinitelyTyped/node/node.d.ts' />
export = M;
declare module M {
export interface Mongoose {
constructor();
set (key: string, value: string): Mongoose;
get (key: string): string;
createConnection(uri?: string, options?: any): Connection;
connect(any): Mongoose;
disconnect(fn: (err?: any) => void ): Mongoose;
model(name: string, schema?: Schema, collection?: string,
skipInit?: boolean): Model;
modelNames(): string[];
plugin(fn: (any) => any, opts?: any): Mongoose;
mongo: any;
version: string;
connection: Connection;
}
export function set(key: string, value: string): Mongoose;
export function get(key: string): string;
export function createConnection(uri ? : string, options?: any):
Connection;
export function connect(any): Mongoose;
export function disconnect(fn: (err?: any) => void ): Mongoose;
export function model(name: string, schema?: Schema, collection?:
string, skipInit?: boolean): Model;
export function modelNames(): string[];
export function plugin(fn: (any) => any, opts?: any): Mongoose;
export var mongo: any;
export var version: string;
export var connection: Connection;
export class Collection {
name: string;
}
export class Connection implements EventEmitter {
constructor(base: Mongoose);
addListener(event: string, listener: Function);
on(event: string, listener: Function);
once(event: string, listener: Function): void;
removeListener(event: string, listener: Function): void;
removeAllListeners(event?: string): void;
setMaxListeners(n: number): void;
listeners(event: string): { Function; }[];
emit(event: string, ...args: any[]): void;
open(connection_string: string,
database?: string,
port?: number,
options?: any,
callback?: (any) => any): Connection;
openSet(uris: string,
database?: string,
options?: any,
callback?: (any) => any): Connection;
close(callback?: (any) => any): Connection;
collection(name: string, options?: any): Collection;
model(name: string, schema?: Schema, collection?: string): Model;
modelNames(): string[];
setProfiling(level: number, ms: number, callback: (any) => any): any;
db: any;
collections: any;
readyState: number;
}
export class Schema {
constructor(definition: any, options?: any);
static Types: {
ObjectId: any;
Mixed: any;
};
methods: any;
statics: any;
path(path: string): any;
virtual(path: string): any;
pre(method: string, callback: (next: (any?) => any) => any): void;
}
export class SchemaType { }
export class VirtualType { }
export class Query<T extends Document> {
exec(): Promise;
exec(operation: string): Promise;
exec(callback: (err: any, res: T[]) => any): Promise;
exec(operation: string, callback: (err: any, res: T[]) => void ):
Promise;
skip(x: number): Query;
limit(x: number): Query;
}
export class Promise { }
export interface Model<T extends Document> {
new (any): Document;
find(conditions: any): Query<T>;
find(conditions: any, fields: any): Query<T>;
find(conditions: any, fields: any, options: any): Query<T>;
find(conditions: any, fields: any, options: any, callback: (err:
any, res: any) => void ): Query<T>;
find(conditions: any, callback: (err: any, res: T[]) => void ):
Query<T>;
find(conditions: any, fields: any, callback: (err: any, res: T[])
=> void ): Query<T>;
findOne(conditions: any): Query<T>;
findOne(conditions: any, fields: any): Query<T>;
findOne(conditions: any, fields: any, options: any): Query<T>;
findOne(conditions: any, fields: any, options: any, callback:
(err: any, res: T) => void ): Query<T>;
findOne(conditions: any, callback: (err: any, res: T) => void ):
Query<T>;
findOne(conditions: any, fields: any, callback: (err: any, res: T)
=> void ): Query<T>;
findById(id: string): Query<T>;
findById(id: string, fields: any): Query<T>;
findById(id: string, fields: any, options: any): Query<T>;
findById(id: string, fields: any, options: any, callback: (err:
any, res: T) => void ): Query<T>;
findById(id: string, callback: (err: any, res: T) => void ):
Query<T>;
findById(id: string, fields: any, callback: (err: any, res: T) =>
void ): Query<T>;
findByIdAndUpdate(id: string): Query<T>;
findByIdAndUpdate(id: string, update: any): Query<T>;
findByIdAndUpdate(id: string, update: any, options: any): Query<T>;
findByIdAndUpdate(id: string, update: any, options: any, callback:
(err: any, res: T[]) => void ): Query<T>;
findByIdAndUpdate(id: string, callback: (err: any, res: T[]) =>
void ): Query<T>;
findByIdAndUpdate(id: string, update: any, callback: (err: any,
res: T[]) => void ): Query<T>;
update(conditions: any,
update: any,
options?: any,
callback?: (err: any, affectedRows: number, raw: any) =>
void ): Query<T>;
update(conditions: any,
update: any,
callback?: (err: any, affectedRows: number, raw: any) =>
void ): Query<T>;
create(doc: any, fn: (err: any, res: T) => void ): void;
collection: Collection;
remove(conditions: any, callback?: (err) => void): Query<T>;
}
/*
export var Model: {
(any);
constructor(doc?: any);
new (any);
find(conditions: any): Query;
find(conditions: any, fields: any): Query;
find(conditions: any, fields: any, options: any): Query;
find(conditions: any, fields: any, options: any, callback: (err: any,
res: any) => void ): Query;
find(conditions: any, callback: (err: any, res: any) => void ): Query;
find(conditions: any, fields: any, callback: (err: any, res: any) =>
void ): Query;
findById(id: string): Query;
findById(id: string, fields: any): Query;
findById(id: string, fields: any, options: any): Query;
findById(id: string, fields: any, options: any, callback: (err: any,
res: any) => void ): Query;
findById(id: string, callback: (err: any, res: any) => void ): Query;
findById(id: string, fields: any, callback: (err: any, res: any) =>
void ): Query;
collection: Collection;
}*/
export interface Document {
_id: string;
update<T extends Document>(doc: any, options: any, callback: (err:
any, affectedRows: number, raw: any) => void ): Query<T>;
save<T extends Document>(fn?: (err: any, res: T) => void ): void;
remove<T extends Document>(callback?: (err) => void ): Query<T>;
}
export class MongooseError { }
export class Types { }
export class SchemaTypes { }
}
Working with NodeJS 10.3 and TypeScript 0.9.1. I am working on trying to
fix a github project here.
Should I create model files when only visualizing data in Rails?
Should I create model files when only visualizing data in Rails?
I started working on first small rails project which will in fact get data
from database and visualize in jquery datatable. There will be no updates
at all. The question is, should I create models for this data and access
it through activerecord or it is ok to access it directly through SQL
commands in controller ?
I started working on first small rails project which will in fact get data
from database and visualize in jquery datatable. There will be no updates
at all. The question is, should I create models for this data and access
it through activerecord or it is ok to access it directly through SQL
commands in controller ?
Sunday, 18 August 2013
iPhone 2G won't restore properly, but continues to say there was an error after restoring.
iPhone 2G won't restore properly, but continues to say there was an error
after restoring.
My iPhone shut off and then said I need to connect to iTunes. I've done
that and now it says I have to restore it. I've restored it 3 times now,
every time it finishes restoring it just tells me there was an error and
that I need to restore it again.
My phone was in complete working order before this. It's got a SIM card in
it connected to a plan. What can I do to get my phone in working order
again?
after restoring.
My iPhone shut off and then said I need to connect to iTunes. I've done
that and now it says I have to restore it. I've restored it 3 times now,
every time it finishes restoring it just tells me there was an error and
that I need to restore it again.
My phone was in complete working order before this. It's got a SIM card in
it connected to a plan. What can I do to get my phone in working order
again?
passing a serialized object
passing a serialized object
In xmlrpc objects need to be serialized before they can be transmitted
across a network, so this is what I am trying to do.
addAuthorName = txtAddAuthorName.getText();
int addArticleNumber =
Integer.parseInt(txtAddArticleNumber.getText());
newArticle = new Article(addAuthorName, addArticleNumber);
ObjectOutputStream oos;
oos = new ObjectOutputStream(
new ByteArrayOutputStream());
oos.writeObject(newArticle);
Vector<Object> addArticleArglist = new Vector<Object>();
addArticleArglist.addElement(oos);
System.out.println(oos);
// make the call
String callit = ("GetSize.addHash");
articleID = (Integer) client.execute(callit, addArticleArglist);
The problem I am getting is that my program will not accept the
outputstream that is contained in the vector the error given is
unsupported Java type: class java.io.ObjectOutputStream
In xmlrpc objects need to be serialized before they can be transmitted
across a network, so this is what I am trying to do.
addAuthorName = txtAddAuthorName.getText();
int addArticleNumber =
Integer.parseInt(txtAddArticleNumber.getText());
newArticle = new Article(addAuthorName, addArticleNumber);
ObjectOutputStream oos;
oos = new ObjectOutputStream(
new ByteArrayOutputStream());
oos.writeObject(newArticle);
Vector<Object> addArticleArglist = new Vector<Object>();
addArticleArglist.addElement(oos);
System.out.println(oos);
// make the call
String callit = ("GetSize.addHash");
articleID = (Integer) client.execute(callit, addArticleArglist);
The problem I am getting is that my program will not accept the
outputstream that is contained in the vector the error given is
unsupported Java type: class java.io.ObjectOutputStream
Telerik Rad Combo binding data but not displaying
Telerik Rad Combo binding data but not displaying
I have a telerik rad combo on my form
<radC:RadCombo ID="ddl" runat="server" DropdownListHeight="200px"/>
In CS
Under another rad combo's Selected Index Changed event
var dt = myFunc();
ddl.DataTextField="Name";
ddl.DataValueField="Id";
ddl.DataSource=dt;
ddl.Databind();
ddl.Items.Insert(0,new RadComboBoxItem ("-1","---Choose---"));
Please note:
I have 25 items coming from db and the datatable dt has only two columns,
Name and Id as described above. No errors are thrown , everything went
fine but the result is not visible on the UI.
Any insight/help?
I have a telerik rad combo on my form
<radC:RadCombo ID="ddl" runat="server" DropdownListHeight="200px"/>
In CS
Under another rad combo's Selected Index Changed event
var dt = myFunc();
ddl.DataTextField="Name";
ddl.DataValueField="Id";
ddl.DataSource=dt;
ddl.Databind();
ddl.Items.Insert(0,new RadComboBoxItem ("-1","---Choose---"));
Please note:
I have 25 items coming from db and the datatable dt has only two columns,
Name and Id as described above. No errors are thrown , everything went
fine but the result is not visible on the UI.
Any insight/help?
How to make button to remove value in mysql field?
How to make button to remove value in mysql field?
I am having difficulty making a button that removes existing values in
MySQL database field. I have read up some information on it, some say use
AJAX, but i'm not sure. What are your opinions? Can any Stackoverflow-er
show me a method? I recognise I cannot use Javascript as it is on the
client side and not server-side - but is there another way?
I am having difficulty making a button that removes existing values in
MySQL database field. I have read up some information on it, some say use
AJAX, but i'm not sure. What are your opinions? Can any Stackoverflow-er
show me a method? I recognise I cannot use Javascript as it is on the
client side and not server-side - but is there another way?
content styling problems IBM worklight
content styling problems IBM worklight
I am trying to make a simple app using worklight 5.0. Now Here is a
screenshot of my app on my device -
Now the problem is almost negligible, but i want to fix this. See in the
screenshot above before the divider there is some blank space, now this
blank space is a part of my image if you download it and see, you will see
it clearly. Now in my Css i have already defined the height to be 100% but
still this 10-20px margin is there at the bottom and i dont know why....
Below are my HTML and CSS file's content in case you might wanna review it.
#content{
height:100%;
width:100%;
margin:0;
background: -moz-linear-gradient(top, #1e5799 0%, #7db9e8 49%, #2989d8
100%);
background: -webkit-gradient(linear, left top, left bottom,
color-stop(0%,#1e5799),
color-stop(49%,#7db9e8), color-stop(100%,#2989d8));
background: -webkit-linear-gradient(top, #1e5799 0%,#7db9e8 49%,#2989d8
100%);
background: -o-linear-gradient(top, #1e5799 0%,#7db9e8 49%,#2989d8 100%);
background: -ms-linear-gradient(top, #1e5799 0%,#7db9e8 49%,#2989d8
100%); /* IE10+ */
background: linear-gradient(to bottom, #1e5799 0%,#7db9e8 49%,#2989d8
100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr='#1e5799', endColorstr='#2989d8',GradientType=0 );
}
<body id="content">
<div data-dojo-type="dojox.mobile.View" id="oneTwoTest"
data-dojo-props="selected:true" >
<div data-dojo-type="dojox.mobile.Heading"
data-dojo-props="label:'HTML'"></div>
<div data-dojo-type="dojox.mobile.ScrollableView" id="aboutView"
data-dojo-props="scrollDir:'v'">
<div data-dojo-type="dojox.mobile.ContentPane"
id="aboutViewContentPane" href="pages/about.html" ></div>
</div>
</div>
is there any modification i am supposed to do in wlclient.css or any other
change you think?
I am trying to make a simple app using worklight 5.0. Now Here is a
screenshot of my app on my device -
Now the problem is almost negligible, but i want to fix this. See in the
screenshot above before the divider there is some blank space, now this
blank space is a part of my image if you download it and see, you will see
it clearly. Now in my Css i have already defined the height to be 100% but
still this 10-20px margin is there at the bottom and i dont know why....
Below are my HTML and CSS file's content in case you might wanna review it.
#content{
height:100%;
width:100%;
margin:0;
background: -moz-linear-gradient(top, #1e5799 0%, #7db9e8 49%, #2989d8
100%);
background: -webkit-gradient(linear, left top, left bottom,
color-stop(0%,#1e5799),
color-stop(49%,#7db9e8), color-stop(100%,#2989d8));
background: -webkit-linear-gradient(top, #1e5799 0%,#7db9e8 49%,#2989d8
100%);
background: -o-linear-gradient(top, #1e5799 0%,#7db9e8 49%,#2989d8 100%);
background: -ms-linear-gradient(top, #1e5799 0%,#7db9e8 49%,#2989d8
100%); /* IE10+ */
background: linear-gradient(to bottom, #1e5799 0%,#7db9e8 49%,#2989d8
100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr='#1e5799', endColorstr='#2989d8',GradientType=0 );
}
<body id="content">
<div data-dojo-type="dojox.mobile.View" id="oneTwoTest"
data-dojo-props="selected:true" >
<div data-dojo-type="dojox.mobile.Heading"
data-dojo-props="label:'HTML'"></div>
<div data-dojo-type="dojox.mobile.ScrollableView" id="aboutView"
data-dojo-props="scrollDir:'v'">
<div data-dojo-type="dojox.mobile.ContentPane"
id="aboutViewContentPane" href="pages/about.html" ></div>
</div>
</div>
is there any modification i am supposed to do in wlclient.css or any other
change you think?
WebGL context can't render simplest screen
WebGL context can't render simplest screen
I'm stuck trying to render some extremely basic stuff on webgl, I've
dumbed down the rendering to the most basic thing I can think of in order
to find where the issue lies, but I can't even draw a simple square for
some reason. The scene I really want to render is more complex, but as I
said, I've dumbed it down to try to find the problem and still no luck.
I'm hoping someone can take a look and find whatever I'm missing, wich I
assume is a setup step at some point.
The gl commands I'm running (as reported by webgl inspector, without
errors) are:
clearColor(0,0,0,1)
clearDepth(1)
clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT)
useProgram([Program 2])
bindBuffer(ARRAY_BUFFER, [Buffer 5])
vertexAttribPointer(0, 2, FLOAT, false, 0, 0)
drawArrays(TRIANGLES, 0, 6)
The buffer that is being used there (Buffer 5) is setup as follows:
bufferData(ARRAY_BUFFER, [-1,-1,1,-1,-1,1,-1,1,1,-1,1,1], STATIC_DRAW)
And the program (Program 2) data is:
LINK_STATUS true
VALIDATE_STATUS false
DELETE_STATUS false
ACTIVE_UNIFORMS 0
ACTIVE_ATTRIBUTES 1
Vertex shader:
#ifdef GL_ES
precision highp float;
I'm stuck trying to render some extremely basic stuff on webgl, I've
dumbed down the rendering to the most basic thing I can think of in order
to find where the issue lies, but I can't even draw a simple square for
some reason. The scene I really want to render is more complex, but as I
said, I've dumbed it down to try to find the problem and still no luck.
I'm hoping someone can take a look and find whatever I'm missing, wich I
assume is a setup step at some point.
The gl commands I'm running (as reported by webgl inspector, without
errors) are:
clearColor(0,0,0,1)
clearDepth(1)
clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT)
useProgram([Program 2])
bindBuffer(ARRAY_BUFFER, [Buffer 5])
vertexAttribPointer(0, 2, FLOAT, false, 0, 0)
drawArrays(TRIANGLES, 0, 6)
The buffer that is being used there (Buffer 5) is setup as follows:
bufferData(ARRAY_BUFFER, [-1,-1,1,-1,-1,1,-1,1,1,-1,1,1], STATIC_DRAW)
And the program (Program 2) data is:
LINK_STATUS true
VALIDATE_STATUS false
DELETE_STATUS false
ACTIVE_UNIFORMS 0
ACTIVE_ATTRIBUTES 1
Vertex shader:
#ifdef GL_ES
precision highp float;
Subscribe to:
Comments (Atom)