Thursday, October 3, 2013

C# Typecast an Enum to a Struct

C# Typecast an Enum to a Struct

I'm using C#, and have manipulate an object one the screen. I setup a
struct to hold the coordinates, and then I setup an enum to restrict the
number of directions that could be moved.
private enum Direction
{
UpperLeft = new Coord(-1, -1), UpperCenter = new Coord(0, -1),
UpperRight = new Coord(1, -1),
Left = new Coord(-1, 0), Right = new Coord(1, 0),
LowerLeft = new Coord(-1, 1), LowerCenter = new Coord(0, 1),
LowerRight = new Coord(1, 1)
};
private struct Coord
{
public int row { get; private set; }
public int col { get; private set; }
public Coord(int r, int c) : this()
{
row = r;
col = c;
}
public static Coord operator +(Coord a, Coord b)
{
return new Coord(a.row + b.row, a.col + b.col);
}
}
Basically what I am aiming to do is to have the object I have on the
screen move based on the assigned enum.
So I'd like to hypothetically use it like this or something:
public class ThingThatMovesToTheLeft
{
Direction dir = Direction.Left;
Coord pos = new Coord(0,0);
public void Move()
{
this.pos = this.dir + this.pos;
}
}
Esentially my question is how do I typecast my enum back to my struct so I
can use it in this manor? I can't seem to be able to cast it back to the
struct. (Additionally, VisualStudios let me assign the enum to those Coord
structs without complaining so I assumed that it was okay to assign an
struct to an enum, is this acceptable practice or should this just not be
done?)

Wednesday, October 2, 2013

C# Winform: Mouse Over Combobox Generate InvalidOperationException

C# Winform: Mouse Over Combobox Generate InvalidOperationException

This appears to be an error beyond my control. My WinForm application (C#
.NET Client Profile 4.0) is single threaded. By this, I mean the code I
wrote has only one thread. I understand that any WinForm GUI application
may have a background thread.
My application is used by about ten people, only two of them experience
the following exception.
When the users hoover their mouse over a combobox located on a standard
toolstrip, the correct behavior is that the combobox becomes in focus.
However, two users got the following exception:
System.InvalidOperationException: Object is currently in use elsewhere.
It looks that the exception is from background thread. Also, if I changed
the Widows 7 fancy themes to the Windows Classic theme, the error goes
away. But my user refuse to change his beloved theme.
Could you advise me on how to avoid this exception? I was thinking of
adding an event handler, handling move over event? I haven't try that yet.
Any advice is highly appreciated
This is the detailed exception message and stack trace.
***** Exception Text *******
System.InvalidOperationException: Object is currently in use elsewhere.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.FillPolygon(Brush brush, Point[] points,
FillMode fillMode)
at System.Drawing.Graphics.FillPolygon(Brush brush, Point[] points)
at
System.Windows.Forms.ToolStripComboBox.ToolStripComboBoxControl.ToolStripComboBoxFlatComboAdapter.DrawFlatComboDropDown(ComboBox
comboBox, Graphics g, Rectangle dropDownRect)
at
System.Windows.Forms.ComboBox.FlatComboAdapter.DrawFlatCombo(ComboBox
comboBox, Graphics g)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

YouTube API - playlist returning invalid hangout videos

YouTube API - playlist returning invalid hangout videos

Using the standard/example code provided by Google for the YouTube API in
order to display the list of videos found on a channel, I am getting lots
of invalid and non-existent videos returned back. They appear to have been
created by On Air Hangout events (for which, the "Start Broadcast" button
was never pressed and instead the event was just cancelled).
$channelsResponse = $youtube->channels->listChannels("contentDetails", array(
"mine" => "true", ));
foreach ($channelsResponse["items"] as $channel) {
$uploadsListId = $channel["contentDetails"]["relatedPlaylists"]["uploads"];
$playlistItemsResponse =
$youtube->playlistItems->listPlaylistItems("snippet", array(
"playlistId" => $uploadsListId,
"maxResults" => 50
));
echo "<h3>Videos in list $uploadsListId</h3><ul>";
foreach ($playlistItemsResponse["items"] as $playlistItem) {
echo $playlistItem["snippet"]["title"] . " (" .
$playlistItem["snippet"]["resourceId"]["videoId"] . ")<br>";
echo "<img src=" .
$playlistItem["snippet"]["thumbnails"]["default"]["url"] . "><br>";
echo "<br><br>";
}
echo "</ul>";
}
The invalid videos being returned do NOT show up when actually going into
my YouTube account in the Video Manager. It's like they are ghost
listings. Of course, actually conducting an On Air Hangout will cause the
video to be archived in YouTube and show up on the list as normal. But it
appears there is a bug that's causing cancelled events to show up to...
with no way to filer for them, delete them, or prevent them from being
returned. Help!!!

Logging to JettyLogger(null)

Logging to JettyLogger(null)

when I run my application as an app engine web application, in the log
console I have that line:
INFO: Logging to JettyLogger(null) via
com.google.apphosting.utils.jetty.JettyLogger
console waits about 5-7 second on this line. may be because of "null",
what do you think? what is this, and how can I fix that?

Integer variable is zero when is it null in database

Integer variable is zero when is it null in database

I have declared variable as
private Integer projectId;
//with getters and setters
While retrieving values from database, if projectId is null in database
table, it is shown as 0 e.g.
log.info("?? "+projectList.get(1).getProjectId());
the result of the above is 0.
Why it is shown as 0 although it is null in table and how can I make this
is as null when it is null in table?

Tuesday, October 1, 2013

How to use mysqli_query - PHP

How to use mysqli_query - PHP

Okay so I have a file that contains all the information for my database,
then I have a file that uses this information and a separate function that
calls the database. I have a function that is suppose to gather
information from the database but I need to use mysqli_query, how do I do
this? Because mysqli_query expects to things, the query and the connection
to the database. But my connection to the database is a separate function.
private $db;
//put your code here
// constructor
function __construct() {
require_once 'DB_Connect.php';
// connecting to database
$this->db = new DB_Connect();
$this->db->connect();
}
// destructor
function __destruct() {
}
public function isUserExisted($email) {
$result = mysqli_query($WHAT GOES HERE??,"SELECT email from users
WHERE email = '$email'");
$no_of_rows = mysqli_num_rows($result);
if ($no_of_rows > 0) {
// user existed
return true;
} else {
// user not existed
return false;
}
}

Amazon EMR questions

Amazon EMR questions

I have to feed output from custom Linux application to Hadoop and it seems
as Amazon EMR is a great way to experiment. I am really just beginning to
look into Hadoop and Amazon documentation, so some advise would be
appreciated...
Would I be able to run my application in SELinux environment?
Would I be able to deploy/execute my app (written in C++) on Amazon EMR
nodes? What would be the approach to get the output of app (string, double
pair) into Hadoop in this environment?
Thank you.

Will the foot print of Neil Armstrong erode=?iso-8859-1?Q?=3F_=96_space.stackexchange.com?=

Will the foot print of Neil Armstrong erode? – space.stackexchange.com

The Moon has a very thin (practically non-existent) atmosphere so the foot
print left by Neil Armstrong won't be eroded for centuries. But there are
solar winds. Is it possible that solar wind would …

Poisson distribution of independent variable [on hold]

Poisson distribution of independent variable [on hold]

N is a RV with a Poisson distribution with parameter ë. A coin has
probability p of heads. We &#64258;ip the coin N times. Let X and Y be the
number of heads and tails respectively. Assume that the process which
generates N is independent of the coin. (a) Find the distributions of X
and Y . (b) Show that X and Y are independent.

Monday, September 30, 2013

Day of the Dragons sacrifice's rule – boardgames.stackexchange.com

Day of the Dragons sacrifice's rule – boardgames.stackexchange.com

The Card Day of the Dragons says the following: When Day of the Dragons
leaves the battlefield, sacrifice all Dragons you control. Then return the
exiled cards to the battlefield under your ...

How to access devices with static IPs on different subnet than router?

How to access devices with static IPs on different subnet than router?

I have a SonicWall TZ100, firmware SonicOS Enhanced 5.8.1.13, with a
static subnet of 10.0.6.0/24 on X0. Ports X2-X4 are port shielded to X0.
On ports X3 and X4 I have two devices that were moved from different
locations and we forgot to update their settings while on site. Their IPs
are 192.168.213.254 and 10.0.4.253. I'm not sure which one is connected to
which port.
What do I have to do on the SonicWall to gain access to the web interfaces
of those devices so I can change their IPs? I don't have physical access
to the devices which is why I'm trying to do this remotely.
I tried assigning the X3 and X4 ports with static IPs of what the gateways
for those devices should be, but it didn't help so I reverted it back.
Help would be appreciated.

jQuery script not available in AJAX loaded page

jQuery script not available in AJAX loaded page

I have an anonymous jQuery function that looks like this:
( function( $ ) {
"use strict";
var CHEF = window.CHEF || {};
CHEF.fancyTitler = function() {
if( $( '.k-fancy-title' ).length ) {
$( '.k-fancy-title' ).wrap( '<div class="k-fancy-title-wrap"
/>' );
}
}
// + a bunch of other functions inside
$( document ).ready( function() {
CHEF.fancyTitler();
// + a bunch of other function inits
} );
} )(jQuery);
...then I load some content on to the page by using AJAX. Everything is
fine regarding content loading, however .k-fancy-title element doesn't get
wrapped. It's kinda obvious that I need to reload/re-call/whatever my
anonymous function in order to wrap ajax loaded content with DIV
(.k-fancy-title-wrap).
How do I do that?

AppCache fallback page overriding the error page

AppCache fallback page overriding the error page

I have custom error page which is used to display whenever 404 or 500
error happens. If I put a Appcache manifest file with fallback in it, the
error page is getting overridden by fallback html page. Any solution for
this?

Sunday, September 29, 2013

Usinge a Singleton Class to expose an interface

Usinge a Singleton Class to expose an interface

I am currently doing an assignment to create a WebCrawler, and one of the
requirements is
"Your application must implement a singleton class, DownloadRepository. An
instance of this class must be suitably initialized at system startup
using an appropriate static initializer. This singleton must expose an
interface that can be used by the crawler class (WebPage) to save a
WebElement object to the repository. "
I understand how to implement a singleton class. But my question is what
does "expose an interface" exactly mean?(I know that is more a question
for my professor but i cant reach him) Does the singleton somehow create a
a global interface that can be used with other classes? If this is
possible how would it be done?

error starting Eclipse after installing an sdk

error starting Eclipse after installing an sdk

After installing the Samsung Smart TV SDK on Win7 (64-bit) OS, i get the
following error dialog box when attempting to run eclipse.exe (with using
'Run as Administrator' on the shortcut).
An error has occurred. see the log file PATH\FILENAME.log
The log file has the following:



!SESSION 2013-09-29 11:46:49.900
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_40
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.modeling.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product
org.eclipse.epp.package.modeling.product
!ENTRY org.eclipse.osgi 4 0 2013-09-29 11:46:55.657
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Unable to acquire application service.
Ensure that the org.eclipse.core.runtime bundle is resolved and started
(see config.ini).
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)



My java version is (when typing: java -version in a command prompt)



C:>java -version java version '1.7.0_40' Java(TM) SE Runtime Environment
(build 1.7.0_40-b43) Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56,
mixed mode)



I have added the following to the Path variable in the Environmental
Variables already (to fix a previous error that occurred before the one i
am writing about now)



C:\Program Files (x86)\Java\jre7\bin



Any advice here?

Google analytics toolbox - powerful data processing in Matlab Simulink

Google analytics toolbox - powerful data processing in Matlab Simulink

For those who work a lot of Google analytics and wished for more powerful
and flexible options in reporting and data manipulation, I've developed a
toolbox in Matlab Simulink that allows you to do that exactly.
It is free and please download it here - http://www.gatoolbox.net
Best.

IE thinks that float initial is float left?

IE thinks that float initial is float left?

I have the following html :
<div class="cleanContainer">
<div style="height:80px">test</div>
</div>
And this CSS :
.cleanContainer
{
float: left;
padding: 7px;
background-color: #ffffff;
width: 786px;
-moz-border-radius: 2px 2px 2px 2px;
-webkit-border-radius: 2px 2px 2px 2px;
border-radius: 2px 2px 2px 2px;
}
Then I got a @media screen CSS file where I got this :
.cleanContainer
{
float: initial;
padding: 3px;
width: auto;
}
This works fine in Chrome, the float is set to none and will take the
entire width. In IE it will be set as float: left and this is no good for
the design?
How do I solve this?

Saturday, September 28, 2013

JSF Datatable does not show all List fields(columns)

JSF Datatable does not show all List fields(columns)

I want to display a table in JSF:DataTAble. I successfully retrived table
from database to List of users type where "users" is my pojo class. Now I
am having problem with displaying it on data table some of the columns
like FName, LName, Pwd, displayed correctly but when i add other coulmns
like "Note" "Email" it gives me this error
javax.servlet.ServletException: /dt.xhtml: Property 'Email' not found on
type in.ali.pojo.users
javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
root cause
javax.el.ELException: /dt.xhtml: Property 'Email' not found on type
in.ali.pojo.users
com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:88)
com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302)
com.sun.faces.renderkit.html_basic.TableRenderer.renderRow(TableRenderer.java:385)
com.sun.faces.renderkit.html_basic.TableRenderer.encodeChildren(TableRenderer.java:162)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
here is my xhtml page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:dataTable value="#{pretechDataTableBean.user}" var="users">
<h:column>
<f:facet name="header">Name</f:facet>
#{users.FName}
</h:column>
<h:column>
<f:facet name="header">Email</f:facet>
#{users.Email}
</h:column>
<h:column>
<f:facet name="header">Password</f:facet>
#{users.pwd}
</h:column>
</h:dataTable>
</h:body>
</html>
here is my PretechDataTableBean which i used for retrieving data from DB
package com.pretech;
import in.ali.pojo.users;
import in.ali.util.HibernateUtil;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import java.util.ArrayList;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
/**
*
* @author vinod
*/
@ManagedBean
@RequestScoped
public class PretechDataTableBean {
public PretechDataTableBean() {
}
public List<users> getUser() {
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = null;
List<users> users =null;
try
{
transaction = session.beginTransaction();
users = session.createQuery("from users").list();
}
catch(Exception e)
{
e.printStackTrace();
}
finally{
session.close();
}
return users;
}
}
This is my users pojo
package in.ali.pojo;
// Generated Sep 28, 2013 3:55:01 PM by Hibernate Tools 4.0.0
/**
* users generated by hbm2java
*/
public class users implements java.io.Serializable {
private long UserId;
private String FName;
private String LName;
private long UserTypeId;
private String UserName;
private String Email;
private String Pwd;
private String Note;
private boolean IsActive;
public users() {
}
public users(long UserId) {
this.UserId = UserId;
}
public users(long UserId, String FName, String LName, long UserTypeId,
String UserName, String Email, String Pwd, String Note,
boolean IsActive) {
this.UserId = UserId;
this.FName = FName;
this.LName = LName;
this.UserTypeId = UserTypeId;
this.UserName = UserName;
this.Email = Email;
this.Pwd = Pwd;
this.Note = Note;
this.IsActive = IsActive;
}
public long getUserId() {
return this.UserId;
}
public void setUserId(long UserId) {
this.UserId = UserId;
}
public String getFName() {
return this.FName;
}
public void setFName(String FName) {
this.FName = FName;
}
public String getLName() {
return this.LName;
}
public void setLName(String LName) {
this.LName = LName;
}
public long getUserTypeId() {
return this.UserTypeId;
}
public void setUserTypeId(long UserTypeId) {
this.UserTypeId = UserTypeId;
}
public String getUserName() {
return this.UserName;
}
public void setUserName(String UserName) {
this.UserName = UserName;
}
public String getEmail() {
return this.Email;
}
public void setEmail(String Email) {
this.Email = Email;
}
public String getPwd() {
return this.Pwd;
}
public void setPwd(String Pwd) {
this.Pwd = Pwd;
}
public String getNote() {
return this.Note;
}
public void setNote(String Note) {
this.Note = Note;
}
public boolean isIsActive() {
return this.IsActive;
}
public void setIsActive(boolean IsActive) {
this.IsActive = IsActive;
}
}

Button Link Formatting - Center and Match Width

Button Link Formatting - Center and Match Width

I've created a couple of simple buttons using a link and some CSS to give
it a background and I'm trying to center it on my page. However, because
the text in one of the buttons is longer than the other, the buttons are
of different sizes and for consistency, I'd like them to be the same
width.
How can I keep these buttons the same size? Trying to float them and use
percentage widths results in them not being centered. The relevant markup
is below.
<section class="buttonsSection">
<a class="button" href="#">Very Long Sentence</a>
<a class="button" href="#">Short Phrase</a>
</section>
.button {
padding: 10px 15px;
background-color: deepskyblue;
color: white;
}
.buttonsSection{
text-align: center;
margin-top: 30px;
margin-bottom: 30px;
}
.buttonsSection a {
margin: 3px;
}
JSFiddle: http://jsfiddle.net/Dragonseer/BzQ8e/

Select from list of values received from a subquery, possibly null

Select from list of values received from a subquery, possibly null

A (simplified version of my) query looks like this:
SELECT id
FROM table
WHERE column1
IN
(
SELECT column1
FROM table
GROUP BY column1
HAVING COUNT(*) > 1
)
This selects a list of id's where column1 has multiply occuring values (in
other words, these are not unique). This works as expected with one
exception: if the value NULL occurs multiple times (which is possible), no
ids are selected. What would be the correct way to select ids of columns
in case NULL turns out to be non unique?

display content of specific derectory from command line argument

display content of specific derectory from command line argument

shell script to accept a directory-name and display its contents. If input
is not given then HOME directory's contents should be listed. (Make use of
command line argument)
please provide me some hints and solutions

Friday, September 27, 2013

Where can in insert mysql_real_escape_string in here? And how to prevent html from being entered?

Where can in insert mysql_real_escape_string in here? And how to prevent
html from being entered?

I have a php/mysql db search. When I search for html code, like /hr> tags
it alters the page and creates /hr>'s. I'd like to also protect this from
sql injection but I don't know how.
Can I add the real escape string somewhere? or no?
<form action='trytosearch.php' method='GET'>
<center>
<h1>My Search Engine</h1>
<input type='text' size='90' name='search'></br></br>
<input type='submit' name='submit' value='Search here' ></br></br></br>
</center>
<?php
$button = $_GET ['submit'];
$search = $_GET ['search'];
if(!$button)
echo "you didn't submit a keyword";
else
{
if(strlen($search)<=1)
echo "Search term too short";
else{
echo "You searched for <b>$search</b> <hr size='1'></br>";
mysql_connect("localhost","me_abc","pass");
mysql_select_db("table");
$search_exploded = explode (" ", $search);
foreach($search_exploded as $search_each)
{
$x++;
if($x==1)
$construct .="keywords LIKE '%$search_each%'";
else
$construct .="AND keywords LIKE '%$search_each%'";
}
$construct ="SELECT * FROM listoga_db WHERE $construct";
$run = mysql_query($construct);
$foundnum = mysql_num_rows($run);
if ($foundnum==0)
echo "Sorry, there are no matching result for <b>$search</b>.</br>";
else
{
echo "$foundnum results found !<p>";
while($runrows = mysql_fetch_assoc($run))
{
$title = $runrows ['title'];
$desc = $runrows ['description'];
$link = $runrows ['link'];
echo "
<a href='$link'><b>$title</b></a><br>
";
}
}
}
}
?>

create a grid of dots

create a grid of dots

I would like to create a grid of dots very much like in this game:
https://play.google.com/store/apps/details?id=com.nerdyoctopus.gamedots&hl=en
The aim is for each dot to be touchable, so I can recognise where that
particular dot is and other information about it.
I don't really know where to start. Do I want to create a custom View for
a dot with all the information I want, and then create multiple versions
of it? And then do I arrange them in a grid with the setTranslation()
method, or would it be better to use LayoutParams with offsets?
If I created my own "Dot" that extended "View", then I could add a lot of
different information/methods to it - I could theoretically have a
changeColor() method. Is this the best way?
A GridView is not what I am thinking of (as far as I know) as it is
basically a different style of ListView.
There are lots of questions here! I have looked at a number of questions
here on StackOverflow and elsewhere, but none show/ explain how I should
start.

DNS resolution fails in web browser but nslookup succeeds

DNS resolution fails in web browser but nslookup succeeds

This is cross-posted from ServerFault on the chance that it's more of a
client-side problem rather than a server/network issue.
We are a small, 300-seat organization with a mixed BYOD and Active
Directory environment (Windows Server 2012 Standard, Windows 7 Enterprise)
and we are having a very strange problem involving very specific-scope
failures to resolve our organization's domain name on our domain-joined,
company-controlled machines. For the purpose of this discussion, I'll use
company.com instead of our domain name.
Background:
Active Directory Domain Controller is located at 172.16.1.3
The AD/DC machine is also running DHCP, DNS, and HTTP (IIS)
Our organizations websites at company.com and subdomain.company.com are
hosted by IIS on the AD/DC machine
We have a split-DNS scenario in which the AD/DC server is used for
internal DNS resolution but a different, off-site server provides DNS
resolution for public queries
The IP address corresponding to company.com and subdomain.company.com is
the public IP address used by a firewall at the edge of our network (both
on the AD/DC DNS server and the off-site DNS server)
The firewall is correctly configured for NAT to pass HTTP and HTTPS
requests it receives on its public IP address to the internal IP of the
AD/DC server and reflects
Scenario 1:
A user on a domain-joined Windows 7 Enterprise machine is connected
directly to our local network with local address 172.16.6.100 /16, issued
by the DHCP server.
The DNS server entry is provided by DHCP (172.16.1.3)
This user is able to access the websites hosted at company.com and
subdomain.company.com
Scenario 2:
The same user on the same domain-joined Windows 7 Enterprise machine goes
home and connects to the Internet using their residential ISP
The IP and DNS server entries for the client machine are provided by DHCP
This user can access any internet resources, such as google.com
This user cannot access the website at company.com or
subdomain.company.com (a "host not resolved" error is returned)
When this user runs nslookup on company.com they DO receive the correct
public IP address provided by DNS
HTTP/HTTPS requests to the IP address succeed and a webpage is returned
properly by the server
This issue prevails across all web browsers
Using tracert company.com returns "unable to resolve target system name"
Using ping company.com returns "could not find host company.com"
When running Wireshark on the client before/during a failed request, no
packets are sent by the client machine (either for DNS resolution or for
an initial HTTP/ping/tracert request)
Restarting the DNS Client service does not resolve the problem
Stopping the DNS Client service does not resolve the problem
Using ipconfig /flushdns does not resolve this issue
Using route /f does not resolve this issue
Resetting the network connections using netsh int ip reset does not
resolve this issue
Scenario 3:
This same user on a personal (not domain-joined) Windows 7 Professional
computer is able to access the websites at company.com and
subdomain.company.com when connected to our local network
Scenario 4:
This same user on a personal (not domain-joined) Windows 7 Professional
computer is able to access the websites at company.com and
subdomain.company.com when connected their home network
Final Notes:
This issue seems to be generalized to affect all company-owned computers.
We are using a common system image for all company-owned computers, which
was just loaded in August. I have been scouring the internet in search of
possible solutions and have come up empty handed so far -- I really
appreciate any suggestions or advice you may have.

How can I make these .htaccess rules work together?

How can I make these .htaccess rules work together?

I have two separate sets of .htaccess rules. One set tells example.com to
point all but a select few url requests to a subdirectory in my hosting
account where my main site lives, and the other set are .htaccess rules
required for Wordpress, which is installed in the root, to format links
properly.
The problem is that I can't use the Wordpress rules as-is because in doing
so I'll lose access to my main site. I've been trying to figure out a way
to have all requests BUT those tied to Wordpress redirect to the
subdirectory. The closest I've come is the second line of code in the
first sample below, but it's not working: WP requires its .htaccess rules
in order to format the links properly.
So how can I adjust these rules so that the two sets of code will play
nice together? I've been trying to figure this out for four days but I
know nothing about .htaccess and I'm at the end of my rope. I'd be so
grateful if anyone could help me fix this.
The .htaccess I'm currently using:
RewriteEngine on
RewriteRule ^(wp-(content|admin|includes)|site1|site2|site3) - [L]
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/example/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /example/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ example/index.php [L]
The .htaccess I need to safely integrate into that one:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

JQuery Show Class on hover issue

JQuery Show Class on hover issue

I am trying to get a div to show when a link is hovered.
There will be multiple classes too so only the nearest should show.
This is what I'm trying:
$(".box").hover(function() {
$('.overlay').closest.show();
});
<div class="event" id="selector">
<a class="box" href="#" title="">Event</a>
<div class="overlayOuter">
<div class="overlayInner"></div>
</div>
<div class="overlay" style="display:none;"> I will come out when class
Box is hovered </div>
</div>
When I hover class="box" then class="overlay" is shown.
The problem is that Overlay is not appearing so I'm guessing my jquery is
wrong?
How can I get this to work?

Thursday, September 26, 2013

How to get filtered data by calling webservice in Java

How to get filtered data by calling webservice in Java

I am writing a code where I call a webservice to get the data from
database and then fetch it in the grid by applying some conditions which
is working fine. But since in future the database will be huge so to call
whole data and then refining it will create performance issues. So I want
to get filter data itself from database.
Current Code: Calling webservice code:
RESTClient<AuditInfoObject, ArrayList<AuditInfoObject>> restClient = new
RESTClient<AuditInfoObject, ArrayList<AuditInfoObject>>(
new AuditInfoObject(), new
TypeToken<ArrayList<AuditInfoObject>>() {
}.getType(), CommonConstatnts.SHOW_ALL_AUDIT,
CommonConstatnts.CONTET_TYPE_JSON);
ArrayList<AuditInfoObject> auditInfoList = restClient.getResponse();
AuditInfoObject contains: userID,appID,and othe details.
Here auditinfolist contains the whole data.
Now i apply the condition to filter the data which i recieved by comparing
userId and appId and insert it in grid table.
Code:
try {
for (AuditInfoObject row : auditInfoList) {
if (app.getUserID() == row.getUserID() &&
app.getAppName().equalsIgnoreCase(row.getAppName().trim())) {
GridItem item = new GridItem(appDashBoardGrid, SWT.FILL |
SWT.NONE);
item.setText(0, row.getTimeStamp());
item.setText(1, row.getAction());
item.setText(2, row.getActionData());
item.setText(3, row.getMachineDetail());
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
HERE:app.getUserID() is the current userID which i match with the recieved
data userid column i.e row.getUserID() similarly for appID also.
Now I want to call webservice in such a way that the present userID and
appId goes with webservice call match with database and I should get
filtered data before only on that basis so that I can put in grid table
because it will be fast and have good performance.

Wednesday, September 25, 2013

How to display set of 5 id's in html page?

How to display set of 5 id's in html page?

I have html files with 100 lines of proverbs in that i have id for all
proverbs.
For example:
<a id="1">1. Proverb ...</a>
<a id="2">2. Proverb ...</a>
//....
<a id="100">100. Proverb ...</a>
i have textbox. if user enters 5 in it, it goto /page.html#5 like this
basic concept, i was displaying these proverbs.
My Question is, If user enters 5, page.html should show 5 to 10. But, I
dunno how to do this. I tried like /page.html#5&max-results=5, but doesn't
works.
Any one knows how to do this. If answer in html or php or js will be more
useful. Every answer will be much appreciated.

Thursday, September 19, 2013

Can't see components in JScrollPane

Can't see components in JScrollPane

I'm using a JScrollPane to hold a JTextArea for a large area of text. I
add the TextArea directly to the JFrame, it works fine. But I add it to
the scrollpane and add the scrollpane, I don't see the textarea. Here's my
SSCCE:
public class foo extends JFrame{
//gui elements
JTextArea chatMonitor = new JTextArea();
JScrollPane textPane = new JScrollPane();
ChatFrame(final String nickname, final String login, final String server,
final String channel){
setSize(500,500);
chatMonitor.setEditable(false);
chatMonitor.setVisible(true);
textPane.add(chatMonitor);
textPane.setAutoscrolls(true);
textPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
textPane.setVisible(true);
add(textPane);
}
}

Request for files after an error not sended (multiple files)

Request for files after an error not sended (multiple files)

I tried to find an answer for this issue by myself in the console and
looking at the forum but there isn't.
I use fine-uploader version 3.7 Core. When I upload multiple files and
that one of them results in an error, the files after in the queue have
not even a request sended to the server, even though I see the correct
number of files received in the console.
Is it normal or due to my code ?
The others (files before in the queue) are processed normally. My code is
too big to display it here, so if you need one part in particular, tell
me.
EDIT : here is my fine-uploader code client-side :
(function($){
$.fn.uberuploadcropper = function(options){ // définition d'une méthode
jQuery .uberuploadcropper(imgdata[num]ect option) = comme .html() ou
.css() à appliquer sur l'imgdata[num]et JQ dans lequel on veut mettre le
bouton
// initiation des options
options = $.extend(true, {}, {
postProcessing: false,
postRequest: {},
cazeVide: {
num: [],
uuid: []
}, // numero de la photo et l'uuid de la photo qui y sera affiché
firstEmpty: 0,
objetCazes: { },
fineuploader: { }, // fineuploader options
jcrop: { setSelect: [0,0,100,100] }, // jcrop options
impromptu: {}, // impromptu options
folder: '',
cropAction: '',
onSubmit: function(){},
onProgress: function(){},
onSingleCompleted: function(){},
onComplete: function(){},
erreur: function(){},
afficher: function(){},
move: function(){},
deleteImg: function(){}
},
options);
var $t = $(this);
var imgdata = [];
$t.bind('erreur', options.erreur);
$t.bind('avantUpload', options.onSubmit);
$t.bind('inProgress', options.onProgress);
$t.bind('uberSingleUploadComplete',options.onSingleCompleted);
$t.bind('uberAllUploadsComplete', options.onComplete);
$t.bind('afficher', options.afficher);
$t.bind('move', options.move);
$t.bind('delete', options.deleteImg);
$t.fineUploader(options.fineuploader)
.on('error', function(event, id, filename, reason){
var position = $.inArray(id, options.cazeVide.uuid);
var numero = options.cazeVide.num[position];
var iterationNbr = imgdata.length - numero;
for (var i = 0; i < iterationNbr; i++) {
if(typeof(imgdata[(numero+1+i)]) !== 'undefined') {
imgdata[(numero+i)] = imgdata[(numero+1+i)];
if(i === iterationNbr-1) { // last iteration
imgdata.splice(imgdata.length-1, 1);
}
}
}
$t.trigger('delete', numero);
$t.trigger('erreur', [id, filename, reason, numero]); // à
faire avant le else qui modifie cazeVide.uuid
if($t.fineUploader('getInProgress') === 0) {
$t.trigger('uberAllUploadsComplete', [options, imgdata]);
options.cazeVide = {
num : [],
uuid: []
};
}
})
.on('submit', function(event, id, name) {
$t.trigger('avantUpload', [id, options]);
$.when(options.postRequest).done(function() {
var position = $.inArray(id, options.cazeVide.uuid);
var numero = options.cazeVide.num[position];
})
.on('progress', function(event, id, name, uploadedbytes,
totalBytes) {
$t.trigger('inProgress', [id, uploadedbytes, totalBytes,
options]);
})
.on('complete', function(event, id, fileName, responseJson){
var position = $.inArray(id, options.cazeVide.uuid);
var numero = options.cazeVide.num[position];
imgdata[numero] = (responseJson);
var qquuid = responseJson.qquuid;
var extension = responseJson.extension;
$t.trigger('uberSingleUploadComplete', [numero, qquuid,
extension, options]);
$t.trigger('afficher', [imgdata, numero]);
if ($t.fineUploader('getInProgress') === 0) {
$t.trigger('uberAllUploadsComplete', [options, imgdata]);
}
});
};
$('#fineuploader').uberuploadcropper({
//---------------------------------------------------
// uploadify options..
//---------------------------------------------------
// before each upload, delete past informations
postProcessing: false,
postRequest: {},
cazeVide : {
num : [],
uuid: []
},
firstEmpty: 0,
objetCazes : $('.caseTd'),
fineuploader: {
debug : true,
uploaderType: 'basic',
button: $('#fineuploader'),
multiple : true,
text: {
defaultResponseError: "Unknown error"
},
messages: {
typeError: "{file} has an invalid extension. Valid extension(s):
{extensions}.",
emptyError: "{file} is empty, please select files again without it.",
sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
noFilesError: "No files to upload",
onLeave: "The files are being uploaded, if you leave now the
upload will be cancelled."
},
maxConnections: 25,
request : {
// only from v3.1
params: {
//http://blog.fineuploader.com/2012/11/include-params-in-request-body-or-query.html
dir_name: $('#folder').attr('value'),
},
// be sure to set the charset UTF-8 meta tag in your HTML.
endpoint: 'upload.php'
},
validation: {
sizeLimit : 6*1048576*(6/6.3),
allowedExtensions: ['jpg','jpeg','png','gif']
},
},
//---------------------------------------------------
//now the cropper options..
//---------------------------------------------------
jcrop: {
// aspectRatio : 1,
allowSelect : true, //can reselect
allowResize : true, //can resize selection
setSelect : [ 0, 0, 200, 200 ], //these are the dimensions of the
crop box x1,y1,x2,y2
minSize : [ 100, 100 ], //if you want to be able to resize, use
these
maxSize : [ 500, 375 ]
},
//---------------------------------------------------
//now the uber options..
//---------------------------------------------------
folder : dossierTemp + $('#folder').attr('value') + '/', // only
used in uber, not passed to server
cropAction : 'crop.php', // server side request to crop image
onSubmit : function(e, id, th){
if(th.cazeVide.num.length === 0 && !(th.postProcessing)){
th.postProcessing = true;
var url = {};
var noImg = [];
url.dir_name = $('#folder').attr('value');
$('.apercu').each(function(index) {
var divApercu = $(this);
if(divApercu.children('.miniature').length === 0) {
noImg.push(index);
}
else {
var image = divApercu.children('.miniature')[0];
var lastSlash = image.src.lastIndexOf("/");
var fileName = image.src.slice(lastSlash+1);
url[index] = (fileName);
}
});
th.postRequest = $.post('searchEmpty.php', url, function(data) {
function compare(x, y) {
return x - y;
}
th.cazeVide.num = $.merge(noImg, data).sort(compare);
if(th.cazeVide.num.length == 0) {
return false;
alert('File limit reached, please delete files uploaded
first');
}
else {
th.cazeVide.uuid = [];
th.cazeVide.uuid[0] = id;
initialiseProgress(id, th);
}
th.postProcessing = false;
}, 'json');
}
else {
$.when(th.postRequest).done(function() {
if(th.cazeVide.uuid.length == th.cazeVide.num.length) {
return false;
alert('File limit reached, please delete files uploaded
first');
}
else {
th.cazeVide.uuid.push(id);
initialiseProgress(id, th);
}
});
}
},
onProgress : function (e, id, uploadedBytes, totalBytes, th) {
var loaded = Math.round((uploadedBytes / totalBytes) * 100);
var pos2 = $.inArray(id, th.cazeVide.uuid);
var spanProgress = $('.progress:eq('+ th.cazeVide.num[pos2] +')');
spanProgress.text(loaded + ' %');
},
onSingleCompleted : function (e, numero, uuid, ext, th) {
$('.uuid:eq('+ numero +')').attr('value', uuid);
$('.ext:eq('+ numero +')').attr('value', ext);
var spanProgress2 = $('.progress:eq('+ numero +')');
spanProgress2.text('');
$('.apercu:eq('+ numero +')').css({
'background-color': '',
});
},
onComplete : function(e, th, img){ // all uploads complete
var j = -1;
$('.caseTd').each(function(index) {
var caseTab = $(this);
if(caseTab.find('.miniature').length === 0 && j !== -1) {
caseTab.on({
dragover: function(event) {
event.stopPropagation();
event.preventDefault();
},
drop: function(event) {
event.stopPropagation();
event.preventDefault();
var indexApercu = j;
var difference = indexApercu - indexDragged;
if(difference !== 0) {
if(difference > 0) { // déplacement vers le bas
drop(event, indexDragged, indexApercu, img);
}
else {
drop(event, indexDragged, indexApercu+1, img);
// destination is the one following the gaps
chosen
}
}
},
});
}
else {
j = index;
}
});
th.cazeVide = {
num : [],
uuid: []
};
},
erreur : function(e, id, filename, reason, numero) {
var spanProgress2 = $('.progress:eq('+ numero +')');
spanProgress2.text('');
$('.apercu:eq('+ numero +')').css({
'background-color': '',
});
alert('Error : ' + reason);
},
afficher : function(e, img, num){
var dernierPoint = img[num].filename.lastIndexOf(".");
var extension = img[num].filename.slice(dernierPoint+1);
var coupe = img[num].filename.substr(0,dernierPoint);
var cheminMin = coupe + '_min.'+ extension;
var $PhotoPrevs = $('.apercu:eq(' + num + ') ');
$PhotoPrevs.children('.miniature').remove();
var image = $('<img class="miniature" src="' + dossierTemp +
$('#folder').attr('value') + '/'+ cheminMin +'" draggable="true" />');
$PhotoPrevs.prepend(image);
// Drag and drop
image.css('cursor', 'move');
var caseTd = $('.caseTd:eq(' + num + ') ');
caseTd.on({
// déclenché tant qu on a pas lâché l élément
dragover: function(event) {
event.stopPropagation();
event.preventDefault();
},
drop: function(event) {
event.stopPropagation();
event.preventDefault();
var indexCase = num;
var difference = indexCase - indexDragged;
if(difference !== 0) {
if(difference > 0) { // déplacement vers le bas
drop(event, indexDragged, indexCase, img); // img is
imgdata
}
else {
drop(event, indexDragged, indexCase+1, img); //
destination is the one following the gaps chosen
}
}
},
});
image.on({
// on commence le drag au moment du clique gauche
dragstart: function(event) {
indexDragged = findIndex($(this).attr('src')); // we store the
number of the file being dragged
},
// on commence a bouger un élément draggable
dragenter: function(event) {
event.preventDefault();
},
// déclenché tant qu on a pas lâché l élément
dragover: function(event) {
event.stopPropagation();
event.preventDefault();
},
// quand un élément est laché dessus
drop: function(event) {
event.stopPropagation();
event.preventDefault();
var indexDestination = findIndex($(this).attr('src'));
if (indexDragged !== indexDestination) {
drop(event, indexDragged, indexDestination, img);
}
},
});
},
move : function(e, num1, num2){
var firstImg = [$('.miniature:eq(' + num1 + ') '), $('.uuid:eq(' +
num1 + ') ').attr('value')];
$('.apercu:eq(' + num1 + ') ').prepend($('.miniature:eq(' + num2 + ')
'));
$('.uuid:eq(' + num1 + ') ').attr('value',
$('.uuid:eq(' + num2 + ')
').attr('value')
);
$('.apercu:eq(' + num2 + ') ').prepend(firstImg[0]);
$('.uuid:eq(' + num2 + ') ').attr('value', firstImg[1]);
},
deleteImg : function(e, num){
var i = num + 0;
$('.apercu:eq('+ num +'), .apercu:gt(' + num + ')
').each(function(index){
var apercu = $(this);
var miniature = apercu.children('.miniature');
if(index === 0){
if(miniature.length !== 0) {
miniature.remove();
}
}
else {
var divBoutons = $('.boutons:eq('+ (num+index) +')');
var leftArrow = divBoutons.children('.left-arrow');
if(leftArrow.length !== 0) {
$('.apercu:eq(' + (num+index-1) + ') ').prepend(miniature);
$('.uuid:eq(' + (num+index-1) + ')').attr('value',
$('.uuid:eq(' + (num+index) + ') ').attr('value')
);
i++;
}
else {
return false;
}
}
});
var caseTab = $('.caseTd:eq(' + i + ') ');
var prevCase = $('.caseTd:eq(' + (i-1) + ') ');
caseTab.find('.uuid').attr('value', '');
caseTab.find('.crop-button, .delete, .left-arrow').remove();
prevCase.find('.right-arrow').remove();
var spanProgress = $('.progress:eq('+ i +')');
spanProgress.text('');
$('.apercu:eq('+ i +')').css({
'background-color': '',
});
}
});
})(jQuery);
Thanks !

VBScript filesys.CopyFile to a folder that is partly random

VBScript filesys.CopyFile to a folder that is partly random

Can anyone help me with cracking this nut?
I have a folder in %localappdata% that is partly random that I need to
move a file into.
%localappdata%\acroprint\TQP4_{random string of letters}\4.1.15.25435\
dim filesys, oShell
Set oShell = CreateObject("WScript.Shell")
strHomeFolder = oShell.ExpandEnvironmentStrings("%LOCALAPPDATA%")
set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("\\tstcfile\public\tqp41_15\user.config") Then
filesys.CopyFile "\\tstcfile\public\tqp41_15\user.config",
strHomeFolder & "\Acroprint\TQP4_{random string of
letters}\4.1.15.25435\", true
End If
So far, this is the closest I can get the script to work. My issue is with
the random string of numbers and letters that is unique on each desktop. I
know I cant use an * in the destination. Does anyone know a workaround?
Thanks Chris

using equals or instanceof in toString

using equals or instanceof in toString

Ok guys I have a program with a 'MartianManager' class: *Note code is not
complete still have some missing pieces just supplied entire code for
reference of somewhat how it is going to look when complete
import java.util.ArrayList;
public class MartianManager {
private ArrayList<Martian> martians;
private ArrayList<Martian> teleporters;
public void addMartian(Martian m) {
martians.add(m);
if(m instanceof GreenMartian)
teleporters.add(m);
}
//public Object clone() {
public Martian getMartianClosestToID(int id) {
}
public void groupSpeak() {
for(Martian m : martians) {
m.speak();
}
}
public void groupTeleport(String dest) {
}
}
and Martian class:
public abstract class Martian implements Cloneable {
int id;
public Martian(int id) {
this.id = id;
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public int getId() {
return id;
}
public boolean equals(Object o){
return this.getId() == ((Martian)o).getId();
}
public abstract void speak();
public String toString(){
String str = "";
if (this instanceof GreenMartian) {
str = "Green martian" + id;
}
if (this instanceof RedMartian) {
str = "Red martian" + id;
}
return str;
}
}
it is extended with GreenMartian:
public class GreenMartian extends Martian implements ITeleport{
public GreenMartian(int id) {
super(id);
}
public void speak() {
System.out.println(id + "Grobldy Grock");
}
public void teleport(String dest) {
System.out.println(id + "teleporting to " + dest);
}
}
also extended with RedMartian:
public class RedMartian extends Martian {
public RedMartian(int id) {
super(id);
}
public void speak() {
System.out.println(id + "Rubldy Rock");
}
}
I actually have a few questions , but for now my question is in the
toString of the Martian class. It should return a string like this: "Red
[or Green] martian" +id. I need to determine the type of Martian, I
started to use the instanceof but like this "Martian couldn't be resolved
to a variable". I'm trying to determine if this would be the best way or
if an equals() would be the best way to determine the type?
Also this is my first time using "clone" so not sure how it works exactly,
but had a thought is there a way to determine what the "clone" was and
determine it that way?
Thanks for any and all help!

Image scroll effect ? Android

Image scroll effect ? Android

i have tried to mimic the scroll effect for image like in Yahoo weather
app while scrolling up and also for view pager but not successful . has
anyone tried similar thing ?

Shadow Variable in Java

Shadow Variable in Java

What is shadow variable in Java? How can I implement that using a program?
Does this kind of re declaration may lead to compile time errors?
Is this concept really used in developments?

Android Softkey's next button not taking focus to spinner

Android Softkey's next button not taking focus to spinner

We have spinner between two text boxes in my Android screen. When the
focus is on 1st text box and I am clicking next from softkey, it is
directly moving to next textbox instead of the spinner.

Wednesday, September 18, 2013

Why a variable declared in a class globally is not visible/accsible in same class method?

Why a variable declared in a class globally is not visible/accsible in
same class method?

i made a class in app code folder in visual studio 2010. when i declared
any variable outside of a method(globally), it can't be visible in that
method. I am new in asp.net, may be i make any mistake but i can't catch
that. So i need some help. my code is as follow...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class Class2
{
public Class2()
{
//
// TODO: Add constructor logic here
//
}
int i;
public static void calculate(string)
{
// here want that variable but i can't get it in intelliscence.
}
}

The project wasn't generated by 'android' tool. Error in IntelliJ IDEA

The project wasn't generated by 'android' tool. Error in IntelliJ IDEA

I've been strrugling with an error with IntelliJ IDEA 12.1.4 when creating
a new Android project.
I've tried all the possible solutions that I found online but never ran
into any solution.
On the console panel it says "The project wasn't generated by 'android'
tool."
First error while creating an Android Project :
http://s9.postimg.org/m0lyq2pzz/image.png
This is the warning that shows up after the first alert:
http://s9.postimg.org/m0lyq2pzz/image.png `
However with the Eclipse, I can create an Android project (using the same
SDK setup with IntelliJ and there are no errors.)
Also, when I import the project that I create in Eclipse previously,
IntelliJ works just fine!
What could be IntelliJ's exact problem?

mysql_fetch_row not working

mysql_fetch_row not working

I have a function which queries database and counts the number of rows in it.
if($action=='shipping_list'){
$row;
$shipping=shipping_list();
$numrow=$r[0];
$row=mysql_fetch_row($paging);
include('shipping_list.php');}
function shipping_list(){
global $MEMS;
global $row;
$query = "SELECT * FROM Inventory
WHERE Yield >=330 AND (Q = 'Pass' OR Q = 'No Q') AND shipdate = ' '
ORDER BY Wafer ASC, RC ASC";
$shipping = $MEMS -> query($query);
$query = "SELECT COUNT(*) Inventory
WHERE Yield >=330 AND (Q = 'Pass' OR Q = 'No Q') AND shipdate = ' '";
$paging = $MEMS -> query($query);
return $shipping;
}
Basically, it calls on the function, which has a SQL command that counts
the number of queries returned. The code then fetches the row with mysql
fetch row. However, $row keep returning NULL. Does anyone here know what
I'm doing wrong?

How to get the current User Windows Logon Details: WindowsIdentity.GetCurrent()

How to get the current User Windows Logon Details:
WindowsIdentity.GetCurrent()

This code was used once to get the Current user's windows logon name.
The application was published on a webserver and this code worked to get
the end user's Windows Logon Name, so how could this happen when this code
is actually running in the code behind on the server itself?
Dim CurrentUser As String =
System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString
Please explain to me if you can.

Jquery recall function (inside updatepanel) is not smooth

Jquery recall function (inside updatepanel) is not smooth

I have a jquery function to toggle "ReplyComment" div.
function addcommentdiv() {
$('.in').click(function () {
var $this = $(this),
$reply = $this.next('.ReplyComment');
var cevapladisplay = $reply.css('display');
$reply.toggle();
});
}
addcommentdiv();
$(document).ready(function () {
addcommentdiv();
});
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
addcommentdiv();
});
...
<ul class="chats">
<li class="in" >
blablabla
</li>
<div class="ReplyComment" id="ReplyComment">
blablabla
</div>
</ul>
This function sometimes work sometimes doesn't.Shortly not working
smoothly. I can't understand.(inside updatepanel and datalist)

CSS3 background-size

CSS3 background-size

Is there a way of switching between css classes without using JS just html
with CSS.
I would like to be able to switch between these two classes
.b1 { background-size: cover } .b2 { background-size: 100% }
Possible?

jquery remove all elements except for first one

jquery remove all elements except for first one

Using jquery remove how can i remove all the span tags except for the
first one..
EDIT
var html = var htm =
$("#addin").find(".engagement_data:last-child").find(".keys_values").html();
html='
<span style="display:block;" class="k_v">
<innput type="text" class="e_keys" style="width:65px;"
placeholder="key"/>
<input type="text" class="e_values" style="width:65px;"
placeholder="value"/>
</span>
<span style="display:block;" class="k_v">
<input type="text" class="e_keys" style="width:65px;"
placeholder="key"/>
<input type="text" class="e_values" style="width:65px;"
placeholder="value"/>
</span>
';
$(html).find("span:gt(0)").remove();

I need to get the sum of next 5 rows that are order by one specific column : in sqlite

I need to get the sum of next 5 rows that are order by one specific column
: in sqlite

actual table
YEAR TOT



2001 1
2002 2
2003 3
20010 10
20011 11
20012 12
20013 13
20014 14
20015 15
Now Expected Results : YEAR TOT Exp_res



2001 1 1+2+3+4+5 = 15
2002 2 2+3+4+5+6 = 20
2003 3 3+4+5+6+7 = 25
20010 10 10+11+12+13+14
20011 11 11+12+13+14+15
20012 12 12+13+14+15
20013 13 13+14+15
20014 14 14+15
20015 15 15

getting data from one activity to another android

getting data from one activity to another android

I want to show latitude and longitude in googleMap. 1. what is the best
way to get lat n lang? and how to do it ? 2. what changes should be made
in Manifest file ?? Kindly cooperate.
public class MainActivity extends FragmentActivity{
protected GoogleMap gMap;
String gotbread;
TextView text;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gMap = ((SupportMapFragment)
getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
if (gMap == null) {
Toast.makeText(this, "Google Maps not available",
Toast.LENGTH_LONG).show();}
text=(TextView) findViewById(R.id.text1);
gMap.setMyLocationEnabled(true);
}
}
2nd Class: From where values should be taken .
public class Locate extends Activity implements LocationListener {
Location location = null; // location
double latitude; // latitude
double longitude; // longitude
TextView text1,text2;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.locate);
text1=(TextView) findViewById(R.id.textView1);
text2=(TextView) findViewById(R.id.textView2);
location();
}
private void location()
{
try{
final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
// The minimum time between updates in milliseconds
final long MIN_TIME_BW_UPDATES = 1000 * 60 * 5; // 5 minute
// Declaring a Location Manager
LocationManager locationManager = (LocationManager)
getSystemService(LOCATION_SERVICE);
// getting network status
boolean isNetworkEnabled1 = locationManager
.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
if (isNetworkEnabled1) {
locationManager.requestLocationUpdates(
LocationManager.NETWORK_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES,
this);
Log.d("Network", "Network");
if (locationManager != null) {
location = locationManager
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location != null) {
latitude = location.getLatitude();
longitude =
location.getLongitude();
text1.setText(latitude+" ");
text2.setText(longitude+" ");
}
}
}
}catch(Exception e)
{
e.printStackTrace();
}
}
public void onStatusChanged(String provider, int status, Bundle
extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {}
public void onLocationChanged(Location arg0) {}
}
Manifest File,
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.map"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<permission
android:name="com.example.map.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission
android:name="com.example.map.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"
/>
<!--
The following two permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.map.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.map.Locate"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.Locate" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBeJoGKnhxYps-youI1xfMZn6S2G05l0PM" />
</application>
</manifest>

Tuesday, September 17, 2013

Bash: substring of a constant string

Bash: substring of a constant string

I know, that there is a way to get substring of a string variable:
MY_STR=abacaba
echo ${MY_STR:2:6}
Is there a way to get substring of a string given as literal constant?
Something like:
echo ${"abacaba":2:6}

how Remove certain character at Front and back of a varchar

how Remove certain character at Front and back of a varchar

I have a customer data such as below Table= Customer field= CardNo
Data in CardNo
%ABC?;9991?
%ABC?;99912?
%ABC?;999123?
%ABC?;888123?
However i want remove all the "%ABC?;" at the front and "?" at the back,
in the entire Cardno Field. How i do it ? I have try LEFT and RIGHT and
LEN method, seen not working good. UPDATE Customer SET cardno =
RIGHT(cardno, LEN(cardno) - 7)
"Return Error Msg 536, Level 16, State 2, Line 1 Invalid length parameter
passed to the RIGHT function. The statement has been terminated."
Is there any method? thanks a lot

iOS7 crashing - [__NSPlaceholderDictionary initWithObjects

iOS7 crashing - [__NSPlaceholderDictionary initWithObjects

Going through my iOS6 app and trying to fix everything for iOS7.
Throughout my app I'm getting the error:
-[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to
insert nil object from objects[0]
Here is the stack trace form this code:
NSString *shareString = [NSString stringWithFormat:@"I ... %@",
self.booking.venue.name];
NSArray *activityItems = [NSArray arrayWithObjects:shareString, nil];
UIActivityViewController *activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:activityItems
applicationActivities:nil];
[self presentViewController:activityViewController animated:YES
completion:nil];
*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary
initWithObjects:forKeys:count:]: attempt to insert nil object from
objects[0]'
*** First throw call stack:
(
0 CoreFoundation 0x03bc45e4 __exceptionPreprocess +
180
1 libobjc.A.dylib 0x032d38b6 objc_exception_throw + 44
2 CoreFoundation 0x03b8a536
-[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 390
3 CoreFoundation 0x03bb8029 +[NSDictionary
dictionaryWithObjects:forKeys:count:] + 73
4 UIKit 0x0141eea4 -[UIButton
_intrinsicSizeWithinSize:] + 1255
5 UIKit 0x017ee81d
-[UIView(UIConstraintBasedLayout) intrinsicContentSize] + 51
6 UIKit 0x017eeebf
-[UIView(UIConstraintBasedLayout) _generateContentSizeConstraints] + 36
7 UIKit 0x017eeb50
-[UIView(UIConstraintBasedLayout) _updateContentSizeConstraints] + 511
8 UIKit 0x017f4e8f
-[UIView(AdditionalLayoutSupport) updateConstraints] + 110
9 UIKit 0x0141dab7 -[UIButton
updateConstraints] + 54
10 UIKit 0x017f4728
-[UIView(AdditionalLayoutSupport)
_internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] +
239
11 UIKit 0x017f48a6
-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
12 UIKit 0x017f4827 __UIViewRecursionHelper
+ 40
13 CoreFoundation 0x03b65dc9 CFArrayApplyFunction + 57
14 UIKit 0x017f46cc
-[UIView(AdditionalLayoutSupport)
_internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] +
147
15 UIKit 0x017f48a6
-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
16 UIKit 0x017f4827 __UIViewRecursionHelper
+ 40
17 CoreFoundation 0x03b65dc9 CFArrayApplyFunction + 57
18 UIKit 0x017f46cc
-[UIView(AdditionalLayoutSupport)
_internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] +
147
19 UIKit 0x017f48a6
-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
20 UIKit 0x017f4827 __UIViewRecursionHelper
+ 40
21 CoreFoundation 0x03b65dc9 CFArrayApplyFunction + 57
22 UIKit 0x017f46cc
-[UIView(AdditionalLayoutSupport)
_internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] +
147
23 UIKit 0x017f48a6
-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
24 UIKit 0x017f4827 __UIViewRecursionHelper
+ 40
25 CoreFoundation 0x03b65dc9 CFArrayApplyFunction + 57
26 UIKit 0x017f46cc
-[UIView(AdditionalLayoutSupport)
_internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] +
147
27 UIKit 0x017f48a6
-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122
28 UIKit 0x017e8f48
__62-[UIWindow(UIConstraintBasedLayout)
updateConstraintsIfNeeded]_block_invoke + 43
29 Foundation 0x02e7a3ec -[NSISEngine
withBehaviors:performModifications:] + 107
30 Foundation 0x02d0a145 -[NSISEngine
withAutomaticOptimizationDisabled:] + 48
31 UIKit 0x017e8c60
-[UIWindow(UIConstraintBasedLayout) updateConstraintsIfNeeded] + 225
32 UIKit 0x017f4f06
-[UIView(AdditionalLayoutSupport) _updateConstraintsAtWindowLevelIfNeeded]
+ 85
33 UIKit 0x011ed6ef -[UIView(Hierarchy)
layoutBelowIfNeeded] + 348
34 UIKit 0x018a3def
-[_UIBackdropContentView backdropView:recursivelyUpdateMaskViewsForView:]
+ 56
35 UIKit 0x018a4240
-[_UIBackdropContentView didMoveToWindow] + 273
36 UIKit 0x011f5be7 -[UIView(Internal)
_didMoveFromWindow:toWindow:] + 1689
37 UIKit 0x011f5847 -[UIView(Internal)
_didMoveFromWindow:toWindow:] + 761
38 UIKit 0x011f5847 -[UIView(Internal)
_didMoveFromWindow:toWindow:] + 761
39 UIKit 0x011f5847 -[UIView(Internal)
_didMoveFromWindow:toWindow:] + 761
40 UIKit 0x011f5847 -[UIView(Internal)
_didMoveFromWindow:toWindow:] + 761
41 UIKit 0x011ed070 __45-[UIView(Hierarchy)
_postMovedFromSuperview:]_block_invoke + 162
42 UIKit 0x011ecef8 -[UIView(Hierarchy)
_postMovedFromSuperview:] + 260
43 UIKit 0x011f8031 -[UIView(Internal)
_addSubview:positioned:relativeTo:] + 1847
44 UIKit 0x011eb521 -[UIView(Hierarchy)
addSubview:] + 56
45 UIKit 0x012861f8 -[UITransitionView
transition:fromView:toView:removeFromView:] + 1205
46 UIKit 0x018add65
-[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] + 463
47 UIKit 0x0153a37d
__101-[UIWindowController
transition:fromViewController:toViewController:target:didEndSelector:animation:]_block_invoke_2
+ 1577
48 UIKit 0x011acd33
___afterCACommitHandler_block_invoke + 15
49 UIKit 0x011accde
_applyBlockToCFArrayCopiedToStack + 403
50 UIKit 0x011acb0a _afterCACommitHandler +
532
51 CoreFoundation 0x03b8c53e
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
52 CoreFoundation 0x03b8c48f __CFRunLoopDoObservers
+ 399
53 CoreFoundation 0x03b6a3b4 __CFRunLoopRun + 1076
54 CoreFoundation 0x03b69b33 CFRunLoopRunSpecific + 467
55 CoreFoundation 0x03b6994b CFRunLoopRunInMode + 123
56 GraphicsServices 0x04fbb9d7 GSEventRunModal + 192
57 GraphicsServices 0x04fbb7fe GSEventRun + 104
58 UIKit 0x0119094b UIApplicationMain + 1225
59 BottlesTonight 0x000030ad main + 141
60 libdyld.dylib 0x037b8725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
This code still works perfectly on iOS6, and I don't see anything wrong
with it. It occurs when clicking a UIButton, this also occurs when
clicking Card.io to allow users to enter card information. Prior to
building my app on iOS7 but running the iOS6 app on iOS7 betas I still
recieved this error but in more places. Now that I built it for iOS7 a few
of the places cleared up themselves but these ones still remain. Any help
would be greatly appreciated, this is all that remains prior to submitting
for iOS7.

Using radio button to set cookie preferences?

Using radio button to set cookie preferences?

I have these 4 radio buttons in which i am submitting to a
validatepreferences.php which is the php code below however i am
struggling to understand why when i click submit nothing is going through
the if statement therefore not giving me my cookie in which to change
images based on user input
<input type="radio" name="radioimage"><img class="prefimage"
src="../images/image1.jpg">
<br>
<input type="radio" name="radioimage"><img
class="prefimage" src="../images/image2.jpg">
<br>
<input type="radio" name="radioimage"><img
class="prefimage" src="../images/image3.jpg">
<br>
<input type="radio" name="radioimage"> No Picture
I think the php code must have an error or my if is not right altough i
cannot see it.
<?php
if(isset($_POST['radioimage'])){
$radioimage = $_POST['radioimage'];
if ($radioimage == "0" || $radioimage == "1" || $radioimage == "2"
|| $radioimage =="3") {
setcookie("image", $radioimage, time()+300);
}
?>

Friendly URL in PHP and htaccess

Friendly URL in PHP and htaccess

How can I change url from this:
http://testblog.com/category.html?cat_id=23
to this :
http://testblog.com/category/lifestyle
?
Any help will be appreciated

Qt 5.0.2 Memory leak on simple qWebView

Qt 5.0.2 Memory leak on simple qWebView

I have a problem with a memory leak happening while having a QWebView
opened on Qt 5.0.2. The only thing I do is I open a QWebWindow with a
simple local webpage. The script calls the server by doing an ajax request
and repeats the action indefinitely. There is no data saved in cache,
localStorage or sessionStorage. The problem is though that the application
takes too much memory even after an hour of running. (over 300Mb).
I'm not sure if this is a qt-related problem or a javascript-related problem.
Here's the code I use:
#include <QWebFrame>
#include <QWebElementCollection>
#include <QNetworkDiskCache>
#include <QDesktopWidget>
#include <QWebHistory>
#include "mainwindow.h"
MainWin::MainWin(QWidget * parent) : QWebView(parent)
{
m_network = new QNetworkAccessManager(this);
m_cache = new QNetworkDiskCache(this);
m_cache->setCacheDirectory(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)
+ "/test");
m_cache->setMaximumCacheSize(0);
m_network->setCache(m_cache);
page()->setNetworkAccessManager(m_network);
page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled,
true); // enable inspector
// local content can access remote urls
page()->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls,
true);
// enable javascript
page()->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
// Plug-ins must be set to be enabled to use plug-ins.
page()->settings()->setAttribute(QWebSettings::PluginsEnabled,true);
// Images are automatically loaded in web pages.
page()->settings()->setAttribute(QWebSettings::AutoLoadImages,true);
page()->settings()->setMaximumPagesInCache(0);
page()->settings()->setObjectCacheCapacities(0,0,0); // causing slight
flicker on refresh
page()->settings()->clearMemoryCaches();
page()->history()->setMaximumItemCount(0);
// enable local storage
page()->settings()->enablePersistentStorage("C:\\data\\");
// hide the vertical scrollbar
page()->mainFrame()->setScrollBarPolicy(Qt::Vertical,
Qt::ScrollBarAlwaysOff);
page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal,
Qt::ScrollBarAlwaysOff);
// Signal is emitted before frame loads any web content:
QObject::connect(page()->mainFrame(),
SIGNAL(javaScriptWindowObjectCleared()),
this, SLOT(addJSObject()));
setUrl(startURL);
initEffects();
}
void MainWin::addJSObject() {
}
/*
* EFFECTS
*/
void MainWin::initEffects() {
resize(500, 300);
move(0, 0); // left top corner
}
void MainWin::resize(int width, int height) {
setGeometry(QRect(this->x(), this->y() - (height - this->height()),
width, height));
}
the HTML:
<html lang="en">
<head>
<title>Details</title>
<script type="text/javascript" src="./js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="./js/connection.js"></script>
</head>
<body>
<div>page loaded: <span id="times">0</span> times</div>
</body>
</html>
and the Javascript:
jQuery(document).ready(function($) {
var counter = 0;
var refreshData;
refreshData = function() {
counter++;
var jData = '{"test":"test"}';
var request = $.ajax({
type: "POST",
url: "http://qt.digia.com/",
dataType: "json",
data: { jsonData: jData },
timeout: 15000, // 15 secs
complete: function(response) {
console.log(response);
delete response;
$('#times').html(counter);
// no need to hide the window, usual behavior
refreshDataTimeout = setTimeout(refreshData, 1000);
}
});
request.onreadystatechange = null;
request.abort = null;
request = null;
delete request;
}
refreshData();
});

Sunday, September 15, 2013

curl usage to get header

curl usage to get header

Why does this not work:
curl -X HEAD http://www.google.com
But these both work just fine:
curl -I http://www.google.com
curl -X GET http://www.google.com

Setting up streamlined ordering with data-driven graphics?

Setting up streamlined ordering with data-driven graphics?

So this is what I'm working on. I work in a print shop that produces
sports jerseys. Once the template is set up, producing the individual
names/numbers on the jerseys is easy. In Adobe Illustrator, I can use
variables and batch processing to automatically process an excel sheet of
names.
However, I would like to streamline this process further. What I'm trying
to create is a webform that clients can use to create the entire order.
Collect contact information, get specifics on the jerseys, and then enter
in each player name, size, and number. From there, I want the data to be
exported to an XML format in a schema that works with what illustrator
wants.
I made a form in Orbeon just to test it out:
http://demo.orbeon.com/orbeon/fr/orbeon/builder/edit/fec0bfc55dbe6042d88b7467f2c600dfb22cc4b2
Right now, I'm really not digging the interface. It just isn't user
friendly. Even then, I wouldn't know how to set up the XML schema in order
to be friendly with Illustrator.
Should I ditch Orbeon and go with something different, or is there an
easier way to get Orbeon working?

Which is faster canvas.drawArc()/drawPath() or canvas.drawBitmap()?

Which is faster canvas.drawArc()/drawPath() or canvas.drawBitmap()?

I have a custom view in which I currently its background using a bitmap in
the onDraw() method. The Bitmap is actually created by the view itself
whenever the onSizeChanged() method is called and typically consists of
drawing some arcs, paths etc into the bitmap and then I use this bitmap in
onDraw(). I did this in the belief that it is more efficient/faster for
the system to draw a Bitmap using Canvas.drawBitmap() than doing each
individual call to drawArc() or drawPath() in onDraw(). Or is it?
The background itself does not change often except if there is a resize or
colour change of one of the Paint objects but the onDraw() method is
called often so am I drawing the background in the most efficient manner?

Jquery autocomplete with coldfusion

Jquery autocomplete with coldfusion

I'm trying to do a simple jquery autocomplete using coldfusion.
Based on Jens great example:
http://www.jensbits.com/2010/03/18/jquery-ui-autocomplete-with-coldfusion/
Here is my html:
<form name="merchantSearch" id="merchantSearch" method="post"
action="/index.cfm/shop.store/">
<input type="text" name="state" id="state"/>
<input type="submit" name="submit" id="submit" value=""
class="searchButton"/>
<input type="hidden" name="merchantID" id="merchantID"/>
</form>
Here is my coldfusion 'source' file:
<cfloop query="request.qMerchants">
<cfset request.merchantStruct = StructNew()>
<cfset request.merchantStruct["merchantID"] =
#request.qMerchants.merchantID#>
<cfset request.altText = altText..."
<cfset request.merchantStruct["label"] =
#request.qMerchants.merchant#&#request.altText#>
<cfset ArrayAppend(request.merchantArray, request.merchantStruct)>
</cfloop>
<cfoutput>
#serializeJSON(request.merchantArray)#
</cfoutput>
And here is my jquery file:
$(document).ready(function(){
$("#state").autocomplete(
"xhr/merchantAutoComplete.cfm",
{
minLength:2,
minchars:2,
autoFill:false,
select:function(event,ui) {
$("#merchantID").val(ui.item.merchantID);
$("#merchant").val(ui.item.merchant);
}
}
);
});
The cf file returns the json formatted data, but it stays as json. The
results end up like:
[
{"label":"AAA 112 pts\/$","merchantID":6},
{"label":"BBB 64 pts\/$","merchantID":62},
{"label":"CCC 48 pts\/$","merchantID":277},
{"label":"DDD 144 pts\/$","merchantID":278},
{"label":"EEE 80 pts\/$","merchantID":279}
]
And selecting one puts the whole json struct in the select box. I assume I
have the right group of jquery, jquery UI, and css files to get anything
back, but I'll post them just to make this really bloated:
<script src="/assets/js/jquery/jquery.autocomplete.js"></script>
<script src="/assets/js/jquery/jquery1.4.2.js"></script>
<link rel="stylesheet" href="/assets/css/jquery.autocomplete.css"
type="text/css" media="screen, projection" />
<script src="/assets/js/jquery/jquery-ui-1.8.2.js"></script>
I'm sure its a 'label/value' issue, but nothing seems to help. Any
suggestions would be awesome..Thanks!! Jon

borders in HTML

borders in HTML

I am new to HTML And CSS. In my CSS file, I have the following:
html {
border-top: 4px solid #000000;
border-bottom: 4px solid #000000;
border-left: 4px solid #000000;
border-right: 4px solid #000000;
margin:0;
padding:0;
}
body {
background: #ffffff;
color: #000000;
line-height: 50px;
font-size: 20px;
font-family: serif;
margin: 0 auto;
padding: 15px 0;
}
.bot-img {
position: relative;
bottom: 0px;
}
When I open the page in Chrome, it looks ok - like so:

When I open the page in Firefox, it looks, like so:

How would I make both match?