setcontext always starts from function line
I am implementing a userthread library. When I try to swap the context
when the yield is called, the swapped function is always starting from the
first line. The program counter is not updated I guess. For Example,
consider there are two Threads, say
T1: {
printf("Inside T1. Yielding to Other \n");
ThreadYield();
MyThreadExit();
}
T2: {
ThreadCreate(t1, 0);
printf("Inside T2. Yielding to Other \n");
ThreadYield();
}
In this case, when I use the setcontext/swapcontext, always the thread
starts from the line 1. So many threads are created and it goes to a
infinite loop. Can anyone tell me what is going wrong
Saturday, 31 August 2013
Java Comparator compareToIgnoreCase
Java Comparator compareToIgnoreCase
I am trying to sort an array of strings using compareToIgnoreCase.
The string contain names ex: Billy Jean
When I try to compare them I get a null pointer exception. I think this is
because of the space between the first and last name. How can I compare
whole name?
Thanks
class CompareStudentNames implements Comparator{
//Sorts the students by name ignoring case.
@Override
public int compare(Object o1, Object o2) {
String name1 = ((Student)o1).getName();
String name2 = ((Student)o2).getName();
return (name1.compareToIgnoreCase(name2));
}
}
I am trying to sort an array of strings using compareToIgnoreCase.
The string contain names ex: Billy Jean
When I try to compare them I get a null pointer exception. I think this is
because of the space between the first and last name. How can I compare
whole name?
Thanks
class CompareStudentNames implements Comparator{
//Sorts the students by name ignoring case.
@Override
public int compare(Object o1, Object o2) {
String name1 = ((Student)o1).getName();
String name2 = ((Student)o2).getName();
return (name1.compareToIgnoreCase(name2));
}
}
How to learn Perl language
How to learn Perl language
what learning resources can u suggest?
do u know any place i can find perl exercises, wich can help to get educated.
with reading material let say on the perl.org. how can i experience,
practice, learn?
so far I've read perl.org registered on linda.com and currently watching
tutorials.
See, the problem is, i donrt have this connection between watching the
lesson, and applying in to the task. when they talk on the video, its
simple, - when trying do to slightly different thing, its totally
different code.
anyway im looking for some exercises may be. anything you can suggest. so
far i have this but not quite utisfied with it
what learning resources can u suggest?
do u know any place i can find perl exercises, wich can help to get educated.
with reading material let say on the perl.org. how can i experience,
practice, learn?
so far I've read perl.org registered on linda.com and currently watching
tutorials.
See, the problem is, i donrt have this connection between watching the
lesson, and applying in to the task. when they talk on the video, its
simple, - when trying do to slightly different thing, its totally
different code.
anyway im looking for some exercises may be. anything you can suggest. so
far i have this but not quite utisfied with it
cakePHP unique email username
cakePHP unique email username
I just need a bit of help with identifying the email of the user which is
also the username in the database, I used the 'isUnique' in the model but
for some reason it is not giving an error message and it still registers
the user please can someone give me a bit of help here is the code...
MODEL
App::uses('AuthComponent','Controller/Component');
class User extends AppModel
{
var $name = 'User';
public $validate = array(
'email' => 'email',
'email' => array(
'required' => array(
'rule' => array('notEmpty'),
'message' => 'Please enter a valid email address for username',
'unique' => array(
'rule' => 'isUnique',
'message' => 'Please enter another email, this one is already taken'
)
)
),
'password' => array(
'required'=> array(
'rule' => array('notEmpty'),
'message' => 'Please enter a valid password',
'rule' => array('minLength','8'),
'message' => 'Please enter minimum 8 characters'
)
)
);
public function beforeSave($options = array()) {
if (isset($this->data[$this->alias]['password'])) {
$this->data[$this->alias]['password'] =
AuthComponent::password($this->data[$this->alias]['password']);
}
return true;
}
}
**CONTROLLER**
<?php
class usersController extends AppController
{
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('add');
}
var $name = 'Users';
public function add()
{
if (!empty($this ->data))
{
$this->User->create();
if ($this->User->save($this->data))
{
$this->Session->setFlash('Thank you for registering');
$this->redirect(array('action'=>'index'));
}
else
{
// Make the password fields blank
unset($this->data['User']['password']);
unset($this->data['User']['confirm_password']);
$this->Session->setFlash('An error occurred, try again!');
}
}
}
function index()
{
}
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirectUrl());
}
$this->Session->setFlash(__('Invalid username or password, try
again'));
}
}
public function logout() {
return $this->redirect($this->Auth->logout());
}
}
VIEW
<h2>End a problem registration</h2>
<p>Please fill out details to register</p>
<?php
echo $this->Form->Create('User',array('action' => 'add'));
echo $this->Form->input('title');
echo $this->Form->input('name');
echo $this->Form->input('surname');
echo $this->Form->input('email');
echo $this->Form->input('password');
echo $this->Form->input('password');
echo $this->Form->end('Register');
I just need a bit of help with identifying the email of the user which is
also the username in the database, I used the 'isUnique' in the model but
for some reason it is not giving an error message and it still registers
the user please can someone give me a bit of help here is the code...
MODEL
App::uses('AuthComponent','Controller/Component');
class User extends AppModel
{
var $name = 'User';
public $validate = array(
'email' => 'email',
'email' => array(
'required' => array(
'rule' => array('notEmpty'),
'message' => 'Please enter a valid email address for username',
'unique' => array(
'rule' => 'isUnique',
'message' => 'Please enter another email, this one is already taken'
)
)
),
'password' => array(
'required'=> array(
'rule' => array('notEmpty'),
'message' => 'Please enter a valid password',
'rule' => array('minLength','8'),
'message' => 'Please enter minimum 8 characters'
)
)
);
public function beforeSave($options = array()) {
if (isset($this->data[$this->alias]['password'])) {
$this->data[$this->alias]['password'] =
AuthComponent::password($this->data[$this->alias]['password']);
}
return true;
}
}
**CONTROLLER**
<?php
class usersController extends AppController
{
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('add');
}
var $name = 'Users';
public function add()
{
if (!empty($this ->data))
{
$this->User->create();
if ($this->User->save($this->data))
{
$this->Session->setFlash('Thank you for registering');
$this->redirect(array('action'=>'index'));
}
else
{
// Make the password fields blank
unset($this->data['User']['password']);
unset($this->data['User']['confirm_password']);
$this->Session->setFlash('An error occurred, try again!');
}
}
}
function index()
{
}
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirectUrl());
}
$this->Session->setFlash(__('Invalid username or password, try
again'));
}
}
public function logout() {
return $this->redirect($this->Auth->logout());
}
}
VIEW
<h2>End a problem registration</h2>
<p>Please fill out details to register</p>
<?php
echo $this->Form->Create('User',array('action' => 'add'));
echo $this->Form->input('title');
echo $this->Form->input('name');
echo $this->Form->input('surname');
echo $this->Form->input('email');
echo $this->Form->input('password');
echo $this->Form->input('password');
echo $this->Form->end('Register');
Background process in android is killed after a phone call or after long time in the background
Background process in android is killed after a phone call or after long
time in the background
Currently i am doing a project where i have to trace the path in the
Google Map. When the app is in background, after long time when i try to
resume the app, everything will be lost.The activity is recreated. Also
when a phone call is received, same thing happens. I have tried using
SharedPreferences. It works only when the app is kept in background for
less time. How can i get rid of this ?
time in the background
Currently i am doing a project where i have to trace the path in the
Google Map. When the app is in background, after long time when i try to
resume the app, everything will be lost.The activity is recreated. Also
when a phone call is received, same thing happens. I have tried using
SharedPreferences. It works only when the app is kept in background for
less time. How can i get rid of this ?
Allocate pointer array without using `new`?
Allocate pointer array without using `new`?
Here is my code:
int *arr1 = new int[size]();
int *arr2 = new int[size]();
int *arr3 = new int[size]();
I know, I know: I should be using std::unique_ptr if I need to use
pointers, but I am required by an assignment to use * arrays (using
"dynamic allocation" - I would use std::vector but that's not allowed
either for some reason).
I know using new is bad practice, so is there a way to use a pointer array
without using that keyword or having to do delete later on?
Here is my code:
int *arr1 = new int[size]();
int *arr2 = new int[size]();
int *arr3 = new int[size]();
I know, I know: I should be using std::unique_ptr if I need to use
pointers, but I am required by an assignment to use * arrays (using
"dynamic allocation" - I would use std::vector but that's not allowed
either for some reason).
I know using new is bad practice, so is there a way to use a pointer array
without using that keyword or having to do delete later on?
using keybinding and javax.swing timer together
using keybinding and javax.swing timer together
i am trying to make an arkanoid clone game using java, can you guys tell
me how to bind keyboards keys using ActionEvent interface and use the
javax.swing.Timer? i wish to use them together. Thank you
i am trying to make an arkanoid clone game using java, can you guys tell
me how to bind keyboards keys using ActionEvent interface and use the
javax.swing.Timer? i wish to use them together. Thank you
Friday, 30 August 2013
PHPMyAdmin field Tables
PHPMyAdmin field Tables
I am wanting build a database for a Chat site register page, the site I
have seen all have ID as the first listed in the field table. Does it
really matter the order the field names are listed in? as the Register
page that I have starts with: Email User Password Gender then 4 questions
that require a check to complete before clicking register, can you also
tell me if the check questions and register need to be in the field table
as well.
I also want to have on the register page Country and then from a drop down
City..
I hope I have explained this ok...
Grant
I am wanting build a database for a Chat site register page, the site I
have seen all have ID as the first listed in the field table. Does it
really matter the order the field names are listed in? as the Register
page that I have starts with: Email User Password Gender then 4 questions
that require a check to complete before clicking register, can you also
tell me if the check questions and register need to be in the field table
as well.
I also want to have on the register page Country and then from a drop down
City..
I hope I have explained this ok...
Grant
Thursday, 29 August 2013
Is there a shortcut for incrementing a value and setting one at the same time?
Is there a shortcut for incrementing a value and setting one at the same
time?
Not an easy question to word.
Basically, is there a way to combine these two statements into one:
value++;
Value2 = Value;
So basically:
Value 2 = value++
But, where it increments value as well.
Can it be done?
time?
Not an easy question to word.
Basically, is there a way to combine these two statements into one:
value++;
Value2 = Value;
So basically:
Value 2 = value++
But, where it increments value as well.
Can it be done?
ImageButton added to webview won't resize
ImageButton added to webview won't resize
I have a WebView that I want to add my own back button to, The webview is
one that has been set up specifically for viewing pdfs in app. I have
added the button and it works but I am unable to resize it or move it
around the screen, and as a result the pdf controls are underneath the
button and unusable. The button layout parameters seem to be something
along these lines (this is not in the code anywhere this is just what it
appears to be )
<ImageButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
/>
Here is the activity
public class PDFview extends Activity {
ImageButton im;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
Intent intent = getIntent();
String LinkTo = intent.getExtras().getString("link");
WebView mWebView= new WebView(this);
im = new ImageButton(this);
im.setImageResource(R.drawable.back);
im.setLayoutParams(new LayoutParams(100,100));
im.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
exitPDF();
}
});
im.setLeft(0);
im.setTop(200);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+LinkTo);
mWebView.addView(im);
setContentView(mWebView);
}
I have a WebView that I want to add my own back button to, The webview is
one that has been set up specifically for viewing pdfs in app. I have
added the button and it works but I am unable to resize it or move it
around the screen, and as a result the pdf controls are underneath the
button and unusable. The button layout parameters seem to be something
along these lines (this is not in the code anywhere this is just what it
appears to be )
<ImageButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
/>
Here is the activity
public class PDFview extends Activity {
ImageButton im;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
Intent intent = getIntent();
String LinkTo = intent.getExtras().getString("link");
WebView mWebView= new WebView(this);
im = new ImageButton(this);
im.setImageResource(R.drawable.back);
im.setLayoutParams(new LayoutParams(100,100));
im.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
exitPDF();
}
});
im.setLeft(0);
im.setTop(200);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+LinkTo);
mWebView.addView(im);
setContentView(mWebView);
}
Wednesday, 28 August 2013
postfix do NOT send sender non-delivery notification but should do
postfix do NOT send sender non-delivery notification but should do
we are running postfix. All works fine but postfix is NOT sending sender
non-delivery notification. Postfix DO send postmaster non-delivery
notification but DO NOT send sender non-delivery notification as you can
see in the log:
Aug 28 16:17:55 lx14 postfix/smtpd[20516]: connect from a.b.c.d[1.2.3.4]
Aug 28 16:17:55 lx14 postfix/smtpd[20516]: 86645768056:
client=a.b.c.d[1.2.3.4], sasl_method=LOGIN, sasl_username=xyz
Aug 28 16:17:55 lx14 postfix/smtpd[20516]: disconnect from a.b.c.d[1.2.3.4]
Aug 28 16:17:55 lx14 postfix/cleanup[20518]: 86645768056: message-id=<msgid>
Aug 28 16:17:55 lx14 postfix/qmgr[22789]: 86645768056:
from=<sender@sender.de>, size=23532, nrcpt=1 (queue active)
Aug 28 16:17:56 lx14 postfix/smtp[20531]: 86645768056:
to=<receiver@receiver.de>,
relay=mail.global.frontbridge.com[216.32.181.178]:25, delay=0.97,
delays=0.4/0/0.45/0.12, dsn=5.7.1, status=bounced (host
mail.global.frontbridge.com[216.32.181.178] said: 550 5.7.1 Service
unavailable; Client host [1.2.3.4] blocked using Blocklist 1, mail from IP
banned; To request removal from this list please forward this message to
delist@messaging.microsoft.com and include your ip address 1.2.3.4 . (in
reply to RCPT TO command))
Aug 28 16:17:56 lx14 postfix/bounce[20532]: 86645768056: postmaster
non-delivery notification: A1139768064
Aug 28 16:17:56 lx14 postfix/qmgr[22789]: 86645768056: removed
Aug 28 16:17:56 lx14 postfix/cleanup[20518]: A1139768064: message-id=<msg2id>
Aug 28 16:17:56 lx14 postfix/qmgr[22789]: A1139768064:
from=<double-bounce@lx14.x.de>, size=2554, nrcpt=1 (queue active)
Aug 28 16:18:01 lx14 postfix/smtp[20531]: A1139768064:
to=<postmaster@x.de>, relay=lx06.x.de[2.3.4.5]:25, delay=5.3,
delays=0/0/0.17/5.2, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as
EF9382700E7)
Aug 28 16:18:01 lx14 postfix/qmgr[22789]: A1139768064: removed
The output of postconf -n is:
2bounce_notice_recipient = postmastert@x.de
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_at_myorigin = yes
append_dot_mydomain = no
biff = no
bounce_notice_recipient = postmaster@x.de
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
inet_interfaces = all
local_destination_recipient_limit = 1
local_recipient_maps = unix:passwd.byname $alias_database
local_transport = local
mail_spool_directory = /var/mail
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
message_size_limit = 0
mydestination = $myhostname, $mydomain
mydomain = lx14.x.de.local
myhostname = lx14.x.de
mynetworks_style = host
myorigin = $myhostname
notify_classes = bounce, delay, policy, protocol, resource, software
recipient_delimiter = +
setgid_group = postdrop
smtpd_banner = $myhostname
smtpd_data_restrictions = reject_multi_recipient_bounce,
reject_unauth_pipelining
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated,
reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname
smtpd_recipient_restrictions = reject_non_fqdn_recipient,
reject_unknown_recipient_domain, permit_mynetworks,
permit_sasl_authenticated, reject_unauth_destination,
reject_unlisted_recipient, check_policy_service inet:127.0.0.1:12525,
check_policy_service inet:127.0.0.1:10023, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_sender_restrictions = reject_non_fqdn_sender,
reject_unknown_sender_domain, permit_mynetworks, permit_sasl_authenticated
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/certificate/x.crt+ca.crt
smtpd_tls_key_file = /etc/certificate/x.key
smtpd_tls_loglevel = 2
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = hash:/etc/postfix/aliases
virtual_gid_maps = static:8
virtual_mailbox_base = /var/mail/virtual
virtual_mailbox_domains = hash:/etc/postfix/domains
virtual_mailbox_limit = 0
virtual_mailbox_maps = hash:/etc/postfix/mailboxes
virtual_minimum_uid = 1001
virtual_transport = virtual
virtual_uid_maps = static:1001
I would be glad when somebody can explain me how to enable sender
non-delivery notification.
Thank you for any help.
Regards
maLLoc
we are running postfix. All works fine but postfix is NOT sending sender
non-delivery notification. Postfix DO send postmaster non-delivery
notification but DO NOT send sender non-delivery notification as you can
see in the log:
Aug 28 16:17:55 lx14 postfix/smtpd[20516]: connect from a.b.c.d[1.2.3.4]
Aug 28 16:17:55 lx14 postfix/smtpd[20516]: 86645768056:
client=a.b.c.d[1.2.3.4], sasl_method=LOGIN, sasl_username=xyz
Aug 28 16:17:55 lx14 postfix/smtpd[20516]: disconnect from a.b.c.d[1.2.3.4]
Aug 28 16:17:55 lx14 postfix/cleanup[20518]: 86645768056: message-id=<msgid>
Aug 28 16:17:55 lx14 postfix/qmgr[22789]: 86645768056:
from=<sender@sender.de>, size=23532, nrcpt=1 (queue active)
Aug 28 16:17:56 lx14 postfix/smtp[20531]: 86645768056:
to=<receiver@receiver.de>,
relay=mail.global.frontbridge.com[216.32.181.178]:25, delay=0.97,
delays=0.4/0/0.45/0.12, dsn=5.7.1, status=bounced (host
mail.global.frontbridge.com[216.32.181.178] said: 550 5.7.1 Service
unavailable; Client host [1.2.3.4] blocked using Blocklist 1, mail from IP
banned; To request removal from this list please forward this message to
delist@messaging.microsoft.com and include your ip address 1.2.3.4 . (in
reply to RCPT TO command))
Aug 28 16:17:56 lx14 postfix/bounce[20532]: 86645768056: postmaster
non-delivery notification: A1139768064
Aug 28 16:17:56 lx14 postfix/qmgr[22789]: 86645768056: removed
Aug 28 16:17:56 lx14 postfix/cleanup[20518]: A1139768064: message-id=<msg2id>
Aug 28 16:17:56 lx14 postfix/qmgr[22789]: A1139768064:
from=<double-bounce@lx14.x.de>, size=2554, nrcpt=1 (queue active)
Aug 28 16:18:01 lx14 postfix/smtp[20531]: A1139768064:
to=<postmaster@x.de>, relay=lx06.x.de[2.3.4.5]:25, delay=5.3,
delays=0/0/0.17/5.2, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as
EF9382700E7)
Aug 28 16:18:01 lx14 postfix/qmgr[22789]: A1139768064: removed
The output of postconf -n is:
2bounce_notice_recipient = postmastert@x.de
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_at_myorigin = yes
append_dot_mydomain = no
biff = no
bounce_notice_recipient = postmaster@x.de
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
inet_interfaces = all
local_destination_recipient_limit = 1
local_recipient_maps = unix:passwd.byname $alias_database
local_transport = local
mail_spool_directory = /var/mail
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
message_size_limit = 0
mydestination = $myhostname, $mydomain
mydomain = lx14.x.de.local
myhostname = lx14.x.de
mynetworks_style = host
myorigin = $myhostname
notify_classes = bounce, delay, policy, protocol, resource, software
recipient_delimiter = +
setgid_group = postdrop
smtpd_banner = $myhostname
smtpd_data_restrictions = reject_multi_recipient_bounce,
reject_unauth_pipelining
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated,
reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname
smtpd_recipient_restrictions = reject_non_fqdn_recipient,
reject_unknown_recipient_domain, permit_mynetworks,
permit_sasl_authenticated, reject_unauth_destination,
reject_unlisted_recipient, check_policy_service inet:127.0.0.1:12525,
check_policy_service inet:127.0.0.1:10023, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_sender_restrictions = reject_non_fqdn_sender,
reject_unknown_sender_domain, permit_mynetworks, permit_sasl_authenticated
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/certificate/x.crt+ca.crt
smtpd_tls_key_file = /etc/certificate/x.key
smtpd_tls_loglevel = 2
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = hash:/etc/postfix/aliases
virtual_gid_maps = static:8
virtual_mailbox_base = /var/mail/virtual
virtual_mailbox_domains = hash:/etc/postfix/domains
virtual_mailbox_limit = 0
virtual_mailbox_maps = hash:/etc/postfix/mailboxes
virtual_minimum_uid = 1001
virtual_transport = virtual
virtual_uid_maps = static:1001
I would be glad when somebody can explain me how to enable sender
non-delivery notification.
Thank you for any help.
Regards
maLLoc
Algorithms for learning user inputs, and for offering suggestions
Algorithms for learning user inputs, and for offering suggestions
I'm searching for an algorithm respectively a method for learning user
actions (inputs) in a certain program, and, based on a built information
base of done user actions, to offer suggestions for future actions to the
user. The information base should be built from the actions of multiple
users using the same software. The user actions are dependent on the order
in which they occur. This means, that a suggestion should be made based on
already done user actions in a session. A session is an abstract time
period, in which the user works with the software.
In my initial approach, I thought of moddeling the user actions in a
directed graph, where each node represents a unique user action instance.
A user action, done for the very first time, generates a new node. The
nodes have a counter representing how often a user did this user action. A
transition from one node to another exists, when a user action is done
after another one (modelling the sequence of user actions). For every
transition, the probability is computed based on the counters of the
subsequent nodes (i.e. nodes, to which there is a transition). There is a
root node as starting point, which directs to all initial nodes (user
actions done first in a session). This could be a (hidden) Markov model,
but I am not sure. It is definitely not a Bayesian network, because it can
be a cyclic graph (desireable).
Are there already methods, algorithms, libraries etc. for this problem? If
not, how is my approach? Any alternatives, better ideas?
I'm searching for an algorithm respectively a method for learning user
actions (inputs) in a certain program, and, based on a built information
base of done user actions, to offer suggestions for future actions to the
user. The information base should be built from the actions of multiple
users using the same software. The user actions are dependent on the order
in which they occur. This means, that a suggestion should be made based on
already done user actions in a session. A session is an abstract time
period, in which the user works with the software.
In my initial approach, I thought of moddeling the user actions in a
directed graph, where each node represents a unique user action instance.
A user action, done for the very first time, generates a new node. The
nodes have a counter representing how often a user did this user action. A
transition from one node to another exists, when a user action is done
after another one (modelling the sequence of user actions). For every
transition, the probability is computed based on the counters of the
subsequent nodes (i.e. nodes, to which there is a transition). There is a
root node as starting point, which directs to all initial nodes (user
actions done first in a session). This could be a (hidden) Markov model,
but I am not sure. It is definitely not a Bayesian network, because it can
be a cyclic graph (desireable).
Are there already methods, algorithms, libraries etc. for this problem? If
not, how is my approach? Any alternatives, better ideas?
to insert line breaks in a file whenever a comma is encountered-Shell script
to insert line breaks in a file whenever a comma is encountered-Shell script
I need to write a shell script to re-format a file by inserting line breaks.
The condition is that, a line break should be inserted when we encounter a
"Comma" in the file.
For example, if the file "delimiter.txt" contains:
this, is a file, that should, be added, with a, line break, when we find,
a comma.
The output should be:
this
is a file
that should
be added
with a
line break
when we find a
a comma.
Can i do this using normal grep? or awk? Please guide me.Thanks :)
I need to write a shell script to re-format a file by inserting line breaks.
The condition is that, a line break should be inserted when we encounter a
"Comma" in the file.
For example, if the file "delimiter.txt" contains:
this, is a file, that should, be added, with a, line break, when we find,
a comma.
The output should be:
this
is a file
that should
be added
with a
line break
when we find a
a comma.
Can i do this using normal grep? or awk? Please guide me.Thanks :)
.NET 3.5 JavaScriptSerializer and DateTimeOffset serialization
.NET 3.5 JavaScriptSerializer and DateTimeOffset serialization
I have this class:
private class SimpleClass
{
public DateTimeOffset Date;
}
And when I try to serialize it by JavaScriptSerializer on .NET 3.5 result
is following JSON:
"{\"Date\":{\"DateTime\":\"\\/Date(1377674408500)\\/\",\"UtcDateTime\":\"\\/Date(1377674408500)\\/\",\"LocalDateTime\":\"\\/Date(1377674408500)\\/\",\"Date\":\"\\/Date(1377640800000)\\/\",\"Day\":28,\"DayOfWeek\":3,\"DayOfYear\":240,\"Hour\":9,\"Millisecond\":500,\"Minute\":20,\"Month\":8,\"Offset\":{\"Ticks\":72000000000,\"Days\":0,\"Hours\":2,\"Milliseconds\":0,\"Minutes\":0,\"Seconds\":0,\"TotalDays\":0.083333333333333329,\"TotalHours\":2,\"TotalMilliseconds\":7200000,\"TotalMinutes\":120,\"TotalSeconds\":7200},\"Second\":8,\"Ticks\":635132784085002695,\"UtcTicks\":635132712085002695,\"TimeOfDay\":{\"Ticks\":336085002695,\"Days\":0,\"Hours\":9,\"Milliseconds\":500,\"Minutes\":20,\"Seconds\":8,\"TotalDays\":0.38898727163773145,\"TotalHours\":9.3356945193055552,\"TotalMilliseconds\":33608500.2695,\"TotalMinutes\":560.14167115833334,\"TotalSeconds\":33608.5002695},\"Year\":2013}}"
And it is not possible to deserialize the result.
When I do the same with .NET 4.0 result is just:
"{\"Date\":\"\\/Date(1377675074146)\\/\"}"
And it is possible to deserialize this result.
This causing me big problem because I have client side which is written in
.net 3.5 and I need to deserialize result on the server side written in
.net 4.
Just to be complete here is the code for serialization and deserialization:
JavaScriptSerializer serializer = new JavaScriptSerializer();
DateTime dt = DateTime.Now;
SimpleClass instance = new SimpleClass();
instance.Date = dt;
string jsonStr = serializer.Serialize(instance);
SimpleClass newInstance = serializer.Deserialize<SimpleClass>(jsonStr);
Thanks for any ideas.
I have this class:
private class SimpleClass
{
public DateTimeOffset Date;
}
And when I try to serialize it by JavaScriptSerializer on .NET 3.5 result
is following JSON:
"{\"Date\":{\"DateTime\":\"\\/Date(1377674408500)\\/\",\"UtcDateTime\":\"\\/Date(1377674408500)\\/\",\"LocalDateTime\":\"\\/Date(1377674408500)\\/\",\"Date\":\"\\/Date(1377640800000)\\/\",\"Day\":28,\"DayOfWeek\":3,\"DayOfYear\":240,\"Hour\":9,\"Millisecond\":500,\"Minute\":20,\"Month\":8,\"Offset\":{\"Ticks\":72000000000,\"Days\":0,\"Hours\":2,\"Milliseconds\":0,\"Minutes\":0,\"Seconds\":0,\"TotalDays\":0.083333333333333329,\"TotalHours\":2,\"TotalMilliseconds\":7200000,\"TotalMinutes\":120,\"TotalSeconds\":7200},\"Second\":8,\"Ticks\":635132784085002695,\"UtcTicks\":635132712085002695,\"TimeOfDay\":{\"Ticks\":336085002695,\"Days\":0,\"Hours\":9,\"Milliseconds\":500,\"Minutes\":20,\"Seconds\":8,\"TotalDays\":0.38898727163773145,\"TotalHours\":9.3356945193055552,\"TotalMilliseconds\":33608500.2695,\"TotalMinutes\":560.14167115833334,\"TotalSeconds\":33608.5002695},\"Year\":2013}}"
And it is not possible to deserialize the result.
When I do the same with .NET 4.0 result is just:
"{\"Date\":\"\\/Date(1377675074146)\\/\"}"
And it is possible to deserialize this result.
This causing me big problem because I have client side which is written in
.net 3.5 and I need to deserialize result on the server side written in
.net 4.
Just to be complete here is the code for serialization and deserialization:
JavaScriptSerializer serializer = new JavaScriptSerializer();
DateTime dt = DateTime.Now;
SimpleClass instance = new SimpleClass();
instance.Date = dt;
string jsonStr = serializer.Serialize(instance);
SimpleClass newInstance = serializer.Deserialize<SimpleClass>(jsonStr);
Thanks for any ideas.
Tuesday, 27 August 2013
Column-Span in ASP.NET MVC View
Column-Span in ASP.NET MVC View
@foreach (var item in Model) {
@if(ViewData["dropDown_"+item.Code] != null){
if (item.Code == "1" || item.Code == "4")
{
<td>
@Html.DropDownList("dropDown_"+item.Code+"_ListName",
(IEnumerable<SelectListItem>)ViewData["dropDown_"+item.Code]
,new { style = "width: 100px; column-span: 2;" })
</td>
}else{
<td>
@Html.DropDownList("dropDown_"+item.Code+"_ListName",
(IEnumerable<SelectListItem>)ViewData["dropDown_"+item.Code]
,new { style = "width: 100px;" })
</td>
<td>
Owner Preference: GREEN
</td>
}
}
}
From the above code, there will be 4 rows of dropdownlist be generated.
The question is how to make the first one and the last one to column span.
Note that I've included column-span:2 in the style list, but it has no
effect nor giving any errors. Please help.
@foreach (var item in Model) {
@if(ViewData["dropDown_"+item.Code] != null){
if (item.Code == "1" || item.Code == "4")
{
<td>
@Html.DropDownList("dropDown_"+item.Code+"_ListName",
(IEnumerable<SelectListItem>)ViewData["dropDown_"+item.Code]
,new { style = "width: 100px; column-span: 2;" })
</td>
}else{
<td>
@Html.DropDownList("dropDown_"+item.Code+"_ListName",
(IEnumerable<SelectListItem>)ViewData["dropDown_"+item.Code]
,new { style = "width: 100px;" })
</td>
<td>
Owner Preference: GREEN
</td>
}
}
}
From the above code, there will be 4 rows of dropdownlist be generated.
The question is how to make the first one and the last one to column span.
Note that I've included column-span:2 in the style list, but it has no
effect nor giving any errors. Please help.
How do I programmatically execute a link button within a FormView with a commandName in ASP.Net?
How do I programmatically execute a link button within a FormView with a
commandName in ASP.Net?
I have a the following linkbutton within an InsertItemTemplate in a
FormView control:
I want to simulate clicking on the button, but when I created an OnClick
event declaratively, and called it, it went to the event handler but did
not execute the Insert Command to insert the record into a database. I
would like to be able to trigger the Insert Command programmtically.
Thanks.
commandName in ASP.Net?
I have a the following linkbutton within an InsertItemTemplate in a
FormView control:
I want to simulate clicking on the button, but when I created an OnClick
event declaratively, and called it, it went to the event handler but did
not execute the Insert Command to insert the record into a database. I
would like to be able to trigger the Insert Command programmtically.
Thanks.
Copy an element class to another
Copy an element class to another
I have following HTML structure. Here's what I'm trying to do:
Click on any .edit class in any .item in the .wrap div, and display the
.list div.
Select an item in .list div, copy the class of the <i> inside the selected
div.
Add the copied class to the <i> which is is in the same class where the
.edit link was clicked.
Problem:
When I click on the item in the .list div, I can find the selected item
class, but I am unable to figure on how to find the class in which the
edit link was clicked.
Here's HTML:
<div class="wrap">
<div class="item">
<div class="icon1"><i class="default"></i>Default</div>
<div class="edit">Change</div>
</div>
<div class="item">
<div class="icon2"><i class="default"></i>Default</div>
<div class="edit">Change</div>
</div>
</div>
<div class="list">
<ul>
<li> <i class="class1"></i>New 1</li>
<li> <i class="class2"></i>New 2</li>
</ul>
</div>
So, In the above example, when I click on the 'Change', I want to select
an item from .list and then copy the class in that item (eg. class1) and
replace that with the class .default.
Here's jQuery:
$('.edit').click(function(e){
$('.list').css({display: 'block'});
});
$('.list ul li').click(function() {
$('.list ul li').removeAttr('class');
$(this).addClass('selected');
var new_class = $(this).children('i').attr('class');
//alert(new_class);
});
Demo: http://jsfiddle.net/hfgsJ/
I have following HTML structure. Here's what I'm trying to do:
Click on any .edit class in any .item in the .wrap div, and display the
.list div.
Select an item in .list div, copy the class of the <i> inside the selected
div.
Add the copied class to the <i> which is is in the same class where the
.edit link was clicked.
Problem:
When I click on the item in the .list div, I can find the selected item
class, but I am unable to figure on how to find the class in which the
edit link was clicked.
Here's HTML:
<div class="wrap">
<div class="item">
<div class="icon1"><i class="default"></i>Default</div>
<div class="edit">Change</div>
</div>
<div class="item">
<div class="icon2"><i class="default"></i>Default</div>
<div class="edit">Change</div>
</div>
</div>
<div class="list">
<ul>
<li> <i class="class1"></i>New 1</li>
<li> <i class="class2"></i>New 2</li>
</ul>
</div>
So, In the above example, when I click on the 'Change', I want to select
an item from .list and then copy the class in that item (eg. class1) and
replace that with the class .default.
Here's jQuery:
$('.edit').click(function(e){
$('.list').css({display: 'block'});
});
$('.list ul li').click(function() {
$('.list ul li').removeAttr('class');
$(this).addClass('selected');
var new_class = $(this).children('i').attr('class');
//alert(new_class);
});
Demo: http://jsfiddle.net/hfgsJ/
Process DataRow by batch of 100 rows
Process DataRow by batch of 100 rows
How would go about this?
code runs like this:
foreach(DataRow row in dataTable.Rows)
{
foreach(DataColumn column in dataTable.Columns)
{
// do something with the rows and the columns by a bunch of 100
}
}
How would go about this?
code runs like this:
foreach(DataRow row in dataTable.Rows)
{
foreach(DataColumn column in dataTable.Columns)
{
// do something with the rows and the columns by a bunch of 100
}
}
Kali linux full network scan, not just gateway IP? [on hold]
Kali linux full network scan, not just gateway IP? [on hold]
at school i have been allowed to try and hack the server, (on the grounds
that i don't destroy everything), I am using my net book which has Kali
Linux installed on it, using Kali Linux i have plugged the net book into
the system using an Ethernet cable, and from there i have tried to
initiate a scan, however when i try to do a scan it will only allow me to
find gateway IP, i was wandering if there is anyway that i can scan and
find the server IP, using any tools that you recommend to install, If i
can that would be great,
Regards Jesse Hayward Haybreaker co.
at school i have been allowed to try and hack the server, (on the grounds
that i don't destroy everything), I am using my net book which has Kali
Linux installed on it, using Kali Linux i have plugged the net book into
the system using an Ethernet cable, and from there i have tried to
initiate a scan, however when i try to do a scan it will only allow me to
find gateway IP, i was wandering if there is anyway that i can scan and
find the server IP, using any tools that you recommend to install, If i
can that would be great,
Regards Jesse Hayward Haybreaker co.
Monday, 26 August 2013
How to use an animated .GIF as a desktop picture for Mountain Lion
How to use an animated .GIF as a desktop picture for Mountain Lion
As the title says.
I have an animated GIF that I would like to set as a desktop picture for
my Mac running Mountain Lion 10.8.4
Thanks for the responces
As the title says.
I have an animated GIF that I would like to set as a desktop picture for
my Mac running Mountain Lion 10.8.4
Thanks for the responces
How is std::function implemented?
How is std::function implemented?
According to the sources I have found, a lambda expression is essentially
implemented by the compiler creating a class with overloaded function call
operator and the referenced variables as members. This suggests that the
size of lambda expressions varies, and given enough references variables
that size can be arbitrarily large.
An std::function should have a fixed size, but it must be able to wrap any
kind of callables, including any lambdas of the same kind. How is it
implemented? If std::function internally uses a pointer to its target,
then what happens, when the std::function instance is copied or moved? Are
there any heap allocations involved?
According to the sources I have found, a lambda expression is essentially
implemented by the compiler creating a class with overloaded function call
operator and the referenced variables as members. This suggests that the
size of lambda expressions varies, and given enough references variables
that size can be arbitrarily large.
An std::function should have a fixed size, but it must be able to wrap any
kind of callables, including any lambdas of the same kind. How is it
implemented? If std::function internally uses a pointer to its target,
then what happens, when the std::function instance is copied or moved? Are
there any heap allocations involved?
What some good compression algroithms for delta syncronization?
What some good compression algroithms for delta syncronization?
When syncing large files over a slow link, it is often useful to use delta
compression in order to reduce the bandwidth used. It is also useful to
compress files as they take up much less space.
However, many compression algorithms have the unwanted side affect of
changing large portions of the compressed output when only a small change
has been made in the source.
So, what are some compression algorithms/utilities which create similar
compressed blobs from similar source files?
When syncing large files over a slow link, it is often useful to use delta
compression in order to reduce the bandwidth used. It is also useful to
compress files as they take up much less space.
However, many compression algorithms have the unwanted side affect of
changing large portions of the compressed output when only a small change
has been made in the source.
So, what are some compression algorithms/utilities which create similar
compressed blobs from similar source files?
OSSEC-HIDS in linux
OSSEC-HIDS in linux
I installed ossec-hids on my server with ubunty10.0. Then i tried towrite
to it log, when i use
sudo ntpdate 0.ru.pool.ntp.org
I added decoder in decoder.xml like
<decoder name="Linux sudo">
<prematch>sudo</prematch>
</decoder>
I created file my_incidents.xml, include it in ossec.conf and add to it:
<group name="Incidents">
<rule id="100001" level="0" noalert="1">
<decoded_as>Linux sudo</decoded_as>
<description>Linux sudo messages grouped</description>
</rule>
<rule id="100002" level="14">
<if_sid>100001</if_sid>
<match>ntpdate</match>
<description>watching for ntpdate</description>
</rule>
</group>
But it doesn't work. What i do wrong?
I installed ossec-hids on my server with ubunty10.0. Then i tried towrite
to it log, when i use
sudo ntpdate 0.ru.pool.ntp.org
I added decoder in decoder.xml like
<decoder name="Linux sudo">
<prematch>sudo</prematch>
</decoder>
I created file my_incidents.xml, include it in ossec.conf and add to it:
<group name="Incidents">
<rule id="100001" level="0" noalert="1">
<decoded_as>Linux sudo</decoded_as>
<description>Linux sudo messages grouped</description>
</rule>
<rule id="100002" level="14">
<if_sid>100001</if_sid>
<match>ntpdate</match>
<description>watching for ntpdate</description>
</rule>
</group>
But it doesn't work. What i do wrong?
How to download a world-wide City-List from OSM?
How to download a world-wide City-List from OSM?
I need a list that contains the 100 biggest cities/towns of every country
in the world. I'd like to have a CSV-File or something that i can easily
read. CSV-File should have the columns: Country-Code(3-letter), Name,
Population, Longitude, Latitude
There are several tools that can extract data from OSM, but i can't find
something to export the largest cities of each country.
Can someone hint me to the right tool, and a good example on how to use
the tool?
I need a list that contains the 100 biggest cities/towns of every country
in the world. I'd like to have a CSV-File or something that i can easily
read. CSV-File should have the columns: Country-Code(3-letter), Name,
Population, Longitude, Latitude
There are several tools that can extract data from OSM, but i can't find
something to export the largest cities of each country.
Can someone hint me to the right tool, and a good example on how to use
the tool?
Adding an offset to the latitude and longitude in iOS
Adding an offset to the latitude and longitude in iOS
I want to add an offset (distance) to the current locations. I googled it
and found using the CLHeading, we will get the trueHeading and
magneticHeading.
Using the following code snippet:
- (void)locationManager:(CLLocationManager *)manager
didUpdateHeading:(CLHeading *)newHeading {
CLLocationDirection true = [newHeading trueHeading];
CLLocationDirection magnetic = [newHeading magneticHeading];
}
Now i want to use this to add an offset to the current location (latitude
and longitude) in the direction i am heading.
Please help me to accomplish this. Thanks in advance.
I want to add an offset (distance) to the current locations. I googled it
and found using the CLHeading, we will get the trueHeading and
magneticHeading.
Using the following code snippet:
- (void)locationManager:(CLLocationManager *)manager
didUpdateHeading:(CLHeading *)newHeading {
CLLocationDirection true = [newHeading trueHeading];
CLLocationDirection magnetic = [newHeading magneticHeading];
}
Now i want to use this to add an offset to the current location (latitude
and longitude) in the direction i am heading.
Please help me to accomplish this. Thanks in advance.
How to add fixed navigation to a theme that doesn't have it?
How to add fixed navigation to a theme that doesn't have it?
I recently bought the Purity theme for one of my clients' site. The theme
has a nice minimal look, but its navigation scrolls with the page.
I currently know HTML5 and CSS but not JavaScript or jQuery, and I am
working alone on this (side) project as a volunteer. So I don't want to
spend a lot of time fixing this. Based on this, what is the best way for
me to make the navigation fixed on this theme?
Requirements of this:
Preserve responsiveness and adaptiveness
Fit multiple rows of links into the navigation on narrower displays (we
have 8 top-level navigation items)
I already asked the theme developer, who said it is beyond the scope of
his support because it requires modifying the CSS of the theme.
The site is at http://gospellifebowie.com. It is still in development and
will likely have changed if you're looking at this question much later.
I recently bought the Purity theme for one of my clients' site. The theme
has a nice minimal look, but its navigation scrolls with the page.
I currently know HTML5 and CSS but not JavaScript or jQuery, and I am
working alone on this (side) project as a volunteer. So I don't want to
spend a lot of time fixing this. Based on this, what is the best way for
me to make the navigation fixed on this theme?
Requirements of this:
Preserve responsiveness and adaptiveness
Fit multiple rows of links into the navigation on narrower displays (we
have 8 top-level navigation items)
I already asked the theme developer, who said it is beyond the scope of
his support because it requires modifying the CSS of the theme.
The site is at http://gospellifebowie.com. It is still in development and
will likely have changed if you're looking at this question much later.
Sunday, 25 August 2013
What is the CSS property that makes a fully enclose it's contents?
What is the CSS property that makes a fully enclose it's contents?
I am using <fieldsets> to group but it always gives me a message in the
IDE saying that the <legend> is missing. I decided to try and simulate the
<fieldset> with a <div>.
.grid-select .group {
border: 1px solid #d9d9d9;
padding: 12px;
-webkit-background-clip: padding-box;
-moz-background-clip: padding-box;
background-clip: padding-box;
-webkit-border-radius: 0.25em;
-moz-border-radius: 0.25em;
border-radius: 0.25em;
margin-bottom: 1.667em;
position: relative;
z-index: 89;
padding-top: 1.667em;
}
This does not work for me as it seems like the does not wrap around the
inside my fieldset at all.
Is there some other property that a <fieldset> has that I don't have?
I am using <fieldsets> to group but it always gives me a message in the
IDE saying that the <legend> is missing. I decided to try and simulate the
<fieldset> with a <div>.
.grid-select .group {
border: 1px solid #d9d9d9;
padding: 12px;
-webkit-background-clip: padding-box;
-moz-background-clip: padding-box;
background-clip: padding-box;
-webkit-border-radius: 0.25em;
-moz-border-radius: 0.25em;
border-radius: 0.25em;
margin-bottom: 1.667em;
position: relative;
z-index: 89;
padding-top: 1.667em;
}
This does not work for me as it seems like the does not wrap around the
inside my fieldset at all.
Is there some other property that a <fieldset> has that I don't have?
Iterative roots of sine
Iterative roots of sine
Is there an analytical function $f(z)$ such that $f(f(z)) = \sin(z)$? More
generally, an analytical function such that f applied $n$ times to $z$
gives $\sin(z)$?
Is there a general theory for answering this question for functions
besides $\sin(z)$?
Is there an analytical function $f(z)$ such that $f(f(z)) = \sin(z)$? More
generally, an analytical function such that f applied $n$ times to $z$
gives $\sin(z)$?
Is there a general theory for answering this question for functions
besides $\sin(z)$?
[ Other - Careers & Employment ] Open Question : What career paths would be best for me?(Qualifications included)?
[ Other - Careers & Employment ] Open Question : What career paths would
be best for me?(Qualifications included)?
GCSE grades: AABBBBBCCC A - Maths A - Art B - English Literature B -
English Language B - French B - Geography B - Additional science C - Core
science C - ICT C - ICT A-level grades (predicted): AABB A - Art A - Maths
B - Physics B - Economics Do you know of good courses at university that
would suit me best?
be best for me?(Qualifications included)?
GCSE grades: AABBBBBCCC A - Maths A - Art B - English Literature B -
English Language B - French B - Geography B - Additional science C - Core
science C - ICT C - ICT A-level grades (predicted): AABB A - Art A - Maths
B - Physics B - Economics Do you know of good courses at university that
would suit me best?
Azure solution architecture - Website or Cloud Service?
Azure solution architecture - Website or Cloud Service?
I'm currently migrating all of our company's applications to the Azure
platform. We have 4 Web Applications and a single Windows Service.
I'm not sure whether i should use deploy each website to azure as a Cloud
Service or as a Website.
I've read some articles about the differences between those two but i
still don't understand why one would choose Cloud Service over Website
when its a small sized company.
In addition to that I came across a suggestion which says to simply get a
Single VM and deploy all applications, including the Windows Service to
that VM and be done with it. What do you think about it?
I'm currently migrating all of our company's applications to the Azure
platform. We have 4 Web Applications and a single Windows Service.
I'm not sure whether i should use deploy each website to azure as a Cloud
Service or as a Website.
I've read some articles about the differences between those two but i
still don't understand why one would choose Cloud Service over Website
when its a small sized company.
In addition to that I came across a suggestion which says to simply get a
Single VM and deploy all applications, including the Windows Service to
that VM and be done with it. What do you think about it?
what is before the virtual base class subobject?
what is before the virtual base class subobject?
My code is:
class A { /* ... */ };
class B : virtual public A { /* ... */ };
class C : virtual public A { /* ... */ };
class X { /* ... */ };
class Y : virtual public X { /* ... */ };
class Z : virtual public X { /* ... */ };
class D : public B, public C, public Y, public Z {
public:
__declspec(noinline) D() { printf("ctor in D\n"); }
__declspec(noinline) virtual ~D() { printf("dtor in D\n"); }
};
int main()
{
D *pd = new D;
delete pd;
return 0;
}
I found that there were 4 bytes spaces before the virtual base class
subobjects. I do not understand what they do.
delete pd;
00161D01 mov eax,dword ptr [edi+4]
00161D04 lea ecx,[edi+4]
00161D07 mov eax,dword ptr [eax+4]
00161D0A add ecx,eax
00161D0C push 1
00161D0E mov eax,dword ptr [ecx]
00161D10 call dword ptr [eax+8]
00161D13 pop edi
; call in delete goes here
00161D20 sub ecx,dword ptr [ecx-4] ; <--
00161D23 jmp D::`scalar deleting destructor' (0161C40h)
__declspec(noinline) D() { printf("ctor in D, %d\n", &val_); }
00161A80 push ebp
00161A81 mov ebp,esp
00161A83 sub esp,8
00161A86 push ebx
00161A87 push esi
00161A88 mov esi,ecx
00161A8A push edi
00161A8B lea ecx,[esi+28h]
00161A8E mov dword ptr [ebp-8],0
00161A95 mov dword ptr [esi+4],163424h
00161A9C mov dword ptr [esi+0Ch],1633F8h
00161AA3 mov dword ptr [esi+14h],1633F8h
00161AAA mov dword ptr [esi+1Ch],163438h
00161AB1 call A::A (01616B0h)
00161AB6 lea ecx,[esi+30h]
00161AB9 call X::X (01618A0h)
00161ABE push ecx
00161ABF mov ecx,esi
00161AC1 call B::B (0161740h)
00161AC6 push ecx
00161AC7 lea ecx,[esi+8]
00161ACA call C::C (01617F0h)
00161ACF push ecx
00161AD0 lea ecx,[esi+10h]
00161AD3 call Y::Y (0161920h)
00161AD8 push ecx
00161AD9 lea ecx,[esi+18h]
00161ADC call Z::Z (01619D0h)
00161AE1 mov edx,esi
00161AE3 mov dword ptr [esi+8],163394h
00161AEA mov eax,dword ptr [edx+4]
00161AED mov dword ptr [edx],1633F0h
00161AF3 mov dword ptr [esi+10h],16338Ch
00161AFA mov dword ptr [esi+18h],163414h
00161B01 mov eax,dword ptr [eax+4]
00161B04 mov dword ptr [eax+edx+4],163404h
00161B0C mov eax,dword ptr [edx+4]
00161B0F mov eax,dword ptr [eax+8]
00161B12 mov dword ptr [eax+edx+4],1633E4h
00161B1A mov eax,dword ptr [edx+4]
00161B1D mov ecx,dword ptr [eax+4]
00161B20 lea eax,[ecx-24h]
00161B23 mov dword ptr [ecx+edx],eax ; <--
00161B26 mov eax,dword ptr [edx+4]
00161B29 mov ecx,dword ptr [eax+8]
00161B2C lea eax,[ecx-2Ch]
00161B2F mov dword ptr [ecx+edx],eax ; <--
00161B32 lea eax,[edx+20h]
00161B35 push eax
00161B36 push 163318h
00161B3B call dword ptr ds:[16303Ch]
; ...
__declspec(noinline) virtual ~D() { printf("dtor in D\n"); }
00161BB0 push ebx
00161BB1 push esi
00161BB2 push edi
00161BB3 mov edi,ecx
00161BB5 push 163370h
00161BBA mov eax,dword ptr [edi-24h]
00161BBD mov dword ptr [edi-28h],1633F0h
00161BC4 mov dword ptr [edi-20h],163394h
00161BCB mov dword ptr [edi-18h],16338Ch
00161BD2 mov dword ptr [edi-10h],163414h
00161BD9 mov eax,dword ptr [eax+4]
00161BDC mov dword ptr [eax+edi-24h],163404h
00161BE4 mov eax,dword ptr [edi-24h]
00161BE7 mov eax,dword ptr [eax+8]
00161BEA mov dword ptr [eax+edi-24h],1633E4h
00161BF2 mov eax,dword ptr [edi-24h]
00161BF5 mov ecx,dword ptr [eax+4]
00161BF8 lea eax,[ecx-24h]
00161BFB mov dword ptr [ecx+edi-28h],eax ; <--
00161BFF mov eax,dword ptr [edi-24h]
00161C02 mov edx,dword ptr [eax+8]
00161C05 lea eax,[edx-2Ch]
00161C08 mov dword ptr [edx+edi-28h],eax ; <--
00161C0C call dword ptr ds:[16303Ch]
00161C12 add esp,4
00161C15 lea ecx,[edi-8]
00161C18 call Z::~Z (0161A20h)
; ...
In both constructor and destructor, the value is 0. The minused value is
exactly the offset to the virtual base class subobject.
VS2012, release mode.
My code is:
class A { /* ... */ };
class B : virtual public A { /* ... */ };
class C : virtual public A { /* ... */ };
class X { /* ... */ };
class Y : virtual public X { /* ... */ };
class Z : virtual public X { /* ... */ };
class D : public B, public C, public Y, public Z {
public:
__declspec(noinline) D() { printf("ctor in D\n"); }
__declspec(noinline) virtual ~D() { printf("dtor in D\n"); }
};
int main()
{
D *pd = new D;
delete pd;
return 0;
}
I found that there were 4 bytes spaces before the virtual base class
subobjects. I do not understand what they do.
delete pd;
00161D01 mov eax,dword ptr [edi+4]
00161D04 lea ecx,[edi+4]
00161D07 mov eax,dword ptr [eax+4]
00161D0A add ecx,eax
00161D0C push 1
00161D0E mov eax,dword ptr [ecx]
00161D10 call dword ptr [eax+8]
00161D13 pop edi
; call in delete goes here
00161D20 sub ecx,dword ptr [ecx-4] ; <--
00161D23 jmp D::`scalar deleting destructor' (0161C40h)
__declspec(noinline) D() { printf("ctor in D, %d\n", &val_); }
00161A80 push ebp
00161A81 mov ebp,esp
00161A83 sub esp,8
00161A86 push ebx
00161A87 push esi
00161A88 mov esi,ecx
00161A8A push edi
00161A8B lea ecx,[esi+28h]
00161A8E mov dword ptr [ebp-8],0
00161A95 mov dword ptr [esi+4],163424h
00161A9C mov dword ptr [esi+0Ch],1633F8h
00161AA3 mov dword ptr [esi+14h],1633F8h
00161AAA mov dword ptr [esi+1Ch],163438h
00161AB1 call A::A (01616B0h)
00161AB6 lea ecx,[esi+30h]
00161AB9 call X::X (01618A0h)
00161ABE push ecx
00161ABF mov ecx,esi
00161AC1 call B::B (0161740h)
00161AC6 push ecx
00161AC7 lea ecx,[esi+8]
00161ACA call C::C (01617F0h)
00161ACF push ecx
00161AD0 lea ecx,[esi+10h]
00161AD3 call Y::Y (0161920h)
00161AD8 push ecx
00161AD9 lea ecx,[esi+18h]
00161ADC call Z::Z (01619D0h)
00161AE1 mov edx,esi
00161AE3 mov dword ptr [esi+8],163394h
00161AEA mov eax,dword ptr [edx+4]
00161AED mov dword ptr [edx],1633F0h
00161AF3 mov dword ptr [esi+10h],16338Ch
00161AFA mov dword ptr [esi+18h],163414h
00161B01 mov eax,dword ptr [eax+4]
00161B04 mov dword ptr [eax+edx+4],163404h
00161B0C mov eax,dword ptr [edx+4]
00161B0F mov eax,dword ptr [eax+8]
00161B12 mov dword ptr [eax+edx+4],1633E4h
00161B1A mov eax,dword ptr [edx+4]
00161B1D mov ecx,dword ptr [eax+4]
00161B20 lea eax,[ecx-24h]
00161B23 mov dword ptr [ecx+edx],eax ; <--
00161B26 mov eax,dword ptr [edx+4]
00161B29 mov ecx,dword ptr [eax+8]
00161B2C lea eax,[ecx-2Ch]
00161B2F mov dword ptr [ecx+edx],eax ; <--
00161B32 lea eax,[edx+20h]
00161B35 push eax
00161B36 push 163318h
00161B3B call dword ptr ds:[16303Ch]
; ...
__declspec(noinline) virtual ~D() { printf("dtor in D\n"); }
00161BB0 push ebx
00161BB1 push esi
00161BB2 push edi
00161BB3 mov edi,ecx
00161BB5 push 163370h
00161BBA mov eax,dword ptr [edi-24h]
00161BBD mov dword ptr [edi-28h],1633F0h
00161BC4 mov dword ptr [edi-20h],163394h
00161BCB mov dword ptr [edi-18h],16338Ch
00161BD2 mov dword ptr [edi-10h],163414h
00161BD9 mov eax,dword ptr [eax+4]
00161BDC mov dword ptr [eax+edi-24h],163404h
00161BE4 mov eax,dword ptr [edi-24h]
00161BE7 mov eax,dword ptr [eax+8]
00161BEA mov dword ptr [eax+edi-24h],1633E4h
00161BF2 mov eax,dword ptr [edi-24h]
00161BF5 mov ecx,dword ptr [eax+4]
00161BF8 lea eax,[ecx-24h]
00161BFB mov dword ptr [ecx+edi-28h],eax ; <--
00161BFF mov eax,dword ptr [edi-24h]
00161C02 mov edx,dword ptr [eax+8]
00161C05 lea eax,[edx-2Ch]
00161C08 mov dword ptr [edx+edi-28h],eax ; <--
00161C0C call dword ptr ds:[16303Ch]
00161C12 add esp,4
00161C15 lea ecx,[edi-8]
00161C18 call Z::~Z (0161A20h)
; ...
In both constructor and destructor, the value is 0. The minused value is
exactly the offset to the virtual base class subobject.
VS2012, release mode.
Saturday, 24 August 2013
Linux: Mount command
Linux: Mount command
I want to map a directory c:\Animal\Cat to /Cat So that when i use Cygwin,
and just type "cd /Cat" from any directory, it goes to /c/Animal/Cat
I have already done "mount -c /", so i have the following when i do the df
command:
Filesystem 1K-blocks Used Available Use% Mounted on
C:/cygwin/bin 488384532 187949036 300435496 39% /usr/bin
C:/cygwin/lib 488384532 187949036 300435496 39% /usr/lib
C:/cygwin 488384532 187949036 300435496 39% /
C: 488384532 187949036 300435496 39% /c
Thanks for helping.
I want to map a directory c:\Animal\Cat to /Cat So that when i use Cygwin,
and just type "cd /Cat" from any directory, it goes to /c/Animal/Cat
I have already done "mount -c /", so i have the following when i do the df
command:
Filesystem 1K-blocks Used Available Use% Mounted on
C:/cygwin/bin 488384532 187949036 300435496 39% /usr/bin
C:/cygwin/lib 488384532 187949036 300435496 39% /usr/lib
C:/cygwin 488384532 187949036 300435496 39% /
C: 488384532 187949036 300435496 39% /c
Thanks for helping.
Doing a Requery on a Form opened with acFormAdd creates a new record
Doing a Requery on a Form opened with acFormAdd creates a new record
Lets asume a user wants to create a new record and to do so he opens a
form. When opening a form with
DoCmd.OpenForm "FormName", acNormal, "", "", acFormAdd, acDialog
Access will open the form with the data pointer set on a new/empty record.
The user can now fill the form but some user actions may require a
Me.Requery in order to take place. If you do so, the form "looses" the
data pointer on the currently created and modified record and jumps to a
new, empty record. Even a Me.Dirty = False before the requery wont prevent
Access from doing so. Im pretty sure this behavior results from the
paramter acFormAdd.
In contrast, opening a form with
DoCmd.OpenForm "FormName", acNormal, "", "WHERE-CLAUSE", acFormEdit, acDialog
resolves the behavior but will only work for existing records.
You can imagine that this unrequested behavior is not what I'm expecting
because it forces me to implement an ugly workaround with closing and
reopening the from when certain conditions are fulfilled.
So, I'm wondering if there is a much easier way that helps me avoid the
behevior described above. I would very much appreciate your assistance!
Lets asume a user wants to create a new record and to do so he opens a
form. When opening a form with
DoCmd.OpenForm "FormName", acNormal, "", "", acFormAdd, acDialog
Access will open the form with the data pointer set on a new/empty record.
The user can now fill the form but some user actions may require a
Me.Requery in order to take place. If you do so, the form "looses" the
data pointer on the currently created and modified record and jumps to a
new, empty record. Even a Me.Dirty = False before the requery wont prevent
Access from doing so. Im pretty sure this behavior results from the
paramter acFormAdd.
In contrast, opening a form with
DoCmd.OpenForm "FormName", acNormal, "", "WHERE-CLAUSE", acFormEdit, acDialog
resolves the behavior but will only work for existing records.
You can imagine that this unrequested behavior is not what I'm expecting
because it forces me to implement an ugly workaround with closing and
reopening the from when certain conditions are fulfilled.
So, I'm wondering if there is a much easier way that helps me avoid the
behevior described above. I would very much appreciate your assistance!
How can I distinguish the base packages from the rest when running rpm -qa?
How can I distinguish the base packages from the rest when running rpm -qa?
I wrote a script which along other tasks connects to a remote server and
pulls a list of all installed packages and installs them, Like so:
echo -e "\e[36m#===# Getting list of packages to install #===#\e[0m"
$ssh root@$srv 'rpm -qa --queryformat "%{NAME}\n" >/tmp/sw.lst'
$scp root@$srv:/tmp/sw.lst /tmp/
np=`cat /tmp/sw.lst |wc -l`
echo -e "\e[36m#===# $np Packages are going to be installed! #===#\e[0m"
/usr/bin/xargs yum -y install < /tmp/sw.lst
My problem is that when it runs through the list it skips many packages
which came with the default installation and i'm trying to save that time,
is that possible?
I wrote a script which along other tasks connects to a remote server and
pulls a list of all installed packages and installs them, Like so:
echo -e "\e[36m#===# Getting list of packages to install #===#\e[0m"
$ssh root@$srv 'rpm -qa --queryformat "%{NAME}\n" >/tmp/sw.lst'
$scp root@$srv:/tmp/sw.lst /tmp/
np=`cat /tmp/sw.lst |wc -l`
echo -e "\e[36m#===# $np Packages are going to be installed! #===#\e[0m"
/usr/bin/xargs yum -y install < /tmp/sw.lst
My problem is that when it runs through the list it skips many packages
which came with the default installation and i'm trying to save that time,
is that possible?
is MVVM javasccript framework suitable for map/geolocation web app?
is MVVM javasccript framework suitable for map/geolocation web app?
As I have plan learning mvvm javascript framework and have an idea to
build simple map-based(i.e.googlemap,openstreetmap,etc) web application,
is it good idea to combine these two? why? or maybe too overkill or just
plain not suitable? Thank you
As I have plan learning mvvm javascript framework and have an idea to
build simple map-based(i.e.googlemap,openstreetmap,etc) web application,
is it good idea to combine these two? why? or maybe too overkill or just
plain not suitable? Thank you
PHP Today's date in form
PHP Today's date in form
I've got several text boxes in a form that are the input to a SQL query. I
need one of the boxes to auto populate with today's date but can't get it
to work :
<td align="left"><INPUT TYPE="text" MAXLENGTH="10" SIZE="10"
NAME="To_Date" id=To_Date value="'.date("m/d/y").'"/></td>
displays the following in the text box:
'.date(
Help is much appreciated!
Cheers,
Rene
I've got several text boxes in a form that are the input to a SQL query. I
need one of the boxes to auto populate with today's date but can't get it
to work :
<td align="left"><INPUT TYPE="text" MAXLENGTH="10" SIZE="10"
NAME="To_Date" id=To_Date value="'.date("m/d/y").'"/></td>
displays the following in the text box:
'.date(
Help is much appreciated!
Cheers,
Rene
Friday, 23 August 2013
P-groups and homomorphisms...
P-groups and homomorphisms...
If $f: G \rightarrow H$ is a surjective homomorphism, $G$ finite, prove
the following:
1) If $P$ is a p-subgroup of $G$, then $f(P)$ is a p-subgroup of $H$.
2) If $S$ is a Sylow-p-subgroup of $G$, then then $f(S)$ is a
Sylow-p-subgroup of $H$.
EDIT: I have been doing this problem for several days now on and off and I
have no idea how to start...I'd rather skip the hints honestly, as I've
been given a few and still am missing a key piece.
If $f: G \rightarrow H$ is a surjective homomorphism, $G$ finite, prove
the following:
1) If $P$ is a p-subgroup of $G$, then $f(P)$ is a p-subgroup of $H$.
2) If $S$ is a Sylow-p-subgroup of $G$, then then $f(S)$ is a
Sylow-p-subgroup of $H$.
EDIT: I have been doing this problem for several days now on and off and I
have no idea how to start...I'd rather skip the hints honestly, as I've
been given a few and still am missing a key piece.
Linear Algebra Hoffman Kunze Chapter 3 example 5!
Linear Algebra Hoffman Kunze Chapter 3 example 5!
Let $R$ be the field of real numbers and let $V$ be the space of all
functions from $R$ into $R$ which are continuous. Define T by
$(Tf)(x)=\int^{x}_{0}f(t)dt$.
Then $T$ is a linear transformation from $V$ into $V$.
The last statement is not true, let $g$ be the zero function ($g(x)=0$,
for any $x$). $(Tg)(x)$ is equal to a class of functions in $V$ of the
form $B_{c}(x)=c$. So, there is no unique assignment for a certain
function from $V$.
Am I wrong somewhere?
Let $R$ be the field of real numbers and let $V$ be the space of all
functions from $R$ into $R$ which are continuous. Define T by
$(Tf)(x)=\int^{x}_{0}f(t)dt$.
Then $T$ is a linear transformation from $V$ into $V$.
The last statement is not true, let $g$ be the zero function ($g(x)=0$,
for any $x$). $(Tg)(x)$ is equal to a class of functions in $V$ of the
form $B_{c}(x)=c$. So, there is no unique assignment for a certain
function from $V$.
Am I wrong somewhere?
MVC4 C# - Authentication over a Link (like Dropbox file sharing with access over a link)?
MVC4 C# - Authentication over a Link (like Dropbox file sharing with
access over a link)?
i want to create a MVC4 Web Application with C# with the function that i
can sharing videos and other files over a Hyperlink Access Control like in
Dropbox or Skydrive.
How can i solve this idea to a great application.
Functions: + Access to a Video, Files and Images over a Link (Hyperlink) +
The Accesslink should be generateted for each user + The should be
automactially expire fr example in about 24h ....
Please can anyone give me a great idea or tips t can solve this idea.
Thank you
access over a link)?
i want to create a MVC4 Web Application with C# with the function that i
can sharing videos and other files over a Hyperlink Access Control like in
Dropbox or Skydrive.
How can i solve this idea to a great application.
Functions: + Access to a Video, Files and Images over a Link (Hyperlink) +
The Accesslink should be generateted for each user + The should be
automactially expire fr example in about 24h ....
Please can anyone give me a great idea or tips t can solve this idea.
Thank you
Can Oracle PL/SQL support short-circuit evaluation?
Can Oracle PL/SQL support short-circuit evaluation?
Given v_ssn_ind INTEGER := IF TRIM(p_ssn) IS NULL THEN 0 ELSE 1 END IF;
I know I can do this: IF v_ssn_ind=1 THEN…
But can I do short-circuit evaluation, ie: IF v_ssn_ind THEN… ?
Given v_ssn_ind INTEGER := IF TRIM(p_ssn) IS NULL THEN 0 ELSE 1 END IF;
I know I can do this: IF v_ssn_ind=1 THEN…
But can I do short-circuit evaluation, ie: IF v_ssn_ind THEN… ?
How to handle multiple Ciphers
How to handle multiple Ciphers
I'm thinking about creating several Ciphers and putting them in a
collection. Mainly for optimization when creating keys and initializing
the Cipher object. They will be used a lot.
Map<Integer, Cipher> encrytors = new HashMap<Integer, Cipher>();
Key key = new SecretKeySpec(secret, KEY_ALGORITHM);
Cipher encrypter = Cipher.getInstance(CIPHER_ALOGORITHM);
encrypter.init(Cipher.ENCRYPT_MODE, key);
encrytors.put(1, encrypter);
Key key2 = new SecretKeySpec(secret2, KEY_ALGORITHM);
Cipher encrypter2 = Cipher.getInstance(CIPHER_ALOGORITHM);
encrypter2.init(Cipher.ENCRYPT_MODE, key2);
encrytors.put(2, encrypter);
Good/bad? How does people handle several different keys and ciphers?
I'm thinking about creating several Ciphers and putting them in a
collection. Mainly for optimization when creating keys and initializing
the Cipher object. They will be used a lot.
Map<Integer, Cipher> encrytors = new HashMap<Integer, Cipher>();
Key key = new SecretKeySpec(secret, KEY_ALGORITHM);
Cipher encrypter = Cipher.getInstance(CIPHER_ALOGORITHM);
encrypter.init(Cipher.ENCRYPT_MODE, key);
encrytors.put(1, encrypter);
Key key2 = new SecretKeySpec(secret2, KEY_ALGORITHM);
Cipher encrypter2 = Cipher.getInstance(CIPHER_ALOGORITHM);
encrypter2.init(Cipher.ENCRYPT_MODE, key2);
encrytors.put(2, encrypter);
Good/bad? How does people handle several different keys and ciphers?
Cartan subalgebra
Cartan subalgebra
Let $g$ be a real semisimple Lie algebra with Cartan decoposition $(l,p)$.
How can we show that a Cartan subspace $a$ of $p$ (Cartan subspace of $p
=$ maximal element in a set that consists of all Lie subalgebras of $g$
that are in $p$) iff $a_{\mathbf C} = a + ia$ (here $a_{\mathbf C}$ is the
complexification of $a$) is a Cartan subspace of $p_{\mathbf C}$.
And we know that every Cartan subspace of $p$ is a commutative Lie
subalgebra of $p$.
Let $g$ be a real semisimple Lie algebra with Cartan decoposition $(l,p)$.
How can we show that a Cartan subspace $a$ of $p$ (Cartan subspace of $p
=$ maximal element in a set that consists of all Lie subalgebras of $g$
that are in $p$) iff $a_{\mathbf C} = a + ia$ (here $a_{\mathbf C}$ is the
complexification of $a$) is a Cartan subspace of $p_{\mathbf C}$.
And we know that every Cartan subspace of $p$ is a commutative Lie
subalgebra of $p$.
Thursday, 22 August 2013
Python Regex : find zip from html content
Python Regex : find zip from html content
i have a email template which is having email context in html formate,
now i wanted to find the zip number from the email html content,
for that i have used regex to search the zip code, the content is like
Formate 1:
helllo this is the mail which will converted in the lead
and here is some addresss which will not be used..
and the
zip: 364001
city: New york
formate 2:
<p><b>Name</b></p><br/>
fname
<p><b>Last Name</b></p><br/>
lname
<p><b>PLZ</b></p><br/>
71392
<p><b>mail</b></p><br/>
heliconia72@mail.com
the code looks like,
regex = r'(?P<zip>Zip:\s*\d\d\d\d\d\d)'
zip_match = re.search(regex, mail_content) # find zip
zip_match.groups()[0]
this is searching for fomate 2 only, how can i write a regex so it work
for both the formate.
i have a email template which is having email context in html formate,
now i wanted to find the zip number from the email html content,
for that i have used regex to search the zip code, the content is like
Formate 1:
helllo this is the mail which will converted in the lead
and here is some addresss which will not be used..
and the
zip: 364001
city: New york
formate 2:
<p><b>Name</b></p><br/>
fname
<p><b>Last Name</b></p><br/>
lname
<p><b>PLZ</b></p><br/>
71392
<p><b>mail</b></p><br/>
heliconia72@mail.com
the code looks like,
regex = r'(?P<zip>Zip:\s*\d\d\d\d\d\d)'
zip_match = re.search(regex, mail_content) # find zip
zip_match.groups()[0]
this is searching for fomate 2 only, how can i write a regex so it work
for both the formate.
couldnt install wireless driver for ubuntu 12.04 in asus laptop
couldnt install wireless driver for ubuntu 12.04 in asus laptop
i could not install the wireless driver in ubuntu 12.04 in Asus x45c
laptop. i already try all the methods in ubuntu forums. please someone
help me..
i could not install the wireless driver in ubuntu 12.04 in Asus x45c
laptop. i already try all the methods in ubuntu forums. please someone
help me..
Table Large Text and Centering
Table Large Text and Centering
I'm trying to learn the TeX language in preparation for my final
engineering project before I graduate, and while I've been able to find
most of the solutions online, I can't seem to find a solution for this
one. I'm trying to format a table so that the Large text is centered
vertically and horizontally and that the table itself is centered on the
page. The Large text, in the format I have it in now, is touching the top
of the hline.
Here's the code:
\documentclass[11pt]{article}
\usepackage{array}
\begin{document}
%\begin{center}
\begin{table}[ht]
\caption{Room 6 - Customer Assessments of Competing Products}
\begin{tabular}{|c|c|c|}\hline
\Large
Customer Requirements & \Large Zhang Company & \Large Wisking Company
\\[2ex] \hline
Standard size & 3 &1\\ \hline
Pushed Manually & 5&3 \\ \hline
Max Weight = 150 & 2& 3 \\ \hline
Lifespan &3&4\\ \hline
Rigid Backrest &3&3\\ \hline
Adjustable&2&2\\ \hline
Easy Operation&1&3\\ \hline
Left-/Right-hand Steering&3&4\\ \hline
Drive Up Inclines&4&4\\ \hline
Non-Obtrusive Motor&4&3\\ \hline
Non-Obtrusive Electrical Components&3&5\\ \hline
Safety&3&5\\ \hline
Braking&5&5\\ \hline
\multicolumn{3}{c}{1 - Poor; 3 - Good; 5 - Excellent}
\end{tabular}
\end{table}
%\end{center}
\end{document}
Much appreciated. Hopefully I've been descriptive enough.
I'm trying to learn the TeX language in preparation for my final
engineering project before I graduate, and while I've been able to find
most of the solutions online, I can't seem to find a solution for this
one. I'm trying to format a table so that the Large text is centered
vertically and horizontally and that the table itself is centered on the
page. The Large text, in the format I have it in now, is touching the top
of the hline.
Here's the code:
\documentclass[11pt]{article}
\usepackage{array}
\begin{document}
%\begin{center}
\begin{table}[ht]
\caption{Room 6 - Customer Assessments of Competing Products}
\begin{tabular}{|c|c|c|}\hline
\Large
Customer Requirements & \Large Zhang Company & \Large Wisking Company
\\[2ex] \hline
Standard size & 3 &1\\ \hline
Pushed Manually & 5&3 \\ \hline
Max Weight = 150 & 2& 3 \\ \hline
Lifespan &3&4\\ \hline
Rigid Backrest &3&3\\ \hline
Adjustable&2&2\\ \hline
Easy Operation&1&3\\ \hline
Left-/Right-hand Steering&3&4\\ \hline
Drive Up Inclines&4&4\\ \hline
Non-Obtrusive Motor&4&3\\ \hline
Non-Obtrusive Electrical Components&3&5\\ \hline
Safety&3&5\\ \hline
Braking&5&5\\ \hline
\multicolumn{3}{c}{1 - Poor; 3 - Good; 5 - Excellent}
\end{tabular}
\end{table}
%\end{center}
\end{document}
Much appreciated. Hopefully I've been descriptive enough.
Python Client/Server send big size files
Python Client/Server send big size files
I am not sure if this topic have been answered or not, if was I am sorry:
I have a simple python script the sends all files in one folder:
Client:
import os,sys, socket, time
def Send(sok,data,end="292929"):
sok.sendall(data + end);
def SendFolder(sok,folder):
if(os.path.isdir(folder)):
files = os.listdir(folder);
os.chdir(folder);
for file_ in files:
Send(sok,file_);#Send the file name to the server
f = open(file_, "rb");
while(True):
d = f.read();#read file
if(d == ""):
break;
Send(sok, d, "");#Send file data
f.close();
time.sleep(0.8);#Problem here!!!!!!!!!!!
Send(sok,"");#Send termination to the server
time.sleep(1);#Wait the server to write the file
os.chdir("..");
Send(sok,"endfile");#let the server know that we finish sending files
else:
Send("endfile")#If not folder send termination
try:
sok1 = socket.socket();
sok1.connect(("192.168.1.121",4444))#local ip
time.sleep(1);
while(True):
Send(sok1,"Enter folder name to download: ");
r = sok1.recv(1024);
SendFolder(sok1,r);
time.sleep(0.5);
except BaseException, e:
print "Error: " + str(e);
os._exit(1);
Server:
import sys,os,socket,time
# receive data
def Receive(sock, end="292929"):
data = "";
while(True):
if(data.endswith(end)):
break;
else:
data = sock.recv(1024);
return data[:-len(end)];#return data less termination
def FolderReceive(sok):
while(True):
r = Receive(sok);# recv filename or folder termination("endfile")
if(r == "endfolder"):
print "Folder receive complete.";
break;
else:
filename = r;#file name
filedata = Receive(sok);# receive file data
f = open(filename,"wb");
f.write(filedata);
f.close();#finish to write the file
print "Received: " + filename;
try:
sok1 = socket.socket();
sok1.bind(("0.0.0.0",4444));
sok1.listen(5);
cl , addr = sok1.accept();#accepts connection
while(True):
r = Receive(cl);
sys.stdout.write("\n" + r);
next = raw_input();
cl.sendall(next);#send folder name to the client
FolderReceive(cl);
except BaseException, e:
print "Error: " + str(e);
os._exit(1);
I know this not best server ever...but is what I know. This just work for
a folder with small files because if I send big files(like 5mb...) it
crashes because the time the client waits for the server is not enough.
So my question is how can I send the files to the server without client
need to wait??or know exactly how many time the client needs to wait for
the server to receive the file?? Some code that does the same but handling
any file size, any help?
I am not sure if this topic have been answered or not, if was I am sorry:
I have a simple python script the sends all files in one folder:
Client:
import os,sys, socket, time
def Send(sok,data,end="292929"):
sok.sendall(data + end);
def SendFolder(sok,folder):
if(os.path.isdir(folder)):
files = os.listdir(folder);
os.chdir(folder);
for file_ in files:
Send(sok,file_);#Send the file name to the server
f = open(file_, "rb");
while(True):
d = f.read();#read file
if(d == ""):
break;
Send(sok, d, "");#Send file data
f.close();
time.sleep(0.8);#Problem here!!!!!!!!!!!
Send(sok,"");#Send termination to the server
time.sleep(1);#Wait the server to write the file
os.chdir("..");
Send(sok,"endfile");#let the server know that we finish sending files
else:
Send("endfile")#If not folder send termination
try:
sok1 = socket.socket();
sok1.connect(("192.168.1.121",4444))#local ip
time.sleep(1);
while(True):
Send(sok1,"Enter folder name to download: ");
r = sok1.recv(1024);
SendFolder(sok1,r);
time.sleep(0.5);
except BaseException, e:
print "Error: " + str(e);
os._exit(1);
Server:
import sys,os,socket,time
# receive data
def Receive(sock, end="292929"):
data = "";
while(True):
if(data.endswith(end)):
break;
else:
data = sock.recv(1024);
return data[:-len(end)];#return data less termination
def FolderReceive(sok):
while(True):
r = Receive(sok);# recv filename or folder termination("endfile")
if(r == "endfolder"):
print "Folder receive complete.";
break;
else:
filename = r;#file name
filedata = Receive(sok);# receive file data
f = open(filename,"wb");
f.write(filedata);
f.close();#finish to write the file
print "Received: " + filename;
try:
sok1 = socket.socket();
sok1.bind(("0.0.0.0",4444));
sok1.listen(5);
cl , addr = sok1.accept();#accepts connection
while(True):
r = Receive(cl);
sys.stdout.write("\n" + r);
next = raw_input();
cl.sendall(next);#send folder name to the client
FolderReceive(cl);
except BaseException, e:
print "Error: " + str(e);
os._exit(1);
I know this not best server ever...but is what I know. This just work for
a folder with small files because if I send big files(like 5mb...) it
crashes because the time the client waits for the server is not enough.
So my question is how can I send the files to the server without client
need to wait??or know exactly how many time the client needs to wait for
the server to receive the file?? Some code that does the same but handling
any file size, any help?
TableRow background shape like button
TableRow background shape like button
I want to set a background to a table row to be like this:
Red hexadecimal numbers in the photo is color code of those area
What should to be background XML file?
Thanks
I want to set a background to a table row to be like this:
Red hexadecimal numbers in the photo is color code of those area
What should to be background XML file?
Thanks
jQuery: filtering dropdown still showing the first element after the filtering
jQuery: filtering dropdown still showing the first element after the
filtering
I am trying to filter dropdown options based on the radiobutton selected.
The filtering is happening just fine, but the problem is, after the
filtering happens, the first element is still being shown.
Check the demo: http://jsfiddle.net/animeshb/7Wqfj/
<div id="step1">
<input class="radiobutton" dataval="PAT" name="TemplateTypes"
type="radio" />
<div>Patient</div>
<input class="radiobutton" dataval="EMPLOYEE" name="TemplateTypes"
type="radio" />
<div>Employee</div>
<input class="radiobutton" dataval="MACHINE" name="TemplateTypes"
type="radio" />
<div>Machine</div>
<select class="selectLDlist" id="ddlAllTemplates" name="AllTemplates">
<option
value="77492|ET_07|EMPLOYEE|08/16/13|08/16/14|Approved|Y|70744">EMPLOYEE</option>
<option
value="70470|testing|PAT|08/16/13|08/16/14|Approved|Y|70428">Patient</option>
<option
value="70472|testing|PAT|08/12/13|08/16/14|Approved|Y|30213">Patient</option>
<option
value="70472|testing|EMPLOYEE|08/13/13|08/16/14|Approved|Y|30213">EMPLOYEE</option>
<option
value="70472|testing|PAT|08/14/13|08/16/14|Approved|Y|30213">Patient</option>
<option
value="70472|testing|MACHINE|08/14/13|08/16/14|Approved|Y|30213">MACHINE</option>
<option
value="70472|testing|PAT|08/14/13|08/16/14|Approved|Y|30213">Patient</option>
</select>
</div>
and the jQuery:
$('.radiobutton').change(function () {
var templateType = $("#step1
input:radio[class=radiobutton]:checked").attr("dataval");
var ddlAllTemplates = $('#ddlAllTemplates');
var options = ddlAllTemplates.find('option');
$('#ddlAllTemplates option').each(function () {
var extract = $(this).attr('value').split('|')[2];
if (extract == templateType) $(this).show();
else $(this).hide();
});
});
filtering
I am trying to filter dropdown options based on the radiobutton selected.
The filtering is happening just fine, but the problem is, after the
filtering happens, the first element is still being shown.
Check the demo: http://jsfiddle.net/animeshb/7Wqfj/
<div id="step1">
<input class="radiobutton" dataval="PAT" name="TemplateTypes"
type="radio" />
<div>Patient</div>
<input class="radiobutton" dataval="EMPLOYEE" name="TemplateTypes"
type="radio" />
<div>Employee</div>
<input class="radiobutton" dataval="MACHINE" name="TemplateTypes"
type="radio" />
<div>Machine</div>
<select class="selectLDlist" id="ddlAllTemplates" name="AllTemplates">
<option
value="77492|ET_07|EMPLOYEE|08/16/13|08/16/14|Approved|Y|70744">EMPLOYEE</option>
<option
value="70470|testing|PAT|08/16/13|08/16/14|Approved|Y|70428">Patient</option>
<option
value="70472|testing|PAT|08/12/13|08/16/14|Approved|Y|30213">Patient</option>
<option
value="70472|testing|EMPLOYEE|08/13/13|08/16/14|Approved|Y|30213">EMPLOYEE</option>
<option
value="70472|testing|PAT|08/14/13|08/16/14|Approved|Y|30213">Patient</option>
<option
value="70472|testing|MACHINE|08/14/13|08/16/14|Approved|Y|30213">MACHINE</option>
<option
value="70472|testing|PAT|08/14/13|08/16/14|Approved|Y|30213">Patient</option>
</select>
</div>
and the jQuery:
$('.radiobutton').change(function () {
var templateType = $("#step1
input:radio[class=radiobutton]:checked").attr("dataval");
var ddlAllTemplates = $('#ddlAllTemplates');
var options = ddlAllTemplates.find('option');
$('#ddlAllTemplates option').each(function () {
var extract = $(this).attr('value').split('|')[2];
if (extract == templateType) $(this).show();
else $(this).hide();
});
});
Wednesday, 21 August 2013
How to display alert when two text field are some text
How to display alert when two text field are some text
I have two UITextField. I want to check UITextField, if two UITextField
are some text show alert or if only one UITextField has some text then go
forward.
I have two UITextField. I want to check UITextField, if two UITextField
are some text show alert or if only one UITextField has some text then go
forward.
Listview adapter's button can not be clicked
Listview adapter's button can not be clicked
I am using listview's adapter, my code,
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"
android:background="@android:color/darker_gray"
android:orientation="vertical" >
<TextView
android:id="@+id/tv_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:text="position1"
android:textSize="20sp"
/>
<Button
android:id="@+id/btn_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:background="@drawable/selector_translate_blue"
android:clickable="true" //Add this is to allow this to get focus,
but the button can not be clicked.
>
</RelativeLayout>
</FrameLayout>
When i remove android:clickable="true", the button can be clicked, but the
RelativeLayout can not focused. How to achieve a similar effect as Google
Plus?
I am using listview's adapter, my code,
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"
android:background="@android:color/darker_gray"
android:orientation="vertical" >
<TextView
android:id="@+id/tv_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:text="position1"
android:textSize="20sp"
/>
<Button
android:id="@+id/btn_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:background="@drawable/selector_translate_blue"
android:clickable="true" //Add this is to allow this to get focus,
but the button can not be clicked.
>
</RelativeLayout>
</FrameLayout>
When i remove android:clickable="true", the button can be clicked, but the
RelativeLayout can not focused. How to achieve a similar effect as Google
Plus?
Mysql Query issue using between
Mysql Query issue using between
I am trying to track inventory based only on install and removal dates and
report what is installed at any given day. Records that are still
installed, do not have a removal date. So I am trying to set the removal
date to Date(now()). But when I add between install_date and removal_date
it only finds records with both dates.
I have an inventory table which contains name, install_date and
removal_date and i have a master_date table which contains all dates from
2012-01-01 to 2014-12-31
Select inventory.name, inventory.install_date,
IFNULL(inventory.removal_date,DATE(NOW())) AS 'Removal Date',
master_date.date FROM inventory, master_date WHERE master_date.date
BETWEEN inventory.install_date AND inventory.removal_date
If I remove the between clause, it sets removal_date to NOW, but continues
to include records where the removal_date is prior to NOW. With the where
clause, it only returns records where removal_date is not null but the
date field is correct.
How can I use NOW in place of a NULL removal_date and return the correct
records?
I am trying to track inventory based only on install and removal dates and
report what is installed at any given day. Records that are still
installed, do not have a removal date. So I am trying to set the removal
date to Date(now()). But when I add between install_date and removal_date
it only finds records with both dates.
I have an inventory table which contains name, install_date and
removal_date and i have a master_date table which contains all dates from
2012-01-01 to 2014-12-31
Select inventory.name, inventory.install_date,
IFNULL(inventory.removal_date,DATE(NOW())) AS 'Removal Date',
master_date.date FROM inventory, master_date WHERE master_date.date
BETWEEN inventory.install_date AND inventory.removal_date
If I remove the between clause, it sets removal_date to NOW, but continues
to include records where the removal_date is prior to NOW. With the where
clause, it only returns records where removal_date is not null but the
date field is correct.
How can I use NOW in place of a NULL removal_date and return the correct
records?
Is there a command line editor that highlights the Stata syntax?
Is there a command line editor that highlights the Stata syntax?
My internet connection is extremely slow and therefore I execute batch
files on the server without GUI, i.e. directly from the terminal. However,
oftentimes I need to make a few changes in the code and a text editor
highlighting Stata syntax would not hurt. Is there one?
My internet connection is extremely slow and therefore I execute batch
files on the server without GUI, i.e. directly from the terminal. However,
oftentimes I need to make a few changes in the code and a text editor
highlighting Stata syntax would not hurt. Is there one?
Run modalbox if in url is mysite.com/#newgoal
Run modalbox if in url is mysite.com/#newgoal
How to create if I have in my url:
mysite.com/#newgoal, my modalbox is displayed?
Currently is displayed if I click button with id="newGoalButton". I need
both options at once.
HTML:
<a href="#newgoal" id="newGoalButton">New Goal</a>
JS:
$(document).ready(function(){
$('#newGoalButton').click(function() {
$(".fullWhite").fadeIn(100);
$(".modal").fadeIn(200);
});
$('.modal .iks').click(function() {
$(".fullWhite").fadeOut(200);
$(".modal").fadeOut(100);
});
});
How to create if I have in my url:
mysite.com/#newgoal, my modalbox is displayed?
Currently is displayed if I click button with id="newGoalButton". I need
both options at once.
HTML:
<a href="#newgoal" id="newGoalButton">New Goal</a>
JS:
$(document).ready(function(){
$('#newGoalButton').click(function() {
$(".fullWhite").fadeIn(100);
$(".modal").fadeIn(200);
});
$('.modal .iks').click(function() {
$(".fullWhite").fadeOut(200);
$(".modal").fadeOut(100);
});
});
ssh-copy-id in one line with password, possible?
ssh-copy-id in one line with password, possible?
I'm trying to setup an automated script in Ansible to set a new server,
and i'm using ssh-copy-id to add the Ansible master server to the new
server's authorized ssh keys.
I created a script which uses ssh-copy-id, but that command is asking for
the new server's password.
Is it possible to give it that password in the same line of calling it so
i can automate it in a script?
I'm trying to setup an automated script in Ansible to set a new server,
and i'm using ssh-copy-id to add the Ansible master server to the new
server's authorized ssh keys.
I created a script which uses ssh-copy-id, but that command is asking for
the new server's password.
Is it possible to give it that password in the same line of calling it so
i can automate it in a script?
Tuesday, 20 August 2013
Is there any way to remove the word dynamically?
Is there any way to remove the word dynamically?
I am using below code to remove word "USER1". on my richtextbox1.
Is there any way to remove the word dynamically?
For example on my richtextbox1, I have below sentence and what ever user
put a word inside my textbox1 "USER1". will be replaced with new input, so
pleace that USER1 is holding on below sentence will be replaced with new
input, so I need something to dynamically to remove the word.
How can I add my textbox1 inside below code to delete user input word
dynamically?
Regex reg = new Regex("(ALTER TABLE .+ REFERENCES\\s+)\"USER1\"[.](.+)");
richTextBox1.Text = reg.Replace(richTextBox1.Text, "$1$2");
After using my code my sentence will be; but USER1 is depends on the user
input and it can be change.
ALTER TABLE "GRADE" ADD CONSTRAINT "GR_ENR_FK" FOREIGN KEY
("STUDENT_ID","SECTION_ID") REFERENCES
"ENROLLMENT"("STUDENT_ID","SECTION_ID") ENABLE;
I am using below code to remove word "USER1". on my richtextbox1.
Is there any way to remove the word dynamically?
For example on my richtextbox1, I have below sentence and what ever user
put a word inside my textbox1 "USER1". will be replaced with new input, so
pleace that USER1 is holding on below sentence will be replaced with new
input, so I need something to dynamically to remove the word.
How can I add my textbox1 inside below code to delete user input word
dynamically?
Regex reg = new Regex("(ALTER TABLE .+ REFERENCES\\s+)\"USER1\"[.](.+)");
richTextBox1.Text = reg.Replace(richTextBox1.Text, "$1$2");
After using my code my sentence will be; but USER1 is depends on the user
input and it can be change.
ALTER TABLE "GRADE" ADD CONSTRAINT "GR_ENR_FK" FOREIGN KEY
("STUDENT_ID","SECTION_ID") REFERENCES
"ENROLLMENT"("STUDENT_ID","SECTION_ID") ENABLE;
How can i change the default gateway?
How can i change the default gateway?
Currently i'm running a FreeBSD 9.1 and the default gateway is already
configured in the rc.conf.
rc.conf
defaultrouter = "10.0.0.1"
But now i want to change the default gateway without rebooting the
systems, is this possible ?
Currently i'm running a FreeBSD 9.1 and the default gateway is already
configured in the rc.conf.
rc.conf
defaultrouter = "10.0.0.1"
But now i want to change the default gateway without rebooting the
systems, is this possible ?
How do I go about debugging a PHP error?
How do I go about debugging a PHP error?
I am coming from .NET to PHP. I am playing around with a long file written
by someone else (called "cryptographp.inc.php"). It builds and returns an
image to the browser.
I want to show the image that the file returns on my Cryptocode/index.php
page--like this:
<?php
include './cryptographp.inc.php';
?>
But when I load the page, firefox returns an error saying
"The image http://localhost/Cryptocode cannot be displayed because it
contains errors"
How would I go about debugging an error like this in PHP? I am used to
stepping through code in visual studio. What techniques would people use
in the PHP world?
I am coming from .NET to PHP. I am playing around with a long file written
by someone else (called "cryptographp.inc.php"). It builds and returns an
image to the browser.
I want to show the image that the file returns on my Cryptocode/index.php
page--like this:
<?php
include './cryptographp.inc.php';
?>
But when I load the page, firefox returns an error saying
"The image http://localhost/Cryptocode cannot be displayed because it
contains errors"
How would I go about debugging an error like this in PHP? I am used to
stepping through code in visual studio. What techniques would people use
in the PHP world?
Unit Testing Frameworks for Visual Studio 2012 Cons/Pros
Unit Testing Frameworks for Visual Studio 2012 Cons/Pros
I want to get started on Unit Testing in C++ (pure C++, not .NET), since I
have never done it before. Always used assert and cout. So far, the only
good Question with detailed answers, I have found is Choosing a C++ unit
testing tool/framework, but it is dated to 2008.
I would like to hear some opinions about currently available C++ Unit
Testing compatible with Visual Studio 2012. What are their Cons and Pros ?
How easy/hard to learn them(i.e availability of learning materials) ? How
Popular they are ? Are they being actively developed, supported ?
There are several frameworks that I am aware of: Google's Testing
Framework, Boost Testing Lib.
(Also, in addition to Visual Studio, I use Intel Parallel Studio XE 2013,
primarily for static analysis)
I want to get started on Unit Testing in C++ (pure C++, not .NET), since I
have never done it before. Always used assert and cout. So far, the only
good Question with detailed answers, I have found is Choosing a C++ unit
testing tool/framework, but it is dated to 2008.
I would like to hear some opinions about currently available C++ Unit
Testing compatible with Visual Studio 2012. What are their Cons and Pros ?
How easy/hard to learn them(i.e availability of learning materials) ? How
Popular they are ? Are they being actively developed, supported ?
There are several frameworks that I am aware of: Google's Testing
Framework, Boost Testing Lib.
(Also, in addition to Visual Studio, I use Intel Parallel Studio XE 2013,
primarily for static analysis)
javascript click and IE
javascript click and IE
I have the following setup:
Js prototype lib.
A span that has an onclick event that calls a function sort of the following:
function onClickSuperFunction() {
alert('Super function called');
// Bla bla bla many epic things
if (someCondition) {
$('selectorForSameSpan').click();
// selectorForSameSpan is a selector for the element that was
originally clicked (first click is manunal)
}
}
In all browsers except IE, everything is ok. In IE the click is not fired
(is fired when I manually click the element, but not the event from "if").
Also, if I change the selector and simulate a click on any other element (
$('anyOtherSpanForExample')), it works ok (the function is called).
So... does IE prevent automatic clicks on the same element? Maybe an
antispam something? And... any work-around? I really need that click.
Note: Same thing happens if I use the prototype "fire".
Thank you for your help.
I have the following setup:
Js prototype lib.
A span that has an onclick event that calls a function sort of the following:
function onClickSuperFunction() {
alert('Super function called');
// Bla bla bla many epic things
if (someCondition) {
$('selectorForSameSpan').click();
// selectorForSameSpan is a selector for the element that was
originally clicked (first click is manunal)
}
}
In all browsers except IE, everything is ok. In IE the click is not fired
(is fired when I manually click the element, but not the event from "if").
Also, if I change the selector and simulate a click on any other element (
$('anyOtherSpanForExample')), it works ok (the function is called).
So... does IE prevent automatic clicks on the same element? Maybe an
antispam something? And... any work-around? I really need that click.
Note: Same thing happens if I use the prototype "fire".
Thank you for your help.
Working with PieChartModel in JSF 1.2
Working with PieChartModel in JSF 1.2
I am developing an appication for multiple ping testing to different Ips
at a time. That is working fine but I have two issues described below
I have to display that in the Pie chart format. When I run multiple ping
page and get the response back I could see the Pie chart created but not
everytime, sometime its blank not even Pie Diagram is created.
Now If the Pie chart gets created and suppose in the same session I use
another file with set of different Ips and run the MultiplePingTesting
page, I could see the same earlier pie diagram with no updates as per the
new file. I know its a very silly question but i am not able to get way
out of it.
It would be great if someone can help me out.
Bean Class
package My_Package;
import java.io.Serializable;
import org.primefaces.model.chart.PieChartModel;
public class ChartBean implements Serializable {
private PieChartModel pieModel;
public ChartBean() {
createPieModel();
}
public PieChartModel getPieModel() {
return pieModel;
}
private void createPieModel() {
pieModel = new PieChartModel();
pieModel.set("Connected",MultiplePingTesting.i);
pieModel.set("Not Connected",MultiplePingTesting.j);
//MultiplePingTesting is the class which is responsible for multiple
ping testing
}
}
XHTML code
<p:pieChart id="sample" value="#{ChartBean.pieModel}" legendPosition="w"
title="Sample Pie Chart" dataFormat= "Value"
style="width:400px;height:300px" />
I am developing an appication for multiple ping testing to different Ips
at a time. That is working fine but I have two issues described below
I have to display that in the Pie chart format. When I run multiple ping
page and get the response back I could see the Pie chart created but not
everytime, sometime its blank not even Pie Diagram is created.
Now If the Pie chart gets created and suppose in the same session I use
another file with set of different Ips and run the MultiplePingTesting
page, I could see the same earlier pie diagram with no updates as per the
new file. I know its a very silly question but i am not able to get way
out of it.
It would be great if someone can help me out.
Bean Class
package My_Package;
import java.io.Serializable;
import org.primefaces.model.chart.PieChartModel;
public class ChartBean implements Serializable {
private PieChartModel pieModel;
public ChartBean() {
createPieModel();
}
public PieChartModel getPieModel() {
return pieModel;
}
private void createPieModel() {
pieModel = new PieChartModel();
pieModel.set("Connected",MultiplePingTesting.i);
pieModel.set("Not Connected",MultiplePingTesting.j);
//MultiplePingTesting is the class which is responsible for multiple
ping testing
}
}
XHTML code
<p:pieChart id="sample" value="#{ChartBean.pieModel}" legendPosition="w"
title="Sample Pie Chart" dataFormat= "Value"
style="width:400px;height:300px" />
php - deprecated function ereg_replace() is deprecated in php
php - deprecated function ereg_replace() is deprecated in php
I Just Bought a PHP Script That Was Working Properly Till I Test It ON my
Web Server. When I ran THe Script It looks Great But When I click the
Sub-Category of my Website I gives me This Error "Deprecated: Function
ereg_replace() is deprecated in /home/*/public_html/includes/functions.php
on line 61"
My Script is Look LIke This:
<?php function generate_link($pagename,$c='',$k='',$q='',$p='',$ktext=''){
if (USE_SEO_URLS==true){
switch ($pagename){
case 'category.php':
$result ='c' . $c . '.html';
break;
case 'questions.php':
$result ='q-c' . $c . '-k' . $k . '-p' . $p . '-' .
str_replace(" ","-",$ktext) . '.html';
break;
case 'answer.php':
$result ='a' . $q . '-c' . $c . '-k' . $k . '.html';
break;
}
}
else {
switch ($pagename){
case 'category.php':
$result ='category.php?c=' . $c;
break;
case 'questions.php':
$result ='questions.php?c=' . $c . '&k=' . $k . '&p=' . $p .
'&ktext=' . str_replace(" ","-",$ktext) ;
break;
case 'answer.php':
$result ='answer.php?k=' . $k . '&c=' . $c . '&id=' . $q ;
break;
}
}
return $result; } function db_prepare_input($string) {
if (is_string($string)) {
return trim(sanitize_string(stripslashes($string)));
} elseif (is_array($string)) {
reset($string);
while (list($key, $value) = each($string)) {
$string[$key] = db_prepare_input($value);
}
return $string;
} else {
return $string;
} } function sanitize_string($string) {
$string = ereg_replace(' +', ' ', trim($string));
return preg_replace("/[<>]/", '_', $string);}?>
Sorry , My Code Is also Not Proper Formatted. I face Great Problem When I
post this Question Stackoverflow. Any Help Is appreciated. The Error Is
Occur in Line 61. I am New in PHP. I check, There is ereg and preg Both
Functions are present. please help me.. Thanks
I Just Bought a PHP Script That Was Working Properly Till I Test It ON my
Web Server. When I ran THe Script It looks Great But When I click the
Sub-Category of my Website I gives me This Error "Deprecated: Function
ereg_replace() is deprecated in /home/*/public_html/includes/functions.php
on line 61"
My Script is Look LIke This:
<?php function generate_link($pagename,$c='',$k='',$q='',$p='',$ktext=''){
if (USE_SEO_URLS==true){
switch ($pagename){
case 'category.php':
$result ='c' . $c . '.html';
break;
case 'questions.php':
$result ='q-c' . $c . '-k' . $k . '-p' . $p . '-' .
str_replace(" ","-",$ktext) . '.html';
break;
case 'answer.php':
$result ='a' . $q . '-c' . $c . '-k' . $k . '.html';
break;
}
}
else {
switch ($pagename){
case 'category.php':
$result ='category.php?c=' . $c;
break;
case 'questions.php':
$result ='questions.php?c=' . $c . '&k=' . $k . '&p=' . $p .
'&ktext=' . str_replace(" ","-",$ktext) ;
break;
case 'answer.php':
$result ='answer.php?k=' . $k . '&c=' . $c . '&id=' . $q ;
break;
}
}
return $result; } function db_prepare_input($string) {
if (is_string($string)) {
return trim(sanitize_string(stripslashes($string)));
} elseif (is_array($string)) {
reset($string);
while (list($key, $value) = each($string)) {
$string[$key] = db_prepare_input($value);
}
return $string;
} else {
return $string;
} } function sanitize_string($string) {
$string = ereg_replace(' +', ' ', trim($string));
return preg_replace("/[<>]/", '_', $string);}?>
Sorry , My Code Is also Not Proper Formatted. I face Great Problem When I
post this Question Stackoverflow. Any Help Is appreciated. The Error Is
Occur in Line 61. I am New in PHP. I check, There is ereg and preg Both
Functions are present. please help me.. Thanks
Monday, 19 August 2013
How to assign CSS properties to aside tag
How to assign CSS properties to aside tag
I am trying to change the font family of an aside tag. I created the
following section in my css file -
.instruction {
color: brown;
font: verdana;
}
and assigned aside, class = instruction. But it does not work. I have also
tried using aside as an element in CSS to assign the properties like asign
{property: value;}, but no effect.
But if I only use color property, then it works. So is there any issue
with assigning font family and related properties to aside tag? I am using
Chrome 28.
I am trying to change the font family of an aside tag. I created the
following section in my css file -
.instruction {
color: brown;
font: verdana;
}
and assigned aside, class = instruction. But it does not work. I have also
tried using aside as an element in CSS to assign the properties like asign
{property: value;}, but no effect.
But if I only use color property, then it works. So is there any issue
with assigning font family and related properties to aside tag? I am using
Chrome 28.
Why do browsers not render pictures in native pixel density on retina display?
Why do browsers not render pictures in native pixel density on retina
display?
It seems to me that browsers (Chrome, Safari, Firefox) on my retina
Macbook Pro do not render any pictures at native pixel density. For
example, when I open an image from google images and then download that
same image and open it in preview, that same image is smaller and more
dense in Preview than it is in my browser. This seems to suggest that
there is a discrepancy in pixel scaling between the two applications. Can
this be fixed for the browser?
display?
It seems to me that browsers (Chrome, Safari, Firefox) on my retina
Macbook Pro do not render any pictures at native pixel density. For
example, when I open an image from google images and then download that
same image and open it in preview, that same image is smaller and more
dense in Preview than it is in my browser. This seems to suggest that
there is a discrepancy in pixel scaling between the two applications. Can
this be fixed for the browser?
RowDataBound Object Not Set to an Instance of an Object
RowDataBound Object Not Set to an Instance of an Object
I have a gridview that works fine, but gives me the error "Object Not Set
to An Instance of An Object when Edit Clicked.
I believed is because my labels in my gridview are null when in edit mode
and this is what causes the problem , but I have no idea how to solve
this.
<asp:BoundField DataField="Received" HeaderText="Received"
SortExpression="Received"
ReadOnly="true">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField HeaderText="Complete"
SortExpression="Complete">
<ItemTemplate>
<asp:Label ID="lblComplete" runat="server"
Text='<%# Bind("Complete") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:BoundField DataField="TransTime"
HeaderText="Trans. Time" SortExpression="TransTime"
ReadOnly="true">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="lbClose" runat="server"
CausesValidation="False"
CommandName="CloseClicked" Text ="Close"
OnClick="CloseClick_Click">Close</asp:LinkButton>
<asp:LinkButton ID="lbEdit" runat="server"
CausesValidation="False" CommandName="EditRow"
Text =""
OnClick="Edit_Click" CommandArgument='<%#
Eval("TicketId")%>'>Edit</asp:LinkButton>
<asp:LinkButton ID="lbDelete" runat="server"
CausesValidation="False"
CommandName="DeleteRow" Text =""
OnClick="Delete_Click">Delete
</asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="lbUpdate" runat="server"
CausesValidation="True"
CommandName="UpdateRow"
ForeColor="White" Text="Update"
CommandArgument='<%#
Eval("TicketId")%>'></asp:LinkButton>
<asp:LinkButton ID="lbCancel" runat="server"
CausesValidation="False"
CommandName="CancelUpdate"
ForeColor="White" CommandArgument='<%#
Eval("TicketId")%>'
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<FooterStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#999999" />
/>
</asp:GridView>
RowCommand
protected void gvData_RowCommand(object sender,
GridViewCommandEventArgs e)
{
if (e.CommandName == "EditRow")
{
//This enables the EditTemplate
int rowindex = ((GridViewRow)
((LinkButton)e.CommandSource).NamingContainer).RowIndex;
gvData.EditIndex = rowindex; //Enables the edit row in
gridview
}
}
I get the error in lbClose.Enabled
protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[0].Visible = false;
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lbClose = (LinkButton)e.Row.Cells[5].FindControl("lbClose");
LinkButton lbEdit = (LinkButton)e.Row.Cells[5].FindControl("lbEdit");
LinkButton lbDelete = (LinkButton)e.Row.Cells[5].FindControl("lbDelete");
var lblTrans = (Label)e.Row.FindControl("lblTrans");
var lblComplete = (Label)e.Row.FindControl("lblComplete");
if (e.Row.Cells[3].Text == "")
{
lbClose.Enabled = true; //Error Here
lbEdit.Enabled = true;
lbDelete.Enabled = true;
}
else
{
lbClose.Enabled = false;
}
}
}
I have a gridview that works fine, but gives me the error "Object Not Set
to An Instance of An Object when Edit Clicked.
I believed is because my labels in my gridview are null when in edit mode
and this is what causes the problem , but I have no idea how to solve
this.
<asp:BoundField DataField="Received" HeaderText="Received"
SortExpression="Received"
ReadOnly="true">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField HeaderText="Complete"
SortExpression="Complete">
<ItemTemplate>
<asp:Label ID="lblComplete" runat="server"
Text='<%# Bind("Complete") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:BoundField DataField="TransTime"
HeaderText="Trans. Time" SortExpression="TransTime"
ReadOnly="true">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="lbClose" runat="server"
CausesValidation="False"
CommandName="CloseClicked" Text ="Close"
OnClick="CloseClick_Click">Close</asp:LinkButton>
<asp:LinkButton ID="lbEdit" runat="server"
CausesValidation="False" CommandName="EditRow"
Text =""
OnClick="Edit_Click" CommandArgument='<%#
Eval("TicketId")%>'>Edit</asp:LinkButton>
<asp:LinkButton ID="lbDelete" runat="server"
CausesValidation="False"
CommandName="DeleteRow" Text =""
OnClick="Delete_Click">Delete
</asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="lbUpdate" runat="server"
CausesValidation="True"
CommandName="UpdateRow"
ForeColor="White" Text="Update"
CommandArgument='<%#
Eval("TicketId")%>'></asp:LinkButton>
<asp:LinkButton ID="lbCancel" runat="server"
CausesValidation="False"
CommandName="CancelUpdate"
ForeColor="White" CommandArgument='<%#
Eval("TicketId")%>'
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<FooterStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#999999" />
/>
</asp:GridView>
RowCommand
protected void gvData_RowCommand(object sender,
GridViewCommandEventArgs e)
{
if (e.CommandName == "EditRow")
{
//This enables the EditTemplate
int rowindex = ((GridViewRow)
((LinkButton)e.CommandSource).NamingContainer).RowIndex;
gvData.EditIndex = rowindex; //Enables the edit row in
gridview
}
}
I get the error in lbClose.Enabled
protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[0].Visible = false;
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lbClose = (LinkButton)e.Row.Cells[5].FindControl("lbClose");
LinkButton lbEdit = (LinkButton)e.Row.Cells[5].FindControl("lbEdit");
LinkButton lbDelete = (LinkButton)e.Row.Cells[5].FindControl("lbDelete");
var lblTrans = (Label)e.Row.FindControl("lblTrans");
var lblComplete = (Label)e.Row.FindControl("lblComplete");
if (e.Row.Cells[3].Text == "")
{
lbClose.Enabled = true; //Error Here
lbEdit.Enabled = true;
lbDelete.Enabled = true;
}
else
{
lbClose.Enabled = false;
}
}
}
Hardware for a sharded + redundant MongoDB-environment
Hardware for a sharded + redundant MongoDB-environment
I'm trying to plan a new database-environment from scratch and I'm
wondering how many servers are needed and how much performance they should
provide.
Since I want it to be fast, I'm considering using SSD-memory and loads of
RAM. However, flash-memory is expensive and makes up for the biggest part
of the cost of a server. Thus, the entire system should be set up for
horizontal scaling from the start, so I can add more nodes when I need
more storage/performance.
To get started I'm thinking of using 2 shards, each consisting of a master
and a replica-slave for redundancy. MongoDB-documentation suggests using 1
master and 2 slaves, but I'm afraid that won't be in the available budget,
since each of these servers will be equipped with about 200 GB of RAM and
6x400 GB SSD as Raid 10.
When using shards, it is also suggested using 3 config-servers for
failsafe/high-availability. Same as above, I'm thinking 1 master and 1
slave as a start.
What sort of hardware would you recommend to put the config-servers on?
Should they be somewhat equally performant as the shard-nodes in terms of
cpu/memory/harddisk? Or can I put them on virtualization or on cheaper
hardware?
Does the setup I described even make sense? How about the ratio of RAM vs.
harddisk on the shard-nodes? At the moment it would probably be easier and
cheaper to just put twice the number of discs into 1 shard (1 master, 1
slave) and skip the sharding until I really need it. However (as mentioned
above) - the system should be ready for sharding from the beginning,
because storage-needs can change overnight. Or is it possible to set it
all up, but have it running on 1 shard only for now?
Since I'm only planning to use 2 instead of 3 servers for
high-availability/failsafe I probably need arbiters as well. Do they need
dedicated hardware as well? Or can I use one arbiter in a virtual-mashine
that serves config-servers and shard-nodes? Or is using 3 seperate servers
for redundancy an absolute must in your opinion?
Any insights highly appreciated. Thanks and best regards!
I'm trying to plan a new database-environment from scratch and I'm
wondering how many servers are needed and how much performance they should
provide.
Since I want it to be fast, I'm considering using SSD-memory and loads of
RAM. However, flash-memory is expensive and makes up for the biggest part
of the cost of a server. Thus, the entire system should be set up for
horizontal scaling from the start, so I can add more nodes when I need
more storage/performance.
To get started I'm thinking of using 2 shards, each consisting of a master
and a replica-slave for redundancy. MongoDB-documentation suggests using 1
master and 2 slaves, but I'm afraid that won't be in the available budget,
since each of these servers will be equipped with about 200 GB of RAM and
6x400 GB SSD as Raid 10.
When using shards, it is also suggested using 3 config-servers for
failsafe/high-availability. Same as above, I'm thinking 1 master and 1
slave as a start.
What sort of hardware would you recommend to put the config-servers on?
Should they be somewhat equally performant as the shard-nodes in terms of
cpu/memory/harddisk? Or can I put them on virtualization or on cheaper
hardware?
Does the setup I described even make sense? How about the ratio of RAM vs.
harddisk on the shard-nodes? At the moment it would probably be easier and
cheaper to just put twice the number of discs into 1 shard (1 master, 1
slave) and skip the sharding until I really need it. However (as mentioned
above) - the system should be ready for sharding from the beginning,
because storage-needs can change overnight. Or is it possible to set it
all up, but have it running on 1 shard only for now?
Since I'm only planning to use 2 instead of 3 servers for
high-availability/failsafe I probably need arbiters as well. Do they need
dedicated hardware as well? Or can I use one arbiter in a virtual-mashine
that serves config-servers and shard-nodes? Or is using 3 seperate servers
for redundancy an absolute must in your opinion?
Any insights highly appreciated. Thanks and best regards!
How to add images into grid when GridView scrolled?
How to add images into grid when GridView scrolled?
I have 10k(10000) images want to display into the GridView I am using
below code to get the images from sd card in particular folder.
I have method
public void getFromSdcard() {
File file = new File("/mnt/sdcard/IMG");
if (file.isDirectory()) {
listFile = file.listFiles();
for (int i = 0; i < listFile.length; i++) {
f.add(listFile[i].getAbsolutePath());
}
}
}
and call it to
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid);
getFromSdcard();
GridView imagegrid = (GridView) findViewById(R.id.PhoneImageGrid);
imageAdapter = new ImageAdapter();
imagegrid.setAdapter(imageAdapter);
}
When I have 1k(1000) images the above code works find but not for
10k(10000) images. I got the OutOfMemory error because I am try to get all
the images in one stork.
I am displaying the 9 images into grid at time. So I want to get the
images when grid view scroll. Means first grid display 9 images at the
same time other 9 images loaded into background and display when the
gridview scrolled.
thanks in advance
I have 10k(10000) images want to display into the GridView I am using
below code to get the images from sd card in particular folder.
I have method
public void getFromSdcard() {
File file = new File("/mnt/sdcard/IMG");
if (file.isDirectory()) {
listFile = file.listFiles();
for (int i = 0; i < listFile.length; i++) {
f.add(listFile[i].getAbsolutePath());
}
}
}
and call it to
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid);
getFromSdcard();
GridView imagegrid = (GridView) findViewById(R.id.PhoneImageGrid);
imageAdapter = new ImageAdapter();
imagegrid.setAdapter(imageAdapter);
}
When I have 1k(1000) images the above code works find but not for
10k(10000) images. I got the OutOfMemory error because I am try to get all
the images in one stork.
I am displaying the 9 images into grid at time. So I want to get the
images when grid view scroll. Means first grid display 9 images at the
same time other 9 images loaded into background and display when the
gridview scrolled.
thanks in advance
Sunday, 18 August 2013
jQuery convert URL to parameters across entire site
jQuery convert URL to parameters across entire site
Let's say I have a directory web site and want to display details for
every city in the US. I want the link mysite.com/CA/fairfield to go to a
specialized page on the city Fairfield, CA, which is dynamic.
I know I can read the URL parameters using
window.location.pathname.split("/"). What I'm not getting is how I set up
a single script that monitors any combination of URL parameters on my
site. I don't mean how to actually get the string "CA", but conceptually,
how do I force someone typing in CA/fairfield to go to a certain script so
I can check what they entered?
Let's say I have a directory web site and want to display details for
every city in the US. I want the link mysite.com/CA/fairfield to go to a
specialized page on the city Fairfield, CA, which is dynamic.
I know I can read the URL parameters using
window.location.pathname.split("/"). What I'm not getting is how I set up
a single script that monitors any combination of URL parameters on my
site. I don't mean how to actually get the string "CA", but conceptually,
how do I force someone typing in CA/fairfield to go to a certain script so
I can check what they entered?
One or more packages could not be completely uninstalled
One or more packages could not be completely uninstalled
I have an ASP.NET MVC 4 application. I used NuGet to update all of the
NuGet packages that were installed when I created the application. One of
the packages was Microsoft.Bcl.Build.
After updating these, NuGet displayed the following message at the bottom
of its window:
I have since restarted Visual Studio several times, but the message still
exists. When I checked the installed packages, it did appear that the
updated version (1.0.8) of the package was present.
How can I fix this?
I have an ASP.NET MVC 4 application. I used NuGet to update all of the
NuGet packages that were installed when I created the application. One of
the packages was Microsoft.Bcl.Build.
After updating these, NuGet displayed the following message at the bottom
of its window:
I have since restarted Visual Studio several times, but the message still
exists. When I checked the installed packages, it did appear that the
updated version (1.0.8) of the package was present.
How can I fix this?
Change element CSS style with click of button
Change element CSS style with click of button
I'm trying to toggle the width of a div with a button.
Desired effect would be clicking 'Big' makes the div width 100% and the
button reads 'Small' to reduce the div back to 50%.
Live example - JS Fiddle
HTML
<div class="block">
block 50%
</div>
<button>Big</button>
CSS
.block {
background: green;
width: 50%;
height: 300px;
float: left;
display: block;
color: white;
}
button {
clear: both;
float: left;
margin-top: 30px;
}
I'm trying to toggle the width of a div with a button.
Desired effect would be clicking 'Big' makes the div width 100% and the
button reads 'Small' to reduce the div back to 50%.
Live example - JS Fiddle
HTML
<div class="block">
block 50%
</div>
<button>Big</button>
CSS
.block {
background: green;
width: 50%;
height: 300px;
float: left;
display: block;
color: white;
}
button {
clear: both;
float: left;
margin-top: 30px;
}
Stuck with an equation having 6 unknowns
Stuck with an equation having 6 unknowns
Suppose $a,b,c,d,e,f\in\mathbb{R}$ and satisfy the following equation:
$c^2d^2-2bcde+b^2e^2-2acdf+a^2f^2-2abef=0$
Show that the above equation cannot hold if all of the unknown quantities
$a,b,c,d,e,f$ are nonzero.
I did the following: I rewrote the above equation in 3 equivalent ways:
$(cd-be)^2+(af)^2=2af(cd+be)$
$(af-be)^2+(cd)^2=2cd(af+be)$
$(cd-af)^2+(be)^2=2be(cd+af)$
Since the L.H.S. of the three equations is non-negative, we have
$(af)(cd+be)\geq 0$
$(cd)(af+be)\geq 0$
$(be)(af+cd)\geq 0$
I'm stuck from here. Any help would be appreciated.
Suppose $a,b,c,d,e,f\in\mathbb{R}$ and satisfy the following equation:
$c^2d^2-2bcde+b^2e^2-2acdf+a^2f^2-2abef=0$
Show that the above equation cannot hold if all of the unknown quantities
$a,b,c,d,e,f$ are nonzero.
I did the following: I rewrote the above equation in 3 equivalent ways:
$(cd-be)^2+(af)^2=2af(cd+be)$
$(af-be)^2+(cd)^2=2cd(af+be)$
$(cd-af)^2+(be)^2=2be(cd+af)$
Since the L.H.S. of the three equations is non-negative, we have
$(af)(cd+be)\geq 0$
$(cd)(af+be)\geq 0$
$(be)(af+cd)\geq 0$
I'm stuck from here. Any help would be appreciated.
Hide UIButton title when using autolayout
Hide UIButton title when using autolayout
Hey I'm learning developing in XCode with Storyboard and I have an
UIButton with custom image. Before I developed without Autolayout but then
I read about it and decided to try it. My problem is that the button has a
custom image and it shouldn't display a title, only the image. When I
don't use Autolayout everything works just fine (only image is displayed).
But when I turn Autolayout on, it resizes my picture and pushes it to left
and shows button title next to the image. How can I display only the image
using Autolayout? Has this something to do with intrinsic content size??
Hey I'm learning developing in XCode with Storyboard and I have an
UIButton with custom image. Before I developed without Autolayout but then
I read about it and decided to try it. My problem is that the button has a
custom image and it shouldn't display a title, only the image. When I
don't use Autolayout everything works just fine (only image is displayed).
But when I turn Autolayout on, it resizes my picture and pushes it to left
and shows button title next to the image. How can I display only the image
using Autolayout? Has this something to do with intrinsic content size??
Failed to locate: "CL.exe", Opencv with Visual studio c++ 2010 express program error
Failed to locate: "CL.exe", Opencv with Visual studio c++ 2010 express
program error
sir,
i have tried a lot of tutorials regarding configuring opencv 2.2 or 2.3
with MVS 2010 express c++, i tried also uninstall and reinstall my MVS
2010 to sure that it is working, and i also configured it with opencv,
like creating property sheets(DEBUG & RELEASE) and then set the Additional
dependencies,lbraries,includes and so on and so forth, and when trying to
run a simple program (Like displayin a video), i ALWAYS got this error:
1>------ Build started: Project: wew, Configuration: Debug Win32 ------
1>TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot
find the file specified.
1>
1>
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
pls help me
program error
sir,
i have tried a lot of tutorials regarding configuring opencv 2.2 or 2.3
with MVS 2010 express c++, i tried also uninstall and reinstall my MVS
2010 to sure that it is working, and i also configured it with opencv,
like creating property sheets(DEBUG & RELEASE) and then set the Additional
dependencies,lbraries,includes and so on and so forth, and when trying to
run a simple program (Like displayin a video), i ALWAYS got this error:
1>------ Build started: Project: wew, Configuration: Debug Win32 ------
1>TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot
find the file specified.
1>
1>
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
pls help me
Saturday, 17 August 2013
How to do a npc following a hero JAVA
How to do a npc following a hero JAVA
Hello I made this game and I have an npc and I would like to make him
follow the main hero the hero has the following atributes
int x
int y (theese two are where his location is)
int smerX (where he faces can be -1 to 1)
int smerY
the npc has all theese atributes also now I tried this:
if(x == platno.hero.x || x > platno.npc.x)
{
smerx = -1;
smery = 0;
}
if(x == platno.hero.x || x < platno.npc.x)
{
smerx = 0;
smery = 1;
}
if(y == platno.hero.y || y > platno.npc.y)
{
smerx = 1;
smery = 0;
}
if(y == platno.hero.y || y < platno.npc.y)
{
smerx = 0;
smery = -1;
}
Thanks if your going to help :)
Hello I made this game and I have an npc and I would like to make him
follow the main hero the hero has the following atributes
int x
int y (theese two are where his location is)
int smerX (where he faces can be -1 to 1)
int smerY
the npc has all theese atributes also now I tried this:
if(x == platno.hero.x || x > platno.npc.x)
{
smerx = -1;
smery = 0;
}
if(x == platno.hero.x || x < platno.npc.x)
{
smerx = 0;
smery = 1;
}
if(y == platno.hero.y || y > platno.npc.y)
{
smerx = 1;
smery = 0;
}
if(y == platno.hero.y || y < platno.npc.y)
{
smerx = 0;
smery = -1;
}
Thanks if your going to help :)
Inno Setup add time release to button
Inno Setup add time release to button
Friends add time "Button Next or Install" to get released on the page "Ready"
15 second 15,14,13,12,11,10,9,8,7,6,5,4 time after the button is released
to click example
Friends add time "Button Next or Install" to get released on the page "Ready"
15 second 15,14,13,12,11,10,9,8,7,6,5,4 time after the button is released
to click example
How to implement an AppleScript element (a "one-to-many" relation) of the application class?
How to implement an AppleScript element (a "one-to-many" relation) of the
application class?
Here's what I have:
1) Include the proper "permissions" entries in the 'Info.plist
'Scriptable': YES
'Scripting definition file name': myApp.sdef
2) Include the element "element" tag within a class extension "element" tag:
`<class-extension extends="application" description="The application and
top-level scripting object.">
<!-- various property tags go here -->
<element type="object item" access="r">
<cocoa key="theseObjects"/>
</element>
</class-extension>`
3) Include the element class tag:
<class name="object item" code="Objs" description="Application 'too many'
object collection" plural="object items" inherits="item"> // I don't
believe 'inherits' name is critical for AS to work
<cocoa class="ObjectItem"/>
</class>
4) Include the delegate method that forwards 'NSApplication' scriptability
support to its delegate:
- (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString
*)key {
if ([key isEqualToString:@"theseObjects"]) {
return YES;
}
return NO;
}
5) Create a 'ObjectItem' class that includes an 'objectSpecifier' that
establishes the application as the container class:
- (NSScriptObjectSpecifier *)objectSpecifier {
NSScriptObjectSpecifier *containerRef = nil;
NSScriptObjectSpecifier *specifier = [[NSNameSpecifier alloc]
initWithContainerClassDescription:[NSScriptClassDescription
classDescriptionForClass:[NSApp class]] containerSpecifier:containerRef
key:@"theseObjects" name:@"objects"];
return [specifier autorelease];
}
6) Post the KVO accessor method within the Application's delegate:
- (NSArray *)theseObjects;
{
ObjectItem *thisObject = [[ObjectItem new] autorelease];
NSArray *thisArray = [NSArray arrayWithObject:thisObject];
return thisArray;
}
7) Create an AppleScript that returns objects from my element getter method:
tell application "SpellAnalysis"
get theseObjects
end tell
8) The result: error "The variable objects is not defined." number -2753
from "objects"
9) Pull my hair out
application class?
Here's what I have:
1) Include the proper "permissions" entries in the 'Info.plist
'Scriptable': YES
'Scripting definition file name': myApp.sdef
2) Include the element "element" tag within a class extension "element" tag:
`<class-extension extends="application" description="The application and
top-level scripting object.">
<!-- various property tags go here -->
<element type="object item" access="r">
<cocoa key="theseObjects"/>
</element>
</class-extension>`
3) Include the element class tag:
<class name="object item" code="Objs" description="Application 'too many'
object collection" plural="object items" inherits="item"> // I don't
believe 'inherits' name is critical for AS to work
<cocoa class="ObjectItem"/>
</class>
4) Include the delegate method that forwards 'NSApplication' scriptability
support to its delegate:
- (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString
*)key {
if ([key isEqualToString:@"theseObjects"]) {
return YES;
}
return NO;
}
5) Create a 'ObjectItem' class that includes an 'objectSpecifier' that
establishes the application as the container class:
- (NSScriptObjectSpecifier *)objectSpecifier {
NSScriptObjectSpecifier *containerRef = nil;
NSScriptObjectSpecifier *specifier = [[NSNameSpecifier alloc]
initWithContainerClassDescription:[NSScriptClassDescription
classDescriptionForClass:[NSApp class]] containerSpecifier:containerRef
key:@"theseObjects" name:@"objects"];
return [specifier autorelease];
}
6) Post the KVO accessor method within the Application's delegate:
- (NSArray *)theseObjects;
{
ObjectItem *thisObject = [[ObjectItem new] autorelease];
NSArray *thisArray = [NSArray arrayWithObject:thisObject];
return thisArray;
}
7) Create an AppleScript that returns objects from my element getter method:
tell application "SpellAnalysis"
get theseObjects
end tell
8) The result: error "The variable objects is not defined." number -2753
from "objects"
9) Pull my hair out
Giving an url, that redirected is a url with spaces, to Jsoup leads to an error. How resolve this?
Giving an url, that redirected is a url with spaces, to Jsoup leads to an
error. How resolve this?
Hello I have to parse pages wich URI is resolved by server redirect.
Example:
I have
http://www.juventus.com/wps/poc?uri=wcm:oid:91da6dbb-4089-49c0-a1df-3a56671b7020
that redirected is
http://www.juventus.com/wps/wcm/connect/JUVECOM-IT/news/primavera%20convocati%20villar%20news%2010agosto2013?pragma=no-cache
This is URI of the page that I have to parse. The problem is that redirect
URI contains spaces, here's the code.
String url =
"http://www.juventus.com/wps/poc?uri=wcm:oid:91da6dbb-4089-49c0-a1df-3a56671b7020";
Document doc = Jsoup.connect(url).get();
Element img = doc.select(".juveShareImage").first();
String imgurl = img.absUrl("src");
System.out.println(imgurl);
I get this error at the second line:
Exception in thread "main" org.jsoup.HttpStatusException: HTTP error
fetching URL. Status=404,
URL=http://www.juventus.com/wps/wcm/connect/JUVECOM-IT/news/primavera
convocati villar news 10agosto2013?pragma=no-cache
that contains the redirected url, so this means that JSoup gets the
correct redirected URI. Is there a way to replace the ' ' with %20 so I
can parse with no problem?
Thanks!
error. How resolve this?
Hello I have to parse pages wich URI is resolved by server redirect.
Example:
I have
http://www.juventus.com/wps/poc?uri=wcm:oid:91da6dbb-4089-49c0-a1df-3a56671b7020
that redirected is
http://www.juventus.com/wps/wcm/connect/JUVECOM-IT/news/primavera%20convocati%20villar%20news%2010agosto2013?pragma=no-cache
This is URI of the page that I have to parse. The problem is that redirect
URI contains spaces, here's the code.
String url =
"http://www.juventus.com/wps/poc?uri=wcm:oid:91da6dbb-4089-49c0-a1df-3a56671b7020";
Document doc = Jsoup.connect(url).get();
Element img = doc.select(".juveShareImage").first();
String imgurl = img.absUrl("src");
System.out.println(imgurl);
I get this error at the second line:
Exception in thread "main" org.jsoup.HttpStatusException: HTTP error
fetching URL. Status=404,
URL=http://www.juventus.com/wps/wcm/connect/JUVECOM-IT/news/primavera
convocati villar news 10agosto2013?pragma=no-cache
that contains the redirected url, so this means that JSoup gets the
correct redirected URI. Is there a way to replace the ' ' with %20 so I
can parse with no problem?
Thanks!
How do I copy data from production to the development server in Google App Engine?
How do I copy data from production to the development server in Google App
Engine?
Using appcfg.py download_data does not work without explicitly specifying
a kind which means that I need to manually specify kinds and download all
kinds one by one, and then upload them one by one. Not only that,
download_data does not work with namespaces.
Engine?
Using appcfg.py download_data does not work without explicitly specifying
a kind which means that I need to manually specify kinds and download all
kinds one by one, and then upload them one by one. Not only that,
download_data does not work with namespaces.
How to configure a server for pause and resume downloads?
How to configure a server for pause and resume downloads?
I am working on an iOS application, which needs basically functionality
like µTorrent. I am able to download and upload through the app using a
web service (API) created in PHP.
I get to know that I should also configure my web service and server for
pause and resume the downloads and uploads?
I read somewhere that, If I'll pass the range in headers of the request
through my app, then if server is capable of accept the range then it'll
start the download and upload from when it stopped.
I want to know how I can configure my server to accept the ranges? And
start the upload and download from it last?
I am working on an iOS application, which needs basically functionality
like µTorrent. I am able to download and upload through the app using a
web service (API) created in PHP.
I get to know that I should also configure my web service and server for
pause and resume the downloads and uploads?
I read somewhere that, If I'll pass the range in headers of the request
through my app, then if server is capable of accept the range then it'll
start the download and upload from when it stopped.
I want to know how I can configure my server to accept the ranges? And
start the upload and download from it last?
Too many arguments to `LTrim`
Too many arguments to `LTrim`
I am getting an error in my program.
Too many arguments to Public Function LTrim(str As String) As String.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim fortrim As String
Dim trimed As String
fortrim = TextBox1.Text
trimed = LTrim(fortrim, 3)
' ^^^ '
' error appears here
TextBox2.Text = trimed
Help is appreciated. I can't find a workaround.
I am getting an error in my program.
Too many arguments to Public Function LTrim(str As String) As String.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim fortrim As String
Dim trimed As String
fortrim = TextBox1.Text
trimed = LTrim(fortrim, 3)
' ^^^ '
' error appears here
TextBox2.Text = trimed
Help is appreciated. I can't find a workaround.
Friday, 16 August 2013
How to properly nest ternary operators?
How to properly nest ternary operators?
I know that it is possible to nest ternary operators, and I want to use
them in this case to save time (at least in the future).
I have a variable that will hold one of four values:
"admin"
"edit"
"wadmin"
"wuser"
Each of these is used to determine necessary password lengths based on the
user type, 16, 12, 8, and 8, respectively.
I want PHP to echo each of those numbers based on the contents of the
variable, in this case named $match
What I have so far is this:
echo $match == "admin" ? "16" : $match == "edit" ? "12" : "8";
But this always echoes 12. How can I rewrite this to properly echo "16",
"12", or "8"?
I know that it is possible to nest ternary operators, and I want to use
them in this case to save time (at least in the future).
I have a variable that will hold one of four values:
"admin"
"edit"
"wadmin"
"wuser"
Each of these is used to determine necessary password lengths based on the
user type, 16, 12, 8, and 8, respectively.
I want PHP to echo each of those numbers based on the contents of the
variable, in this case named $match
What I have so far is this:
echo $match == "admin" ? "16" : $match == "edit" ? "12" : "8";
But this always echoes 12. How can I rewrite this to properly echo "16",
"12", or "8"?
Saturday, 10 August 2013
Emergency recover of virtual file system
Emergency recover of virtual file system
I have a huge problem. It seems like I ran into this bug, altough it
should be fixed. My virtual disk (virtio/raw/ext4) just died, after a
reboot. I've mounted it into another vm to fix it.
When I run fsck.ext4 -v /dev/vdb I get:
e2fsck 1.42.5 (29-Jul-2012)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/vdb
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
With mke2fs -n /dev/vdb I tried to list all backups:
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
134217728 inodes, 536870912 blocks
26843545 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
16384 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,
2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000
I now tried fsck.ext4 -b 32768/dev/vdb with every block number, but I just
get the same error:
e2fsck 1.42.5 (29-Jul-2012)
e2fsck: Bad magic number in super-block while trying to open /dev/vdb
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
I am close to questioning my own existence. What am I doing wrong?!
I have a huge problem. It seems like I ran into this bug, altough it
should be fixed. My virtual disk (virtio/raw/ext4) just died, after a
reboot. I've mounted it into another vm to fix it.
When I run fsck.ext4 -v /dev/vdb I get:
e2fsck 1.42.5 (29-Jul-2012)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/vdb
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
With mke2fs -n /dev/vdb I tried to list all backups:
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
134217728 inodes, 536870912 blocks
26843545 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
16384 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,
2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000
I now tried fsck.ext4 -b 32768/dev/vdb with every block number, but I just
get the same error:
e2fsck 1.42.5 (29-Jul-2012)
e2fsck: Bad magic number in super-block while trying to open /dev/vdb
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
I am close to questioning my own existence. What am I doing wrong?!
Any chance for Ethiopian developer to make it online?
Any chance for Ethiopian developer to make it online?
I am a programmer in a government agency in Ethiopia and I have been
writing web based applications for some time now. But recently I have been
obsessed with the idea of writing small web based applications for
small/medium business as my own business. So I developed an application as
MVP (Minimum Viable Product) and gonne out and spoken to a couple of
potential customers. The application is a basic income and expense
tracking system with invoice in its center. And with my meeting with
potential customers I have already found people who are willing to use the
system for free with a promise to find me 2 future paying customers each.
According to the promise, the future customers would pay me 2500Birr (i.e
125USD). These were super awesome deals to me, if I get 2 paying customers
for my applications I will end up owning 250USD, and that is my salary. I
was feeling happy already until I started reading HN, reddit programmer
and other success stories in internet. I was constantly reading about
these amazing pricing schemes, and how I could easily not just get that
amount once but make it my monthly income. But to my frustration we don't
have any kind of online currency in the whole country here in Ethiopia so
I have to resort to my original idea as these all making online stories
seem a fairy tale to me. So I am here to ask the programmer stack exchange
community if there is any way to make the online money, selling my
applications to customers outside my country, without online currency?
I am a programmer in a government agency in Ethiopia and I have been
writing web based applications for some time now. But recently I have been
obsessed with the idea of writing small web based applications for
small/medium business as my own business. So I developed an application as
MVP (Minimum Viable Product) and gonne out and spoken to a couple of
potential customers. The application is a basic income and expense
tracking system with invoice in its center. And with my meeting with
potential customers I have already found people who are willing to use the
system for free with a promise to find me 2 future paying customers each.
According to the promise, the future customers would pay me 2500Birr (i.e
125USD). These were super awesome deals to me, if I get 2 paying customers
for my applications I will end up owning 250USD, and that is my salary. I
was feeling happy already until I started reading HN, reddit programmer
and other success stories in internet. I was constantly reading about
these amazing pricing schemes, and how I could easily not just get that
amount once but make it my monthly income. But to my frustration we don't
have any kind of online currency in the whole country here in Ethiopia so
I have to resort to my original idea as these all making online stories
seem a fairy tale to me. So I am here to ask the programmer stack exchange
community if there is any way to make the online money, selling my
applications to customers outside my country, without online currency?
Friday, 9 August 2013
Books about modal logic?
Books about modal logic?
I've just approached modal logic reading "An Introduction to Non-Classical
Logic" of Graham Priest.
I am looking for some books that treat this argument in a more extensive
way than the book I am reading. I am especially interested in the
philosophical side of modal logic.
Can you suggest me some books?
I've just approached modal logic reading "An Introduction to Non-Classical
Logic" of Graham Priest.
I am looking for some books that treat this argument in a more extensive
way than the book I am reading. I am especially interested in the
philosophical side of modal logic.
Can you suggest me some books?
C++ HelloWorld program compiled with MinGW crashes with "Illegal Argument"
C++ HelloWorld program compiled with MinGW crashes with "Illegal Argument"
I decided it was time that I learned C++, and after struggling for 3+
hours trying to get the compiler to work, I finally created a working
program. However, it seemingly spontaneously broke when I tried to
refactor the project in Eclipse by cutting and pasting it. The program
simply crashes, and Windows brings up the dreaded dialogue "HelloWorld.exe
has stopped working." A bit of debugging revealed that "cout" was
considered an illegal argument. I looked some more into the issue, and I'm
now suspicious that it has something to do with the compiler apparently
being 32-bit, as I have a 64-bit system. The executable is listed in
Eclipse as "HelloWorld.exe - [x86/le]." (Minus the period.) My program in
full is below:
#include <iostream>
using namespace std;
int main(){
cout << "Hello World!" << endl;
return 0;
}
I've also just discovered that creating a new "HelloWorld" C++ project in
Eclipse does absolutely nothing to fix the issue, even using the
unmodified code and settings. Anyone have any suggestions as to why this
would happen?
EDIT: Debugging information: Upon running the program:
Hello World!
Program received signal SIGNILL, Illegal instruction.
0x6fccc3c0 in libstdc++-6!_ZSt4cout ()
from C:\Windows\SysWOW64\libstdc++-6.dll
(gdb) bt
#0 0x6fccc3c0 in libstdc++-6~_ZSt4cout ()
from C:\Windows\SysWOW64\libstdc++-6.dll
#1 0x6fc8908c in libstdc++-6~_ZSt4cout ()
from C:\Windows\SysWOW64\libstdc++-6.dll
#2 0x004013be in libstdc++-6~_ZSt4cout () at HelloWorld.cpp:4
(gdb)
It should be noted that line 4 of the class now points to the cout call.
I decided it was time that I learned C++, and after struggling for 3+
hours trying to get the compiler to work, I finally created a working
program. However, it seemingly spontaneously broke when I tried to
refactor the project in Eclipse by cutting and pasting it. The program
simply crashes, and Windows brings up the dreaded dialogue "HelloWorld.exe
has stopped working." A bit of debugging revealed that "cout" was
considered an illegal argument. I looked some more into the issue, and I'm
now suspicious that it has something to do with the compiler apparently
being 32-bit, as I have a 64-bit system. The executable is listed in
Eclipse as "HelloWorld.exe - [x86/le]." (Minus the period.) My program in
full is below:
#include <iostream>
using namespace std;
int main(){
cout << "Hello World!" << endl;
return 0;
}
I've also just discovered that creating a new "HelloWorld" C++ project in
Eclipse does absolutely nothing to fix the issue, even using the
unmodified code and settings. Anyone have any suggestions as to why this
would happen?
EDIT: Debugging information: Upon running the program:
Hello World!
Program received signal SIGNILL, Illegal instruction.
0x6fccc3c0 in libstdc++-6!_ZSt4cout ()
from C:\Windows\SysWOW64\libstdc++-6.dll
(gdb) bt
#0 0x6fccc3c0 in libstdc++-6~_ZSt4cout ()
from C:\Windows\SysWOW64\libstdc++-6.dll
#1 0x6fc8908c in libstdc++-6~_ZSt4cout ()
from C:\Windows\SysWOW64\libstdc++-6.dll
#2 0x004013be in libstdc++-6~_ZSt4cout () at HelloWorld.cpp:4
(gdb)
It should be noted that line 4 of the class now points to the cout call.
i need to write data to a file in c# but somehow it shows success but the file is empty
i need to write data to a file in c# but somehow it shows success but the
file is empty
Hello This is the code i am trying : If the file existes , append to that
file else create a new one . I need to write data line by line
FileExists = File.Exists(NewFileName);
if (FileExists = false)
{
using (fs =new FileStream(NewFileName,
FileMode.Create))
{
sw = new StreamWriter(fs);
MessageBox.Show(Record);
sw.WriteLine(Record);
fs.Close();
}
}
else
{
using (fd = new FileStream(NewFileName,
FileMode.Append))
{
sw = new StreamWriter(fd);
MessageBox.Show(Record);
sw.WriteLine(Record,true);
}
}
}
file is empty
Hello This is the code i am trying : If the file existes , append to that
file else create a new one . I need to write data line by line
FileExists = File.Exists(NewFileName);
if (FileExists = false)
{
using (fs =new FileStream(NewFileName,
FileMode.Create))
{
sw = new StreamWriter(fs);
MessageBox.Show(Record);
sw.WriteLine(Record);
fs.Close();
}
}
else
{
using (fd = new FileStream(NewFileName,
FileMode.Append))
{
sw = new StreamWriter(fd);
MessageBox.Show(Record);
sw.WriteLine(Record,true);
}
}
}
Polymorphic data structures in C
Polymorphic data structures in C
I am a C beginner with quite a lot of OOP experience (C#) and I am having
trouble understanding how some notion of "polymorphism" can be achieved in
C.
Right now, I am thinking how to capture the logical structure of a file
system using structs. I have a folder that contains both folders and
files. Folders in this folder can contain another files and folders, etc.
My approach:
typedef enum { file, folder } node_type;
struct node;
typedef struct {
node_type type;
char *name;
struct node *next;
struct node *children;
} node;
Is this the best I can do? I have found a lot of posts on "polymorphism in
C", but I would like to see how a polymorphic data structure like this can
be built cleanly and efficiently (in terms of memory wasted on unused
members of those structures).
Thanks.
I am a C beginner with quite a lot of OOP experience (C#) and I am having
trouble understanding how some notion of "polymorphism" can be achieved in
C.
Right now, I am thinking how to capture the logical structure of a file
system using structs. I have a folder that contains both folders and
files. Folders in this folder can contain another files and folders, etc.
My approach:
typedef enum { file, folder } node_type;
struct node;
typedef struct {
node_type type;
char *name;
struct node *next;
struct node *children;
} node;
Is this the best I can do? I have found a lot of posts on "polymorphism in
C", but I would like to see how a polymorphic data structure like this can
be built cleanly and efficiently (in terms of memory wasted on unused
members of those structures).
Thanks.
Reset IIS after CPU usage Hit 100
Reset IIS after CPU usage Hit 100
Currently I have an issue in which w3wp.exe locks the CPU at 100%. I need
to solve this issue, but in the mean time, i would like to trigger an IIS
reset when the CPU remains above 95% for more than 2 minutes.
I have been playing with performance monitor, but i need something which
will allow for a time condition. (It may allow you to do this, but so far
i haven't worked it out)
Any ideas to get this to work would be appreciated.
Currently I have an issue in which w3wp.exe locks the CPU at 100%. I need
to solve this issue, but in the mean time, i would like to trigger an IIS
reset when the CPU remains above 95% for more than 2 minutes.
I have been playing with performance monitor, but i need something which
will allow for a time condition. (It may allow you to do this, but so far
i haven't worked it out)
Any ideas to get this to work would be appreciated.
getline() on a fstream which is passed as an argument in a class constructor
getline() on a fstream which is passed as an argument in a class constructor
Hi I have some trouble with using getline() in a my class. My class name
is myStringList, stringList is a list< string> member variable, and below
is the constructor.
input is an fstream object created in main(), open() a file and is passed
into the constructor as an argument.
myStringList::myStringList(std::fstream& input)
{
std::string temp;
while (std::getline(input,temp))//will temp be cleared?
{
myStringList::stringList.push_back(temp);
}
}
The getline() cannot work in this way. It seems because input is a
reference to fstream, i think? If I were to pass in argv[1] as the
argument and create a fstream object in this constructor itself, getline
will work.
What should be the correct syntax to use getline() on a fstream which is
passed as an argument in a class constructor?
Hi I have some trouble with using getline() in a my class. My class name
is myStringList, stringList is a list< string> member variable, and below
is the constructor.
input is an fstream object created in main(), open() a file and is passed
into the constructor as an argument.
myStringList::myStringList(std::fstream& input)
{
std::string temp;
while (std::getline(input,temp))//will temp be cleared?
{
myStringList::stringList.push_back(temp);
}
}
The getline() cannot work in this way. It seems because input is a
reference to fstream, i think? If I were to pass in argv[1] as the
argument and create a fstream object in this constructor itself, getline
will work.
What should be the correct syntax to use getline() on a fstream which is
passed as an argument in a class constructor?
Remove ability to select spicific rows in grid ExtJS 4
Remove ability to select spicific rows in grid ExtJS 4
I have to remove ability to select some rows in my grid.
I use CheckboxModel
selModel: Ext.create( 'Ext.selection.CheckboxModel', {
mode: 'SIMPLE'
} )
To disable selection I use beforeselect event
beforeselect: function ( row, model, index ) {
if ( model.data.id == '3' ) {
return false;
}
}
And to hide checkbox I use specific class for row and css rule
viewConfig: {
getRowClass: function( record, index ) {
var id = record.get('id');
return id == '3' ? 'general-rule' : '';
}
}
.general-rule .x-grid-row-checker {
left: -9999px !important;
position: relative;
}
Perhaps this is not the best way to achieve the desired result, but for my
task it works.
However, another problem appear: Select All / Unselect All checkbox in
grid header stops working. When you first click on this ckechbox all lines
except those that should not be selected will select, but if you click
again, nothing happens. Obviously, the system tries to re-select all rows,
as there are unselected.
Is there a better way to solve the problem? Or how to solve a problem with
this method.
The only thing that comes to mind - you need to rewrite the Select All /
Unselect All functions for checkbox, but I not sure how I can do it.
Thanks in advance for your answers and I apologize if I made my question
is not according to the rules - this is my first appeal to stackoverflow.
Sincerely, Sergei Novikov.
I have to remove ability to select some rows in my grid.
I use CheckboxModel
selModel: Ext.create( 'Ext.selection.CheckboxModel', {
mode: 'SIMPLE'
} )
To disable selection I use beforeselect event
beforeselect: function ( row, model, index ) {
if ( model.data.id == '3' ) {
return false;
}
}
And to hide checkbox I use specific class for row and css rule
viewConfig: {
getRowClass: function( record, index ) {
var id = record.get('id');
return id == '3' ? 'general-rule' : '';
}
}
.general-rule .x-grid-row-checker {
left: -9999px !important;
position: relative;
}
Perhaps this is not the best way to achieve the desired result, but for my
task it works.
However, another problem appear: Select All / Unselect All checkbox in
grid header stops working. When you first click on this ckechbox all lines
except those that should not be selected will select, but if you click
again, nothing happens. Obviously, the system tries to re-select all rows,
as there are unselected.
Is there a better way to solve the problem? Or how to solve a problem with
this method.
The only thing that comes to mind - you need to rewrite the Select All /
Unselect All functions for checkbox, but I not sure how I can do it.
Thanks in advance for your answers and I apologize if I made my question
is not according to the rules - this is my first appeal to stackoverflow.
Sincerely, Sergei Novikov.
Subscribe to:
Comments (Atom)