This is 2013. C++11 and C++14 is on us. But why still no dedicated IDE for
C++?
I'm 26 years old. C++ is nearly 35 years old.
I'm really baffled at seeing the evolution of C++ in my 15 years of
programming. I started with Turbo C blue screen in late 90's to vim in
early 2000's. From there, I have moved on to Java, Python and Ruby. All
beautiful languages having extensive set of IDE's which makes programming
in these languages easy and fun.
But As for C++. With it's latest iteration in C++11 and coming iteration
C++14, There's still no full fledged, dedicated Editor which full support
for latest standard and documentation of libraries and intellisense. This
is really ironic, since today, almost every language have extensive
toolsets.
C++ is not as easy to learn. An IDE will surely go a long way getting new
programmers on-boarding process easy to a great extent.
If anyone knows any reason behind it, please edify us.
Saturday, 31 August 2013
Undefined reference to function in class
Undefined reference to function in class
main.cpp:
#include <iostream>
#include "pokemonList.h"
void pokemonLookup();
int main() {
pokemonLookup();
return 0;
}
void pokemonLookup() {
pokemonList pL;
std::cout<<std::endl<<"What Pokemon do you want to look up? ";
std::string pokemonLookup;
std::cin>>pokemonLookup;
pL.displayPokemon(pokemonLookup);
}
pokemonList.h:
#ifndef POKEMONLIST_H
#define POKEMONLIST_H
#include <iostream>
class pokemonList
{
private:
struct pokemonTemplate {
std::string pokemonName;
std::string pokemonMoves[3];
int pokemonLevel;
int baseATK;
int baseDEF;
int baseSPATK;
int baseSPDEF;
int baseSPEED;
};
pokemonTemplate bulbasaur;
pokemonTemplate pikachu;
public:
void displayPokemon(std::string pokemon);
protected:
};
main.cpp:
#include <iostream>
#include "pokemonList.h"
void pokemonLookup();
int main() {
pokemonLookup();
return 0;
}
void pokemonLookup() {
pokemonList pL;
std::cout<<std::endl<<"What Pokemon do you want to look up? ";
std::string pokemonLookup;
std::cin>>pokemonLookup;
pL.displayPokemon(pokemonLookup);
}
pokemonList.h:
#ifndef POKEMONLIST_H
#define POKEMONLIST_H
#include <iostream>
class pokemonList
{
private:
struct pokemonTemplate {
std::string pokemonName;
std::string pokemonMoves[3];
int pokemonLevel;
int baseATK;
int baseDEF;
int baseSPATK;
int baseSPDEF;
int baseSPEED;
};
pokemonTemplate bulbasaur;
pokemonTemplate pikachu;
public:
void displayPokemon(std::string pokemon);
protected:
};
Codeigniter Strange Query Results.
Codeigniter Strange Query Results.
I am trying to build a messaging system in codeigniter. I have three
tables as below.
messages: id--thread_id--message_id--subject--message--sent
messages_thread id--thread_id
messages_participants id--thread_id--to_id--from_id--message_id
I am easily able to compase a new message, and the recipient can see that
a message has been recieved.
The problem comes when there is a reply. After replying the results are
duplicated. it show that the initial message was sent from both the
originator and the reciever and is returning 4 rows instead of the
expected 2 rows. can anyone tell me where I am going wrong?
Here is my model.
function reply_to_thread(){
//Generate random string for the ticket number
$rand = substr(str_shuffle(MD5(microtime())), 0, 11);
//Add the random string to the hash
$messageid = $rand;
$messageinsert = array(
'message_id' => $messageid,
'subject' => $this->input->post('subject'),
'message' => $this->input->post('message'),
'thread_id' => $this->input->post('thread_id'),
);
$participantsinsert = array(
'message_id' => $messageid,
'from_id' => $this->input->post('from_id'),
'to_id' => $this->input->post('to_id'),
'thread_id' => $this->input->post('thread_id'),
);
$this->db->insert('messages',$messageinsert);
$this->db->insert('messages_participants',$participantsinsert);
}
function view_thread($thread_id){
$this->db->where('messages.thread_id', $thread_id);
$this->db->join('messages_participants',
'messages_participants.thread_id = messages.thread_id');
$this->db->join('users', 'messages_participants.from_id = users.id');
$result = $this->db->get('messages');
var_dump($result);
return $result->result_array();
}
My controller:
function check_messages(){
$id = $this->session->userdata('id');
$data['thread'] = $this->message_model->check_messages($id);
$this->load->view('messages/my_messages', $data);
}
function view_thread($thread_id){
$data['thread'] = $this->message_model->view_thread($thread_id);
$this->load->view('messages/view_thread',$data);
}
function reply(){
$this->message_model->reply_to_thread();
redirect('messages/get_messages');
}
and my view thread view:
<div class="well">
<h3>View Messages</h3>
<?php foreach($thread as $threadfield):?>
<div class="message">
<img class="avatar pull-left" src="<?php echo
$threadfield['avatar'];?>">
<div class="message-actions">
<button class="btn btn-success"
id="reply">Reply</button>
</div>
<p>
<strong>From: <a href="profile.html"> Users
id: <?php echo
$threadfield['from_id'];?></a></strong> <span
class="badge
badge-important">Unread</span><br>
<strong>Date:</strong> <?php echo date('M j Y
g:i A', strtotime($threadfield['sent']));?>
</p>
<p><strong>Subject:</strong> <a href =
"/messages/view_thread/<?php echo
$threadfield['thread_id'];?>"><?php echo
$threadfield['subject'];?></a></p>
<p><strong>Message:</strong> <?php echo
$threadfield['message'];?></p>
<hr>
</div>
<?php endforeach; ?>
</div>
<div class="row-fluid" id="replyform" style="display: none">
<div class="well">
<h3>Reply to <?php echo $threadfield['username'];?>'s
Message.</h3>
<?php echo form_open('messages/reply');?>
<input type="text" value="<?php echo
$threadfield['thread_id'];?>" name="thread_id"
id="thread_id">
<input type="text" value="<?php echo
$this->session->userdata('id');?>" name="from_id"
id="from_id">
<input type="text" value="<?php echo
$threadfield['from_id'];?>" name="to_id" id="to_id">
<input type="text" value="RE: <?php echo
$threadfield['subject'];?>" name="subject"
id="subject">
<input type="text" placeholder="Message......."
name="message" id="message">
<button class="btn" type="submit">Submit Reply</button>
<?php echo form_close();?>
</div>
thanks in advance.
I am trying to build a messaging system in codeigniter. I have three
tables as below.
messages: id--thread_id--message_id--subject--message--sent
messages_thread id--thread_id
messages_participants id--thread_id--to_id--from_id--message_id
I am easily able to compase a new message, and the recipient can see that
a message has been recieved.
The problem comes when there is a reply. After replying the results are
duplicated. it show that the initial message was sent from both the
originator and the reciever and is returning 4 rows instead of the
expected 2 rows. can anyone tell me where I am going wrong?
Here is my model.
function reply_to_thread(){
//Generate random string for the ticket number
$rand = substr(str_shuffle(MD5(microtime())), 0, 11);
//Add the random string to the hash
$messageid = $rand;
$messageinsert = array(
'message_id' => $messageid,
'subject' => $this->input->post('subject'),
'message' => $this->input->post('message'),
'thread_id' => $this->input->post('thread_id'),
);
$participantsinsert = array(
'message_id' => $messageid,
'from_id' => $this->input->post('from_id'),
'to_id' => $this->input->post('to_id'),
'thread_id' => $this->input->post('thread_id'),
);
$this->db->insert('messages',$messageinsert);
$this->db->insert('messages_participants',$participantsinsert);
}
function view_thread($thread_id){
$this->db->where('messages.thread_id', $thread_id);
$this->db->join('messages_participants',
'messages_participants.thread_id = messages.thread_id');
$this->db->join('users', 'messages_participants.from_id = users.id');
$result = $this->db->get('messages');
var_dump($result);
return $result->result_array();
}
My controller:
function check_messages(){
$id = $this->session->userdata('id');
$data['thread'] = $this->message_model->check_messages($id);
$this->load->view('messages/my_messages', $data);
}
function view_thread($thread_id){
$data['thread'] = $this->message_model->view_thread($thread_id);
$this->load->view('messages/view_thread',$data);
}
function reply(){
$this->message_model->reply_to_thread();
redirect('messages/get_messages');
}
and my view thread view:
<div class="well">
<h3>View Messages</h3>
<?php foreach($thread as $threadfield):?>
<div class="message">
<img class="avatar pull-left" src="<?php echo
$threadfield['avatar'];?>">
<div class="message-actions">
<button class="btn btn-success"
id="reply">Reply</button>
</div>
<p>
<strong>From: <a href="profile.html"> Users
id: <?php echo
$threadfield['from_id'];?></a></strong> <span
class="badge
badge-important">Unread</span><br>
<strong>Date:</strong> <?php echo date('M j Y
g:i A', strtotime($threadfield['sent']));?>
</p>
<p><strong>Subject:</strong> <a href =
"/messages/view_thread/<?php echo
$threadfield['thread_id'];?>"><?php echo
$threadfield['subject'];?></a></p>
<p><strong>Message:</strong> <?php echo
$threadfield['message'];?></p>
<hr>
</div>
<?php endforeach; ?>
</div>
<div class="row-fluid" id="replyform" style="display: none">
<div class="well">
<h3>Reply to <?php echo $threadfield['username'];?>'s
Message.</h3>
<?php echo form_open('messages/reply');?>
<input type="text" value="<?php echo
$threadfield['thread_id'];?>" name="thread_id"
id="thread_id">
<input type="text" value="<?php echo
$this->session->userdata('id');?>" name="from_id"
id="from_id">
<input type="text" value="<?php echo
$threadfield['from_id'];?>" name="to_id" id="to_id">
<input type="text" value="RE: <?php echo
$threadfield['subject'];?>" name="subject"
id="subject">
<input type="text" placeholder="Message......."
name="message" id="message">
<button class="btn" type="submit">Submit Reply</button>
<?php echo form_close();?>
</div>
thanks in advance.
How to get a string from inside slashes in Java?
How to get a string from inside slashes in Java?
I'm trying to extract the String between two forward slashes and can't get
the regular expression quite right.
This is [a very] /unusual string/
The aim is to just print unusual string.
I'm trying to extract the String between two forward slashes and can't get
the regular expression quite right.
This is [a very] /unusual string/
The aim is to just print unusual string.
Optimization of code in javascripts JSON calls
Optimization of code in javascripts JSON calls
I've been involved in a large web application where I have a lot of
functions that calls web services through JSON. For instance:
/*...*/
refreshClientBoxes: function(customerNr) {
var request = {};
request.method = "getClientBoxes";
request.params = {};
request.params.customerNr = customerNr;
request.id = Math.floor(Math.random() * 101);
postObject(jsonURL, JSON.stringify(request), successClientBoxes);
},
/*...*/
Where "postObject" it's a function that receive an URL, the data and a
callback.
As you can see I have to construct this piece of code in every single method:
var request = {};
request.method = "getClientBoxes";
request.params = {};
request.params.customerNr = customerNr;
request.id = Math.floor(Math.random() * 101);
What's change is the name of the method that we will call and the name and
values of parameter that we want to pass.
So I was wondering if there is a way that we can avoid this effort through
a method that receive the name of the method that we will call and array
of parameters, and using some kind of reflection construct the request
parameters and return the request stringifyed.
For the WS I used php + zend 1.12, the MVC framework in JS its ember 0.95
and jQuery.
I've been involved in a large web application where I have a lot of
functions that calls web services through JSON. For instance:
/*...*/
refreshClientBoxes: function(customerNr) {
var request = {};
request.method = "getClientBoxes";
request.params = {};
request.params.customerNr = customerNr;
request.id = Math.floor(Math.random() * 101);
postObject(jsonURL, JSON.stringify(request), successClientBoxes);
},
/*...*/
Where "postObject" it's a function that receive an URL, the data and a
callback.
As you can see I have to construct this piece of code in every single method:
var request = {};
request.method = "getClientBoxes";
request.params = {};
request.params.customerNr = customerNr;
request.id = Math.floor(Math.random() * 101);
What's change is the name of the method that we will call and the name and
values of parameter that we want to pass.
So I was wondering if there is a way that we can avoid this effort through
a method that receive the name of the method that we will call and array
of parameters, and using some kind of reflection construct the request
parameters and return the request stringifyed.
For the WS I used php + zend 1.12, the MVC framework in JS its ember 0.95
and jQuery.
How to check JDialog state
How to check JDialog state
I have a JDialog and I'd like to check whether its state is maximized,
minimized or normal. How can I do that?
I have tried:
private JDialog dialog = new JDialog();
dialog.addWindowStateListener(new WindowStateListener() {
@Override
public void windowStateChanged(WindowEvent e) {
if(e.getNewState()==JFrame.MAXIMIZED_BOTH){
System.out.println(" state MAXIMIZED_BOTH");
dialog.repaint();
}
}
});
but it doesn't work of course.
Thanks
I have a JDialog and I'd like to check whether its state is maximized,
minimized or normal. How can I do that?
I have tried:
private JDialog dialog = new JDialog();
dialog.addWindowStateListener(new WindowStateListener() {
@Override
public void windowStateChanged(WindowEvent e) {
if(e.getNewState()==JFrame.MAXIMIZED_BOTH){
System.out.println(" state MAXIMIZED_BOTH");
dialog.repaint();
}
}
});
but it doesn't work of course.
Thanks
How do I make a cornered button with flipped corner
How do I make a cornered button with flipped corner
So I created this in photoshop and now I want to transfer it into my
website but I want to make it so that I can just write some code and have
it all done. This is what I am trying to make:
with the same colors and size. I haven't written anything yet so I am
asking how I can make the top right corner that looks like its flipping
over the button.
So I created this in photoshop and now I want to transfer it into my
website but I want to make it so that I can just write some code and have
it all done. This is what I am trying to make:
with the same colors and size. I haven't written anything yet so I am
asking how I can make the top right corner that looks like its flipping
over the button.
Friday, 30 August 2013
How to have a progress bar in jQuery.get()
How to have a progress bar in jQuery.get()
is it possible to have a progress bar measuring the jQuery.get() progress?
is it possible to have a progress bar measuring the jQuery.get() progress?
Thursday, 29 August 2013
absolute value in cplex c++
absolute value in cplex c++
Please help me. I have to use absolute value in the cost function of some
linear problem. Part that bother me like this
for (t=0;t<T;t++)
for (i=0;i<I; i++){
for (j=1;j<J; j++)
Sum += |x[i][j][t]-x[i][j][t-1]|*L/2;
Sum += |x[i][0][t]-x[i][0][t-1]|*V/2;
}
I am writing my code in c++ and I don't know how to implement absolute
value. x is integer value. I have tried with
cplex.getValue(x[i][j][t])-cplex.getValue(x[i][j][t-1]) >0 but it couldn't
work.
Thanx in advance :)
Please help me. I have to use absolute value in the cost function of some
linear problem. Part that bother me like this
for (t=0;t<T;t++)
for (i=0;i<I; i++){
for (j=1;j<J; j++)
Sum += |x[i][j][t]-x[i][j][t-1]|*L/2;
Sum += |x[i][0][t]-x[i][0][t-1]|*V/2;
}
I am writing my code in c++ and I don't know how to implement absolute
value. x is integer value. I have tried with
cplex.getValue(x[i][j][t])-cplex.getValue(x[i][j][t-1]) >0 but it couldn't
work.
Thanx in advance :)
Controller, and model and view using ROR
Controller, and model and view using ROR
) I may have a very simple question, but I ve no idea how to answer it, I
always got the same error
I want to set up a news website and I would like all my articles to show
up on the home page.
I created first a model for Pages with a home page. And then I generated a
scaffold for articles so with all views available (index show ..)
Now I would like my index page to show up in the home page, is that
possible ? how can I do it ?
In general how do we access generable variable that are in a controller in
another page ?
thx you very much raphael
) I may have a very simple question, but I ve no idea how to answer it, I
always got the same error
I want to set up a news website and I would like all my articles to show
up on the home page.
I created first a model for Pages with a home page. And then I generated a
scaffold for articles so with all views available (index show ..)
Now I would like my index page to show up in the home page, is that
possible ? how can I do it ?
In general how do we access generable variable that are in a controller in
another page ?
thx you very much raphael
Wednesday, 28 August 2013
Get the widgets value out side the actitivty in Android?
Get the widgets value out side the actitivty in Android?
In my main activity there are few widgets like edit
text,textview,spinner.I want to get these widgets value in the class that
is called from the Activity.How could i do this .
Acces all the widgets value from different class that is called by the
main activity
click.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
//Like these i have few more of what i have to get the values
Spinner abc = (Spinner) findViewById(R.id.abc);
Spinner xyz = (Spinner) findViewById(R.id.xyz);
Spinner deg = (Spinner) findViewById(R.id.deg);
//This is my class where i want to access all the widgets
values and perform some action on that
GetValue obj = new GetValue();
obj.getAllData();
}
});
This is something what i want to do please help me i am not getting how
could i do this .What values i have to pass in the function to get the
values.Thanks
In my main activity there are few widgets like edit
text,textview,spinner.I want to get these widgets value in the class that
is called from the Activity.How could i do this .
Acces all the widgets value from different class that is called by the
main activity
click.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
//Like these i have few more of what i have to get the values
Spinner abc = (Spinner) findViewById(R.id.abc);
Spinner xyz = (Spinner) findViewById(R.id.xyz);
Spinner deg = (Spinner) findViewById(R.id.deg);
//This is my class where i want to access all the widgets
values and perform some action on that
GetValue obj = new GetValue();
obj.getAllData();
}
});
This is something what i want to do please help me i am not getting how
could i do this .What values i have to pass in the function to get the
values.Thanks
PHP won't connect to .mdb database
PHP won't connect to .mdb database
I am trying to connect to an Access database (*.mdb) via PHP and am having
difficulty connecting. I have tested this connect line in a different
script with a different database ('database1') and it works just fine. I
literally copied, pasted, changed the database name (to 'database2', and
neither database had usernames or passwords set, thus those fields are
empty) and suddenly I get my "Connection Failed" message. All are in the
same folder. It's killing me. I know it will be some stupidity on my part
but I can't figure out what it is and I am in a time crunch.
Thanks!
My code snippet:
<html>
<body>
<?php
$conn=odbc_connect('database2','','');
if (!$conn)
{exit("Connection Failed." . $conn);}
#smart stuff to be added later
?>
</body>
</html>
I am trying to connect to an Access database (*.mdb) via PHP and am having
difficulty connecting. I have tested this connect line in a different
script with a different database ('database1') and it works just fine. I
literally copied, pasted, changed the database name (to 'database2', and
neither database had usernames or passwords set, thus those fields are
empty) and suddenly I get my "Connection Failed" message. All are in the
same folder. It's killing me. I know it will be some stupidity on my part
but I can't figure out what it is and I am in a time crunch.
Thanks!
My code snippet:
<html>
<body>
<?php
$conn=odbc_connect('database2','','');
if (!$conn)
{exit("Connection Failed." . $conn);}
#smart stuff to be added later
?>
</body>
</html>
iptables: why only OUTPUT rules are needed for samba clients?
iptables: why only OUTPUT rules are needed for samba clients?
I tried the following iptables rules for samba client and they worked.
Please note that policy for INPUT, OUTPUT and FORWARD were all set to DROP
iptables -A OUTPUT -m state --state NEW,ESTABLISHED -p udp --dport 137 -j
ACCEPT
iptables -A OUTPUT -m state --state NEW,ESTABLISHED -p udp --dport 138 -j
ACCEPT
iptables -A OUTPUT -m state --state NEW,ESTABLISHED -p tcp --dport 139 -j
ACCEPT
iptables -A OUTPUT -m state --state NEW,ESTABLISHED -p tcp --dport 445 -j
ACCEPT
My question is : why are only OUTPUT rules needed for samba clients?
Doesn't a samba client receive unsolicited packets from server end? Why
don't we need INPUT rules to open those ports for incoming packets?
An additional question: does the chain names carry any significance of
directions internally or are they just mnemonics for easy understanding?
I tried the following iptables rules for samba client and they worked.
Please note that policy for INPUT, OUTPUT and FORWARD were all set to DROP
iptables -A OUTPUT -m state --state NEW,ESTABLISHED -p udp --dport 137 -j
ACCEPT
iptables -A OUTPUT -m state --state NEW,ESTABLISHED -p udp --dport 138 -j
ACCEPT
iptables -A OUTPUT -m state --state NEW,ESTABLISHED -p tcp --dport 139 -j
ACCEPT
iptables -A OUTPUT -m state --state NEW,ESTABLISHED -p tcp --dport 445 -j
ACCEPT
My question is : why are only OUTPUT rules needed for samba clients?
Doesn't a samba client receive unsolicited packets from server end? Why
don't we need INPUT rules to open those ports for incoming packets?
An additional question: does the chain names carry any significance of
directions internally or are they just mnemonics for easy understanding?
Total password lockout
Total password lockout
I am dealing with an issue right now with a dedicated server locking me
out of WHM, cPanel, and receiving emails from all websites on this server.
I type my username/password and it tells me the 'login is invalid'. I
submitted a ticket and have been working on this issue for the last 4
hours with no success. The tech I have been working with can't seem to pin
point the issue. I am wondering if anyone here has even experienced
something like this.
It started with a simple question about email settings on a new dedicated
server. After checking things out whether I should use POP or IMAP. The
tech finally told me to use POP. I went to login with my usual credentials
into WHM and I get an invalid login. I soon find out that my emails and
cPanel are all doing the same thing, they will not accept my username
password combo even though I have checked/changed done everything to make
sure they are correct. We ran a traceroute and everything seems fine
there.
Any ideas what might be going on? The server is running CentOS 6.4
I should also mention that the tech is able to login just fine on his end.
I am dealing with an issue right now with a dedicated server locking me
out of WHM, cPanel, and receiving emails from all websites on this server.
I type my username/password and it tells me the 'login is invalid'. I
submitted a ticket and have been working on this issue for the last 4
hours with no success. The tech I have been working with can't seem to pin
point the issue. I am wondering if anyone here has even experienced
something like this.
It started with a simple question about email settings on a new dedicated
server. After checking things out whether I should use POP or IMAP. The
tech finally told me to use POP. I went to login with my usual credentials
into WHM and I get an invalid login. I soon find out that my emails and
cPanel are all doing the same thing, they will not accept my username
password combo even though I have checked/changed done everything to make
sure they are correct. We ran a traceroute and everything seems fine
there.
Any ideas what might be going on? The server is running CentOS 6.4
I should also mention that the tech is able to login just fine on his end.
Displaying a mathematical formula in a form and messagebox VB.NET
Displaying a mathematical formula in a form and messagebox VB.NET
How to display a mathematical formula in a form and in a messagebox?
I found an article to enable users to Write Math Equations in a Web Even
though there includes a vb.net version I can make it to work on visual
studio 2010 for a desktop app
I have seen it uses:
[System.Runtime.InteropServices.DllImport("MimeTex.dll")]
internal static extern int CreateGifFromEq(string expr,
string fileName);
But how to do analog for vb.net?
I know I have to include
Imports System.Runtime.InteropServices
then
Friend Class NativeMethods
<DllImport("MimeTex", CharSet:=CharSet.Auto, SetLastError:=True)> _
Public Shared Function CreateGifFromEq(ByVal expr As String, ByVal
fileName As String) As Integer
End Function
End Class
but I get:
Error 1 'CreateGifFromEq' is not declared. It may be inaccessible due
to its protection level.
when using
CreateGifFromEq("((x+4+9+8)/2)*0.8", "image.png")
Is there a way to draw equations and show it in a messagebox?
How to display a mathematical formula in a form and in a messagebox?
I found an article to enable users to Write Math Equations in a Web Even
though there includes a vb.net version I can make it to work on visual
studio 2010 for a desktop app
I have seen it uses:
[System.Runtime.InteropServices.DllImport("MimeTex.dll")]
internal static extern int CreateGifFromEq(string expr,
string fileName);
But how to do analog for vb.net?
I know I have to include
Imports System.Runtime.InteropServices
then
Friend Class NativeMethods
<DllImport("MimeTex", CharSet:=CharSet.Auto, SetLastError:=True)> _
Public Shared Function CreateGifFromEq(ByVal expr As String, ByVal
fileName As String) As Integer
End Function
End Class
but I get:
Error 1 'CreateGifFromEq' is not declared. It may be inaccessible due
to its protection level.
when using
CreateGifFromEq("((x+4+9+8)/2)*0.8", "image.png")
Is there a way to draw equations and show it in a messagebox?
Tuesday, 27 August 2013
How to get product balance?
How to get product balance?
I am new in C# and SQL, I have 3 tables Products, Purchase and Sale.
In Purchase and Sale tables ProductId and Quantity is saved.
I want to fill Datagridview as below:
Product Id Purchase Qty, Sale Qty, Balance Qty
In my table Product there are 10000 products saved and Purchase records
are 25000 and Sale records are 20000.
I am trying to calculate from C# but it taking a 5 to 10 minutes to fill.
I am new in C# and SQL, I have 3 tables Products, Purchase and Sale.
In Purchase and Sale tables ProductId and Quantity is saved.
I want to fill Datagridview as below:
Product Id Purchase Qty, Sale Qty, Balance Qty
In my table Product there are 10000 products saved and Purchase records
are 25000 and Sale records are 20000.
I am trying to calculate from C# but it taking a 5 to 10 minutes to fill.
When running check on an R package=?iso-8859-1?Q?=2C_what_does_the_=22use_=91--force=92_to_remove_the_exist?=ing INDEX" message mean?
When running check on an R package, what does the "use '--force' to remove
the existing 'INDEX'" message mean?
When running R CMD check on an R package I often see the following message
stating that the INDEX is not up to date:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking whether 'INDEX' is up-to-date ... NO
* use '--force' to remove the existing 'INDEX'
* installing the package to re-build vignettes
* creating vignettes ... OK
This does not result in an a Warning, Error or even a Note. I assume this
is referring to the INDEX file in the top level of the package directory?
How do I "use --force"? I've tried adding --force as a argument while
building or checking and it just complains that it is not recognized. Is
there an R command to rebuild the INDEX file?
the existing 'INDEX'" message mean?
When running R CMD check on an R package I often see the following message
stating that the INDEX is not up to date:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking whether 'INDEX' is up-to-date ... NO
* use '--force' to remove the existing 'INDEX'
* installing the package to re-build vignettes
* creating vignettes ... OK
This does not result in an a Warning, Error or even a Note. I assume this
is referring to the INDEX file in the top level of the package directory?
How do I "use --force"? I've tried adding --force as a argument while
building or checking and it just complains that it is not recognized. Is
there an R command to rebuild the INDEX file?
Rearrange data into specified row lengths
Rearrange data into specified row lengths
I have a data file that is just a long list of numbers, with each entry on
a separate line:
23
28
26
14
...
I need to rearrange the data in rows 37 records/fields long:
23 28 26 14 1 2 3 4 5 6 7 8 9 2 4 5 6 9 4 8 7 6 3 2 5 9 4 1 2 5 7 8 9 4 6 1 2
5 8 6 4 3 5 23 28 26 14 1 2 3 4 5 6 7 8 9 2 4 5 6 9 4 8 7 6 3 2 5 9 4 1 2
5 7
...
This is the code I've tried:
awk '{
for(i=1;i<=NF;i+=1) {
if(i%37 != 0) printf $i" ";
else printf "$i\n"
}
}'
input.txt > output.txt
The first printf $i" " seems to be working, but somethings seems to be
wrong with the conditional because no matter what I tell it to print in
the else statement it doesn't print it. Perhaps just a syntax oversight??
Interestingly, when I just run:
awk '{for(i=1;i<=NF;i+=1) printf $i" "}' input.txt > output.txt
the resultant file puts some of the data into 37-record-length rows, but
some are still much longer...could this be a result of some artifact in
the data? (The data has been run through a number of sorting/organizing
functions.)
I have a data file that is just a long list of numbers, with each entry on
a separate line:
23
28
26
14
...
I need to rearrange the data in rows 37 records/fields long:
23 28 26 14 1 2 3 4 5 6 7 8 9 2 4 5 6 9 4 8 7 6 3 2 5 9 4 1 2 5 7 8 9 4 6 1 2
5 8 6 4 3 5 23 28 26 14 1 2 3 4 5 6 7 8 9 2 4 5 6 9 4 8 7 6 3 2 5 9 4 1 2
5 7
...
This is the code I've tried:
awk '{
for(i=1;i<=NF;i+=1) {
if(i%37 != 0) printf $i" ";
else printf "$i\n"
}
}'
input.txt > output.txt
The first printf $i" " seems to be working, but somethings seems to be
wrong with the conditional because no matter what I tell it to print in
the else statement it doesn't print it. Perhaps just a syntax oversight??
Interestingly, when I just run:
awk '{for(i=1;i<=NF;i+=1) printf $i" "}' input.txt > output.txt
the resultant file puts some of the data into 37-record-length rows, but
some are still much longer...could this be a result of some artifact in
the data? (The data has been run through a number of sorting/organizing
functions.)
finding specific character fro substring
finding specific character fro substring
I have this function to find string for the first time:
var strng:String = new String(txtSource.text)
var position:Number = new Number();
position = strng.indexOf("<img pg",0);
strng = strng.substring(position + 4);
position = strng.indexOf(">");
strng = strng.substring(0, position);
textcontrol1.text = String(strng);
Now I get below string as answer
<img pg="asStoryVid" class="" vspace="0" marginheight="0" marginwidth="0"
width="300" border="0"
src="http://www.abc.com/thumb/msid-22087805,width-300,resizemode-4/xyz.jpg"
alt="" title="" ag="">
Now, further I want only
src="http://www.abc.com/thumb/msid-22087805,width-300,resizemode-4/xyz.jpg"
from above string. For that I have write this function
var strng1:String = new String(textcontrol1.text)
var position1:Number = new Number();
position1 = strng1.indexOf('src="http://',0);
strng1 = strng1.substring(position1 + 0);
position1 = strng1.indexOf('"');
strng1 = strng1.substring(0, position1);
textcontrol1.text = String(strng1);
But in output I getting a no string Any one can show me where I m wrong?
I have this function to find string for the first time:
var strng:String = new String(txtSource.text)
var position:Number = new Number();
position = strng.indexOf("<img pg",0);
strng = strng.substring(position + 4);
position = strng.indexOf(">");
strng = strng.substring(0, position);
textcontrol1.text = String(strng);
Now I get below string as answer
<img pg="asStoryVid" class="" vspace="0" marginheight="0" marginwidth="0"
width="300" border="0"
src="http://www.abc.com/thumb/msid-22087805,width-300,resizemode-4/xyz.jpg"
alt="" title="" ag="">
Now, further I want only
src="http://www.abc.com/thumb/msid-22087805,width-300,resizemode-4/xyz.jpg"
from above string. For that I have write this function
var strng1:String = new String(textcontrol1.text)
var position1:Number = new Number();
position1 = strng1.indexOf('src="http://',0);
strng1 = strng1.substring(position1 + 0);
position1 = strng1.indexOf('"');
strng1 = strng1.substring(0, position1);
textcontrol1.text = String(strng1);
But in output I getting a no string Any one can show me where I m wrong?
how to use sql in case
how to use sql in case
hello it can take on values STATUS = 1 OR STATUS = 0 OR NULL
How can I do ( if or case when )
thank you..
if status = 1
where ICERIK.ACTIVE='1'
else if status 2
where ICERIK.ACTIVE= '0'
else if STATUS NULL
where ICERIK.ACTIVE in ('1','0')
OR
IF STATUS=NULL
where ICERIK.ACTIVE in ('1','0')
ELSE
WHERE ICERIK.ACTIVE=STATUS
PROCEDURE SP_GET_EKSPERTIZ_CONTENT_ARSAID (ARSA_ID IN VARCHAR2,STATUS IN
VARCHAR2, CUR_EKSPERTIZ_ICERIK OUT SYS_REFCURSOR) as
BEGIN
OPEN CUR_EKSPERTIZ_CONTENT FOR
SELECT DISTINCT ICERIK.*,ARSA.*
FROM T_TEM_EKSPERTIZ_ICERIK ICERIK
left outer join T_TEM_ARSA ARSA on ICERIK.GAYRIMENKUL_ID = ARSA.ARSA_ID
WHERE ICERIK.ACTIVE=STATUS
AND ICERIK.GAYRIMENKUL_ID IN
(SELECT *
FROM
TABLE(FN_SPLIT(SP_GET_EKSPERTIZ_CONTENT_ARSAID.ARSA_ID,
',')));
END SP_GET_EKSPERTIZ_CONTENT_ARSAID;
hello it can take on values STATUS = 1 OR STATUS = 0 OR NULL
How can I do ( if or case when )
thank you..
if status = 1
where ICERIK.ACTIVE='1'
else if status 2
where ICERIK.ACTIVE= '0'
else if STATUS NULL
where ICERIK.ACTIVE in ('1','0')
OR
IF STATUS=NULL
where ICERIK.ACTIVE in ('1','0')
ELSE
WHERE ICERIK.ACTIVE=STATUS
PROCEDURE SP_GET_EKSPERTIZ_CONTENT_ARSAID (ARSA_ID IN VARCHAR2,STATUS IN
VARCHAR2, CUR_EKSPERTIZ_ICERIK OUT SYS_REFCURSOR) as
BEGIN
OPEN CUR_EKSPERTIZ_CONTENT FOR
SELECT DISTINCT ICERIK.*,ARSA.*
FROM T_TEM_EKSPERTIZ_ICERIK ICERIK
left outer join T_TEM_ARSA ARSA on ICERIK.GAYRIMENKUL_ID = ARSA.ARSA_ID
WHERE ICERIK.ACTIVE=STATUS
AND ICERIK.GAYRIMENKUL_ID IN
(SELECT *
FROM
TABLE(FN_SPLIT(SP_GET_EKSPERTIZ_CONTENT_ARSAID.ARSA_ID,
',')));
END SP_GET_EKSPERTIZ_CONTENT_ARSAID;
Monday, 26 August 2013
How can I add content to the page by just using css/js?
How can I add content to the page by just using css/js?
I'm developing a real estate website. The website is working with a paid
service that allows people to view real estate listings through my
website. My website becomes a subdomain of the other website like
www.mywebsite.listingswebsite.com. The listings website dynamically pulls
the header and footer wrappers on one of the pages I provided them, and
puts their content in the middle of the page. So it looks like this.
My Header
Their listings content that I have no control over
My Footer
The problem is, I want to modify their page. I want to add some content
before their content, I want to move elements around, and I want to delete
some elements. For now, all I know is how to remove elements from the page
- and that's by finding the ID of their Div, and adding display:none in my
CSS file.
But what if I wanted to add content to the page? I only have control over
the CSS/JS, so how would I do that? Say I wanted to add a picture right
before their content.
I'm developing a real estate website. The website is working with a paid
service that allows people to view real estate listings through my
website. My website becomes a subdomain of the other website like
www.mywebsite.listingswebsite.com. The listings website dynamically pulls
the header and footer wrappers on one of the pages I provided them, and
puts their content in the middle of the page. So it looks like this.
My Header
Their listings content that I have no control over
My Footer
The problem is, I want to modify their page. I want to add some content
before their content, I want to move elements around, and I want to delete
some elements. For now, all I know is how to remove elements from the page
- and that's by finding the ID of their Div, and adding display:none in my
CSS file.
But what if I wanted to add content to the page? I only have control over
the CSS/JS, so how would I do that? Say I wanted to add a picture right
before their content.
Ruby - Generating prime numbers for Websocket encryption
Ruby - Generating prime numbers for Websocket encryption
pI'm creating a WebSocket Server in Ruby, and I would like to encrypt the
string messages between the server and the client. I can't afford a
certificate, so I was thinking that I would create an encryption algorithm
using modulo./p pI need to generate large prime numbers for this
algorithm. I know that Ruby has a built in function for Primes, but I'm
not sure if it can generate 50 to 60 digit numbers. Is the built in
function for Primes good for this?/p pIf anyone can offer a better way of
encrypting my WS messages for free (and decrypt on the other side) I would
also accept that :)/p
pI'm creating a WebSocket Server in Ruby, and I would like to encrypt the
string messages between the server and the client. I can't afford a
certificate, so I was thinking that I would create an encryption algorithm
using modulo./p pI need to generate large prime numbers for this
algorithm. I know that Ruby has a built in function for Primes, but I'm
not sure if it can generate 50 to 60 digit numbers. Is the built in
function for Primes good for this?/p pIf anyone can offer a better way of
encrypting my WS messages for free (and decrypt on the other side) I would
also accept that :)/p
Multiple IBOutlets (from different classes) to One Object
Multiple IBOutlets (from different classes) to One Object
Just a quick semantic question, but is it considered OK to have multiple
IBOutlets, located in different classes, going to one (for example)
NSButton in Interface Builder. The reason I ask is I need to enable and
disable an NSButton based on events that happen in different classes.
Would multiple IBOutlets be OK, or should I be creating a controller class
for the Button that would receive a message telling it to change the sate
of the button, resulting in only one IBOutlet?
Thanks in advance.
Just a quick semantic question, but is it considered OK to have multiple
IBOutlets, located in different classes, going to one (for example)
NSButton in Interface Builder. The reason I ask is I need to enable and
disable an NSButton based on events that happen in different classes.
Would multiple IBOutlets be OK, or should I be creating a controller class
for the Button that would receive a message telling it to change the sate
of the button, resulting in only one IBOutlet?
Thanks in advance.
Is it possible to make hist3 plots smoother?
Is it possible to make hist3 plots smoother?
I use hist3() function to plot the density of points. It creates a grid
and finds the number of points in each grid, then it creates the plot. But
the colors on the plot are discrete. Is there an option to make this
distribution smooth, i.e. make transition from one color to another
smoother. Now all the cells of the grid have different colors, from grin
to yellow and the distribution is not apparent.
I use the following code.
axis equal;
colormap(jet);
n = hist3(final',[40,40]);
n1 = n';
n1( size(n,1) + 1 ,size(n,2) + 1 ) = 0;
xb = linspace(min(final(:,1)),max(final(:,1)),size(n,1)+1);
yb = linspace(min(final(:,2)),max(final(:,2)),size(n,1)+1);
pcolor(xb,yb,n1);
Thanks in advance.
I use hist3() function to plot the density of points. It creates a grid
and finds the number of points in each grid, then it creates the plot. But
the colors on the plot are discrete. Is there an option to make this
distribution smooth, i.e. make transition from one color to another
smoother. Now all the cells of the grid have different colors, from grin
to yellow and the distribution is not apparent.
I use the following code.
axis equal;
colormap(jet);
n = hist3(final',[40,40]);
n1 = n';
n1( size(n,1) + 1 ,size(n,2) + 1 ) = 0;
xb = linspace(min(final(:,1)),max(final(:,1)),size(n,1)+1);
yb = linspace(min(final(:,2)),max(final(:,2)),size(n,1)+1);
pcolor(xb,yb,n1);
Thanks in advance.
By default, Web page open at bottom of page
By default, Web page open at bottom of page
I add an iframe in web page. When it loads in Firefox 23.0 browser in an
android mobile, by default it open at bottom of the page. I need to open
it at top of the page. I tried with the following code:
<iframe onload="this.contentWindow.scrollTo(0,0)">
But, unable to fix this issue. Please, help me to fix this issue.
Thanks in advance
I add an iframe in web page. When it loads in Firefox 23.0 browser in an
android mobile, by default it open at bottom of the page. I need to open
it at top of the page. I tried with the following code:
<iframe onload="this.contentWindow.scrollTo(0,0)">
But, unable to fix this issue. Please, help me to fix this issue.
Thanks in advance
Change priority on Mutexes
Change priority on Mutexes
I'm fairly new to RTOS programming and I'm having some problems with
priority when using Mutexes.
I have the following priorities established.
#define T_HI_PRIORITY 10
#define T_ME_PRIORITY 50
and I want this code to run the task "tMePriorityTask" with the highest
priority and "tHiPriorityTask" with medium priority. "tLoPriorityTask" is
commented and, therefore, should not run now.
#include <stdio.h>
#include "main.h"
#include "vxWorks.h"
#include "semLib.h"
#include "taskLib.h"
SEM_ID semMutex; // named semaphore object
char alphabet[27]; // memory resource to have exclusive access
void tHiPriorityTask (void)
{
int i;
// enter critical region - any other tasks wanting access to
alphabet[] should
// wait for available semaphore
semTake (semMutex, WAIT_FOREVER);
// write alphabet to global array
for (i= 0; i < 26; i++)
alphabet[i] = 'A' + i;
alphabet[i] = '\0';
printf("High priority.\n-Counting alphabet...\n");
// leave critical region
semGive (semMutex);
}
void tMePriorityTask (void)
{
// enter critical region
semTake (semMutex, WAIT_FOREVER);
//medium priority task enters
printf("Medium priority.\n-Just entering...\n");
// leave critical region
semGive (semMutex);
}
/*void tLoPriorityTask (void)
{
// enter critical region
semTake (semMutex, WAIT_FOREVER);
// array members guaranteed stable while being read by this task
printf("Low priority\n");
printf ("-alphabet= %s ", alphabet);
// leave critical region
semGive (semMutex);
}*/
void main (void)
{
//create binary semaphore which is initially full (available)
semMutex = semBCreate (SEM_Q_PRIORITY, SEM_FULL);
// spawn high priority task
taskSpawn ("hi_priority_task", T_ME_PRIORITY, VX_FP_TASK, 10000,
(FUNCPTR) tHiPriorityTask, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
// spawn medium priority task
taskSpawn ("me_priority_task", T_HI_PRIORITY, VX_FP_TASK, 10000,
(FUNCPTR) tMePriorityTask, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
// spawn low priority task
//taskSpawn ("lo_priority_task", T_LO_PRIORITY, VX_FP_TASK, 10000,
(FUNCPTR) tLoPriorityTask, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
I've tried to change the priorities when spawning the tasks but that
doesn't seem to work, at least it doesn't change anything on screen. I'm
using VxWorks RTOS.
Thank you.
I'm fairly new to RTOS programming and I'm having some problems with
priority when using Mutexes.
I have the following priorities established.
#define T_HI_PRIORITY 10
#define T_ME_PRIORITY 50
and I want this code to run the task "tMePriorityTask" with the highest
priority and "tHiPriorityTask" with medium priority. "tLoPriorityTask" is
commented and, therefore, should not run now.
#include <stdio.h>
#include "main.h"
#include "vxWorks.h"
#include "semLib.h"
#include "taskLib.h"
SEM_ID semMutex; // named semaphore object
char alphabet[27]; // memory resource to have exclusive access
void tHiPriorityTask (void)
{
int i;
// enter critical region - any other tasks wanting access to
alphabet[] should
// wait for available semaphore
semTake (semMutex, WAIT_FOREVER);
// write alphabet to global array
for (i= 0; i < 26; i++)
alphabet[i] = 'A' + i;
alphabet[i] = '\0';
printf("High priority.\n-Counting alphabet...\n");
// leave critical region
semGive (semMutex);
}
void tMePriorityTask (void)
{
// enter critical region
semTake (semMutex, WAIT_FOREVER);
//medium priority task enters
printf("Medium priority.\n-Just entering...\n");
// leave critical region
semGive (semMutex);
}
/*void tLoPriorityTask (void)
{
// enter critical region
semTake (semMutex, WAIT_FOREVER);
// array members guaranteed stable while being read by this task
printf("Low priority\n");
printf ("-alphabet= %s ", alphabet);
// leave critical region
semGive (semMutex);
}*/
void main (void)
{
//create binary semaphore which is initially full (available)
semMutex = semBCreate (SEM_Q_PRIORITY, SEM_FULL);
// spawn high priority task
taskSpawn ("hi_priority_task", T_ME_PRIORITY, VX_FP_TASK, 10000,
(FUNCPTR) tHiPriorityTask, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
// spawn medium priority task
taskSpawn ("me_priority_task", T_HI_PRIORITY, VX_FP_TASK, 10000,
(FUNCPTR) tMePriorityTask, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
// spawn low priority task
//taskSpawn ("lo_priority_task", T_LO_PRIORITY, VX_FP_TASK, 10000,
(FUNCPTR) tLoPriorityTask, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
I've tried to change the priorities when spawning the tasks but that
doesn't seem to work, at least it doesn't change anything on screen. I'm
using VxWorks RTOS.
Thank you.
Sunday, 25 August 2013
Access using comboboxes for query variables
Access using comboboxes for query variables
I would like to run a query from a form with several comboboxes as the
criteria for the query.
example: StartDate and Enddate, firstemployee and lastemployee.
I'm using a parameter query now but cant remember all the employee numbers
etc. Would like to do it in VBA code with a button on the Form with the
comboboxes.
Toby
I would like to run a query from a form with several comboboxes as the
criteria for the query.
example: StartDate and Enddate, firstemployee and lastemployee.
I'm using a parameter query now but cant remember all the employee numbers
etc. Would like to do it in VBA code with a button on the Form with the
comboboxes.
Toby
Calling var i from for loop in jquery get request
Calling var i from for loop in jquery get request
I'm having trouble access var i in my $.get's scope. This is my code:
for (var i = 0; i < printer_ids.length; i++) {
$.get('/get_printer_status_message/'+printer_ids[i]+'/', function(data) {
$('#printer_status_'+printer_ids[i]).html(data);
console.log(data)
console.log('id: #printer_status_'+printer_ids[i]);
console.log('current:' + $('#printer_status_'+printer_ids[i]).html());
});
}
i is defined in the $.get line but not in $.get's scope. How do I access
var i in $.get's scope?
I'm having trouble access var i in my $.get's scope. This is my code:
for (var i = 0; i < printer_ids.length; i++) {
$.get('/get_printer_status_message/'+printer_ids[i]+'/', function(data) {
$('#printer_status_'+printer_ids[i]).html(data);
console.log(data)
console.log('id: #printer_status_'+printer_ids[i]);
console.log('current:' + $('#printer_status_'+printer_ids[i]).html());
});
}
i is defined in the $.get line but not in $.get's scope. How do I access
var i in $.get's scope?
[ Baby Names ] Open Question : Beautiful Girl Names?
[ Baby Names ] Open Question : Beautiful Girl Names?
Me and my boyfriend made a agreement. If we have a son, my boyfriend will
name him. And if we have a daughter, I get to name her. I want to name her
something beautiful, fun, and just cute. Any ideas?
Me and my boyfriend made a agreement. If we have a son, my boyfriend will
name him. And if we have a daughter, I get to name her. I want to name her
something beautiful, fun, and just cute. Any ideas?
What is the word for a human 'copier'?
What is the word for a human 'copier'?
A word processor is the machine equivalent of a typesetter; what is the
human equivalent of a copier?
This word could describe the jobs of monks who copied the Bible, for
instance; they did not author it, but they are writing it. 'Writer' often
has the implication that this is original work.
A word processor is the machine equivalent of a typesetter; what is the
human equivalent of a copier?
This word could describe the jobs of monks who copied the Bible, for
instance; they did not author it, but they are writing it. 'Writer' often
has the implication that this is original work.
USB Jig for android smartphones
USB Jig for android smartphones
Hi, I wonder if the USB Jig ( 100Kohm and 300Kohm ) is the same for all
android devices or not ? Thank you
Hi, I wonder if the USB Jig ( 100Kohm and 300Kohm ) is the same for all
android devices or not ? Thank you
Saturday, 24 August 2013
MDX currentmember inconsistent?
MDX currentmember inconsistent?
Is there something that I am missing here or is this just not working:
This query is working as expected:
select non empty [Measures].[Reseller Sales Amount] on 0,
Filter (NonEmpty({[Geography].[Country].[Country].ALLMEMBERS *
[Geography].[City].[City].ALLMEMBERS}), [Geography].[City].Currentmember
IS [Geography].[City].&[Seattle]&[WA]) on 1
from [Adventure Works]
This one works too (different result, as expected)
select non empty [Measures].[Reseller Sales Amount] on 0,
Filter (NonEmpty({[Geography].[Country].[Country].ALLMEMBERS}),
[Geography].[City].Currentmember.MEMBER_CAPTION = 'Seattle') on 1
from [Adventure Works]
This one though, which should produce the same result as the previous
query, does not work:
select non empty [Measures].[Reseller Sales Amount] on 0,
Filter (NonEmpty({[Geography].[Country].[Country].ALLMEMBERS }),
[Geography].[City].Currentmember IS [Geography].[City].&[Seattle]&[WA]) on
1
from [Adventure Works]
Am I missing something?
Thanks.
Is there something that I am missing here or is this just not working:
This query is working as expected:
select non empty [Measures].[Reseller Sales Amount] on 0,
Filter (NonEmpty({[Geography].[Country].[Country].ALLMEMBERS *
[Geography].[City].[City].ALLMEMBERS}), [Geography].[City].Currentmember
IS [Geography].[City].&[Seattle]&[WA]) on 1
from [Adventure Works]
This one works too (different result, as expected)
select non empty [Measures].[Reseller Sales Amount] on 0,
Filter (NonEmpty({[Geography].[Country].[Country].ALLMEMBERS}),
[Geography].[City].Currentmember.MEMBER_CAPTION = 'Seattle') on 1
from [Adventure Works]
This one though, which should produce the same result as the previous
query, does not work:
select non empty [Measures].[Reseller Sales Amount] on 0,
Filter (NonEmpty({[Geography].[Country].[Country].ALLMEMBERS }),
[Geography].[City].Currentmember IS [Geography].[City].&[Seattle]&[WA]) on
1
from [Adventure Works]
Am I missing something?
Thanks.
shutdown and awaitTermination which first call have any difference?
shutdown and awaitTermination which first call have any difference?
ExecutorService eService = Executors.newFixedThreadPool(2);
eService.execute(new TestThread6());
eService.execute(new TestThread6());
eService.execute(new TestThread6());
eService.awaitTermination(1, TimeUnit.NANOSECONDS);
eService.shutdown();
or
eService.shutdown();
eService.awaitTermination(1, TimeUnit.NANOSECONDS);
have any difference? and i don't really understand shutdown():This method
does not wait for previously submitted tasks to complete execution. it
means maybe shutdown() may terminate the task which have submited,but not
complete?but i try some examples not prove it,please give me a example.
appreciate for you helps and suggestion.
ExecutorService eService = Executors.newFixedThreadPool(2);
eService.execute(new TestThread6());
eService.execute(new TestThread6());
eService.execute(new TestThread6());
eService.awaitTermination(1, TimeUnit.NANOSECONDS);
eService.shutdown();
or
eService.shutdown();
eService.awaitTermination(1, TimeUnit.NANOSECONDS);
have any difference? and i don't really understand shutdown():This method
does not wait for previously submitted tasks to complete execution. it
means maybe shutdown() may terminate the task which have submited,but not
complete?but i try some examples not prove it,please give me a example.
appreciate for you helps and suggestion.
Three.js WebGL Draw a circle custom fill and border color from shader
Three.js WebGL Draw a circle custom fill and border color from shader
I'm using Three.js with the WebGLRenderer. I'm trying to figure out or see
an example for how to draw circles using CircleGeometry and be able to
control their fill and border color from a vertex or fragment shader. Is
this even possible without using an image for the texture? Sorry if this
is really simple, I'm still trying to wrap my head around Three.js and
WebGL so any help is appreciated.
I'm using Three.js with the WebGLRenderer. I'm trying to figure out or see
an example for how to draw circles using CircleGeometry and be able to
control their fill and border color from a vertex or fragment shader. Is
this even possible without using an image for the texture? Sorry if this
is really simple, I'm still trying to wrap my head around Three.js and
WebGL so any help is appreciated.
Set delegate to an object
Set delegate to an object
This is the first time im trying to set a UITableView delegate/datasource
to an instance of an object.
I have a UIView managed by a class called hMain, and a UITableView inside
of main managed by an instance of a class called vTable.
hMain.h:
@interface hMain : UIViewController
@property (strong, nonatomic) IBOutlet vTable *voteTbl;
@end
hMain.m:
- (void)viewDidLoad
{
[super viewDidLoad];
voteTbl = [[vTable alloc]init];
[self.voteTbl setDelegate:voteTbl];
[self.voteTbl setDataSource:voteTbl];
}
vTable.h:
@interface vTable : UITableView <UITableViewDelegate , UITableViewDataSource>
@end
vTable.M:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [UITableViewCell
configureFlatCellWithColor:[UIColor greenSeaColor]
selectedColor:[UIColor wetAsphaltColor] reuseIdentifier:CellIdentifier
inTableView:(UITableView *)tableView];
if (!cell) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
[cell configureFlatCellWithColor:[UIColor greenSeaColor]
selectedColor:[UIColor wetAsphaltColor]];
}
cell.textLabel.text = @"Hello there!";
return cell;
}
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Row pressed!!");
}
This is really my first time straying away from IB and doing things
programatically so im not sure im settings delegates and things correctly.
This is also my first attempt and setting a delegate/datasource outside of
self.
My problem is the table is coming out blank every time.
This is the first time im trying to set a UITableView delegate/datasource
to an instance of an object.
I have a UIView managed by a class called hMain, and a UITableView inside
of main managed by an instance of a class called vTable.
hMain.h:
@interface hMain : UIViewController
@property (strong, nonatomic) IBOutlet vTable *voteTbl;
@end
hMain.m:
- (void)viewDidLoad
{
[super viewDidLoad];
voteTbl = [[vTable alloc]init];
[self.voteTbl setDelegate:voteTbl];
[self.voteTbl setDataSource:voteTbl];
}
vTable.h:
@interface vTable : UITableView <UITableViewDelegate , UITableViewDataSource>
@end
vTable.M:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [UITableViewCell
configureFlatCellWithColor:[UIColor greenSeaColor]
selectedColor:[UIColor wetAsphaltColor] reuseIdentifier:CellIdentifier
inTableView:(UITableView *)tableView];
if (!cell) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
[cell configureFlatCellWithColor:[UIColor greenSeaColor]
selectedColor:[UIColor wetAsphaltColor]];
}
cell.textLabel.text = @"Hello there!";
return cell;
}
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Row pressed!!");
}
This is really my first time straying away from IB and doing things
programatically so im not sure im settings delegates and things correctly.
This is also my first attempt and setting a delegate/datasource outside of
self.
My problem is the table is coming out blank every time.
Why does jquery code not working on the server but works on my PC?
Why does jquery code not working on the server but works on my PC?
I am struggling with a problem of an html page not rendering the same way
on the hosting company's server compared with my PC. This is how it looks
in Chrome: http://www.i-learn-french.com/html5/audiocards.html On my PC in
IE it looks a little different, but preserves most of its functionality,
while on the server it looks like the jquery code doesn't work.
if ($.browser.msie) {
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
var linkchrome = document.getElementById('#chromelink');
link.id = 'newlink';
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '../ie/iestyles.css';
link.media = 'all';
$(link).appendTo(head);
head.removeChild($linkchrome);
}
Why does this code work on my PC and not on the server? Thanks a lot.
I am struggling with a problem of an html page not rendering the same way
on the hosting company's server compared with my PC. This is how it looks
in Chrome: http://www.i-learn-french.com/html5/audiocards.html On my PC in
IE it looks a little different, but preserves most of its functionality,
while on the server it looks like the jquery code doesn't work.
if ($.browser.msie) {
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
var linkchrome = document.getElementById('#chromelink');
link.id = 'newlink';
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '../ie/iestyles.css';
link.media = 'all';
$(link).appendTo(head);
head.removeChild($linkchrome);
}
Why does this code work on my PC and not on the server? Thanks a lot.
How to get rid of the taste of flour in homemade bakery?
How to get rid of the taste of flour in homemade bakery?
I usually get random cookie and cake recipes from the internet and try
them. They are good but all of them have floury taste to me. Possible
culprits are the flour I use and how I mix and bake dough. I use Gold
Medal All-Purpose Flour and my hands to mix ingredients, having no mixer.
What can I get wrong? Is there an easy fix?
I usually get random cookie and cake recipes from the internet and try
them. They are good but all of them have floury taste to me. Possible
culprits are the flour I use and how I mix and bake dough. I use Gold
Medal All-Purpose Flour and my hands to mix ingredients, having no mixer.
What can I get wrong? Is there an easy fix?
get date from DateTime Object
get date from DateTime Object
After more than an hour struggling and trying I'd like to ask it here.
Trying to make something with weeks etc. in php I got from you site this:
Get all Work Days in a Week for a given date
Nice and will work for me fine.
But ... I can't get, trying and trying, the data out of this part: [date]
=> 2013-08-12 00:00:00
Array ( [0] => DateTime Object ( [date] => 2013-08-12 00:00:00
[timezone_type] => 3 [timezone] => Europe/Amsterdam )
How to get that date out of the array ? Please help me out, thanks in
advance for the help !
After more than an hour struggling and trying I'd like to ask it here.
Trying to make something with weeks etc. in php I got from you site this:
Get all Work Days in a Week for a given date
Nice and will work for me fine.
But ... I can't get, trying and trying, the data out of this part: [date]
=> 2013-08-12 00:00:00
Array ( [0] => DateTime Object ( [date] => 2013-08-12 00:00:00
[timezone_type] => 3 [timezone] => Europe/Amsterdam )
How to get that date out of the array ? Please help me out, thanks in
advance for the help !
HTML Set the height of the link element into its background
HTML Set the height of the link element into its background
I would like to ask for help because I could not set the height of the
link element (HOME,GAMES,ANIMALS,LOGOUT). The html code:
echo"<div id=\"navigation_bar\">";
echo"<ul>";
echo" <li id=\"home\"><a href=\"animal_home.php\" >HOME</a></li>";
echo" <li id=\"laro\"><a href=\"animal_laro.php\">GAMES</a></li>";
echo" <li id=\"aralin\"><a href=\"animals.php\">ANIMALS</a></li>";
echo" <li id=\"logout\"><a href=\"animal_logout.php\">LOGOUT</a></li>";
echo"</ul>";
echo"</div>";
While this is the css:
#navigation_bar ul {
display:block;
float:left;
width:800px;
height:50px;
background:url(images/animal_home_nav.png) no-repeat center;
list-style:none;
}
#navigation_bar ul li {
display:block;
float:left;
height:50px;
}
#home{
width:190px;
}
#aralin {
width:220px;
}
#laro {
width:161px;
}
#logout{
width:200px;
}
I would like to ask for help because I could not set the height of the
link element (HOME,GAMES,ANIMALS,LOGOUT). The html code:
echo"<div id=\"navigation_bar\">";
echo"<ul>";
echo" <li id=\"home\"><a href=\"animal_home.php\" >HOME</a></li>";
echo" <li id=\"laro\"><a href=\"animal_laro.php\">GAMES</a></li>";
echo" <li id=\"aralin\"><a href=\"animals.php\">ANIMALS</a></li>";
echo" <li id=\"logout\"><a href=\"animal_logout.php\">LOGOUT</a></li>";
echo"</ul>";
echo"</div>";
While this is the css:
#navigation_bar ul {
display:block;
float:left;
width:800px;
height:50px;
background:url(images/animal_home_nav.png) no-repeat center;
list-style:none;
}
#navigation_bar ul li {
display:block;
float:left;
height:50px;
}
#home{
width:190px;
}
#aralin {
width:220px;
}
#laro {
width:161px;
}
#logout{
width:200px;
}
const variable value is changed by using a pointer
const variable value is changed by using a pointer
The output of the following program is 50 on gcc. How is it possible as x
is constant variable and *p is x itself as p is a constant pointer
pointing to value at x. Where as turbo c gives compiler error. Is it an
undefined behaviour? please explain.
#include<stdio.h>
void main(){
const int x=25;
int * const p=&x;
*p=2*x;
printf("%d",x);
}
The output of the following program is 50 on gcc. How is it possible as x
is constant variable and *p is x itself as p is a constant pointer
pointing to value at x. Where as turbo c gives compiler error. Is it an
undefined behaviour? please explain.
#include<stdio.h>
void main(){
const int x=25;
int * const p=&x;
*p=2*x;
printf("%d",x);
}
Friday, 23 August 2013
Passing an array of objects from view to controller
Passing an array of objects from view to controller
I want to pass an array of objects to controller. Namely, in
preview.html.erb, I have an array @imported companies which have no ids
yet (not saved yet). I want to pass it to call save_imported method in
company_imports_controller.rb. In the save_imported method, I will save
all the objects in @imported companies. Since the objects do not have ID
yet so I can not pass the IDs via params.
I want to pass an array of objects to controller. Namely, in
preview.html.erb, I have an array @imported companies which have no ids
yet (not saved yet). I want to pass it to call save_imported method in
company_imports_controller.rb. In the save_imported method, I will save
all the objects in @imported companies. Since the objects do not have ID
yet so I can not pass the IDs via params.
How to install python 2.7.5 as 64bit?
How to install python 2.7.5 as 64bit?
When downloading the python 2.7.5 here, I download the python installer
with the link "Python 2.7.5 Mac OS X 64-bit/32-bit x86-64/i386 Installer
(for Mac OS X 10.6 and later [2])". Installed the python, I cd the
directory "/Library/Frameworks/Python.framework/Versions/2.7" and execute
the following python code:
import sys
print sys.maxint
and I get 2147483647 which means I am runing the python of 32bit version.
How can I install the python of 64bit version?
When downloading the python 2.7.5 here, I download the python installer
with the link "Python 2.7.5 Mac OS X 64-bit/32-bit x86-64/i386 Installer
(for Mac OS X 10.6 and later [2])". Installed the python, I cd the
directory "/Library/Frameworks/Python.framework/Versions/2.7" and execute
the following python code:
import sys
print sys.maxint
and I get 2147483647 which means I am runing the python of 32bit version.
How can I install the python of 64bit version?
ODataService Type Provider error: (401) Unauthorized
ODataService Type Provider error: (401) Unauthorized
The type provider
'Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders' reported an
error: Error reading schema. The remote server returned an error: (401)
Unauthorized.
Is there a way to use the OData type provider with an OData service which
requires a username and password?
The type provider
'Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders' reported an
error: Error reading schema. The remote server returned an error: (401)
Unauthorized.
Is there a way to use the OData type provider with an OData service which
requires a username and password?
CakePHP: Cant use html helper inside my helper, causes fatal error
CakePHP: Cant use html helper inside my helper, causes fatal error
echo $this->Html->link($menuItem->title, array('controller' =>
$controllerName, 'action' => $menuItem->action)) creates fatal error.
My full code:
App::uses('AppHelper', 'View/Helper');
class MenuHelper extends AppHelper {
public $helpers = array('Html');
public $module;
public function __construct() {
//$module is a 2D associative array containing the menu list for each
module. The first index is the name of the module to be displayed and
the second index is the name of controller. The content is the array
of menuItem objects
$this->module['Meeting Management']['meetings'] = array(new
MenuItem('Create New Meeting', 'createMeeting', array('BUGS
Secretary')),
new MenuItem('View Draft Meetings', 'viewDraft', array('BUGS
Secretary', 'Teacher')),
new MenuItem('View Closed Meetings', 'viewClosed', array('BUGS
Secretary')),
new MenuItem('View Draft Resolutions', 'viewDraftResolutions',
array('BUGS Secretary', 'Teacher')),
new MenuItem('View Resolutions Sent to Head', 'viewSentToHead',
array('BUGS Secretary', 'Head')),
new MenuItem('View Sent Back Meetings', 'viewSentBack',
array('BUGS Secretary')),
new MenuItem('View Approved Resolutions', 'viewApproved',
array('BUGS Secretary', 'Head')),
new MenuItem('View All Meetings', 'viewAll', array('Teacher')),
new MenuItem('Search Meeting', 'searchMeeting', array('Teacher'))
);
$this->module['Application Management']['applications'] = array(new
MenuItem('Create Application', 'selectApplication', array('Student')),
new MenuItem('Application List', 'viewAll', array('Student',
'Head', 'Advisor', 'BUGS Secretary'))
);
}
public function genereteMenuList($currentRole) {
foreach ($this->module as $moduleName => $menuContent) {
foreach ($menuContent as $controllerName => $menuList) {
$visibleMenuList = $this->getVisibleMenuList($currentRole,
$menuList);
if (!empty($visibleMenuList)) {
echo '<h2>' . $moduleName . '</h2>';
echo '<ul>';
foreach ($visibleMenuList as $menuItem) {
echo '<li>';
echo $this->Html->link($menuItem->title,
array('controller' => $controllerName, 'action' =>
$menuItem->action));
echo '</li>';
}
echo '</ul>';
}
}
}
}
public function getVisibleMenuList($currentRole, $menuList) {
if (is_null($currentRole))
return array();
$visibleMenuList = array();
foreach ($menuList as $menuItem) {
if (in_array($currentRole, $menuItem->permittedRoles)) {
$visibleMenuList[] = $menuItem;
}
}
return $visibleMenuList;
}
}
class MenuItem {
public $action;
public $title;
public $permittedRoles; //who can access this menu
public function __construct($title, $action, $permittedRoles) {
$this->action = $action;
$this->title = $title;
$this->permittedRoles = $permittedRoles;
}
}
echo $this->Html->link($menuItem->title, array('controller' =>
$controllerName, 'action' => $menuItem->action)) creates fatal error.
My full code:
App::uses('AppHelper', 'View/Helper');
class MenuHelper extends AppHelper {
public $helpers = array('Html');
public $module;
public function __construct() {
//$module is a 2D associative array containing the menu list for each
module. The first index is the name of the module to be displayed and
the second index is the name of controller. The content is the array
of menuItem objects
$this->module['Meeting Management']['meetings'] = array(new
MenuItem('Create New Meeting', 'createMeeting', array('BUGS
Secretary')),
new MenuItem('View Draft Meetings', 'viewDraft', array('BUGS
Secretary', 'Teacher')),
new MenuItem('View Closed Meetings', 'viewClosed', array('BUGS
Secretary')),
new MenuItem('View Draft Resolutions', 'viewDraftResolutions',
array('BUGS Secretary', 'Teacher')),
new MenuItem('View Resolutions Sent to Head', 'viewSentToHead',
array('BUGS Secretary', 'Head')),
new MenuItem('View Sent Back Meetings', 'viewSentBack',
array('BUGS Secretary')),
new MenuItem('View Approved Resolutions', 'viewApproved',
array('BUGS Secretary', 'Head')),
new MenuItem('View All Meetings', 'viewAll', array('Teacher')),
new MenuItem('Search Meeting', 'searchMeeting', array('Teacher'))
);
$this->module['Application Management']['applications'] = array(new
MenuItem('Create Application', 'selectApplication', array('Student')),
new MenuItem('Application List', 'viewAll', array('Student',
'Head', 'Advisor', 'BUGS Secretary'))
);
}
public function genereteMenuList($currentRole) {
foreach ($this->module as $moduleName => $menuContent) {
foreach ($menuContent as $controllerName => $menuList) {
$visibleMenuList = $this->getVisibleMenuList($currentRole,
$menuList);
if (!empty($visibleMenuList)) {
echo '<h2>' . $moduleName . '</h2>';
echo '<ul>';
foreach ($visibleMenuList as $menuItem) {
echo '<li>';
echo $this->Html->link($menuItem->title,
array('controller' => $controllerName, 'action' =>
$menuItem->action));
echo '</li>';
}
echo '</ul>';
}
}
}
}
public function getVisibleMenuList($currentRole, $menuList) {
if (is_null($currentRole))
return array();
$visibleMenuList = array();
foreach ($menuList as $menuItem) {
if (in_array($currentRole, $menuItem->permittedRoles)) {
$visibleMenuList[] = $menuItem;
}
}
return $visibleMenuList;
}
}
class MenuItem {
public $action;
public $title;
public $permittedRoles; //who can access this menu
public function __construct($title, $action, $permittedRoles) {
$this->action = $action;
$this->title = $title;
$this->permittedRoles = $permittedRoles;
}
}
Would a high quality USB 3 SSD beat the speeds of a SATA II internal 7200rpm for gaming?
Would a high quality USB 3 SSD beat the speeds of a SATA II internal
7200rpm for gaming?
Not entirely sure if Stack Overflow deals with general hardware
questions... but I figured if anyone would have a shot at knowing, you
guys would! =D
I have a gaming laptop and a desktop that I switch between pretty
regularly due to not being home often. Rather than purchasing two SSDs, I
was considering whether I could get away with getting a single USB 3 SSD
and installing the games I needed on it instead!
I currently have SATA II , 7200rpm drives drives in both. Standard drives,
basically. I'm looking to see a performance increase on load times on both
machines, and was curious whether the USB 3 SSD would be able to
outperform them in this regard or not. It seems like it would, but I've
heard latency across USB 3 can actually be pretty bad, so I don't want to
put out the money necessary to get this drive and find out that, in
actuality, it comes out slower!
Just for a side note- the laptop does not have an esata drive, so I that
isn't an option. :-\
So what do you guys think: Would a high quality USB 3 SSD beat the load
speeds of a SATA II internal 7200rpm for gaming?
7200rpm for gaming?
Not entirely sure if Stack Overflow deals with general hardware
questions... but I figured if anyone would have a shot at knowing, you
guys would! =D
I have a gaming laptop and a desktop that I switch between pretty
regularly due to not being home often. Rather than purchasing two SSDs, I
was considering whether I could get away with getting a single USB 3 SSD
and installing the games I needed on it instead!
I currently have SATA II , 7200rpm drives drives in both. Standard drives,
basically. I'm looking to see a performance increase on load times on both
machines, and was curious whether the USB 3 SSD would be able to
outperform them in this regard or not. It seems like it would, but I've
heard latency across USB 3 can actually be pretty bad, so I don't want to
put out the money necessary to get this drive and find out that, in
actuality, it comes out slower!
Just for a side note- the laptop does not have an esata drive, so I that
isn't an option. :-\
So what do you guys think: Would a high quality USB 3 SSD beat the load
speeds of a SATA II internal 7200rpm for gaming?
Cat into fifo not running through bash
Cat into fifo not running through bash
I want to script these few lines
mkfifo my.fifo
cat >my.fifo &
cat my.fifo | nc remotehost.tld 10000
But the line
cat >my.fifo &
When i run it manually it works, but not through bash shell. what could be
the reason for it?
I want to script these few lines
mkfifo my.fifo
cat >my.fifo &
cat my.fifo | nc remotehost.tld 10000
But the line
cat >my.fifo &
When i run it manually it works, but not through bash shell. what could be
the reason for it?
Thursday, 22 August 2013
How to read the csv file and send the email to the users in it?
How to read the csv file and send the email to the users in it?
My code is
@echo on
setlocal ENABLEDELAYEDEXPANSION
setlocal
for /f "tokens=*" %%i in (output.csv)
do
(
for /f "tokens=1,2,3,4 delims=," %%a in ("%%i")
do
(
set date=%%a
set usr=%%b
set email=%%c
set nodays=%%d
set sub=Notification for password expiry
GOTO checkv
GOTO gotit
)
)
:checkv
IF [%nodays%] LEQ [10]
IF [%nodays%] GTR [0] (echo Your password for user %usr% is about to expire.)
IF [%nodays%] LEQ [0] (echo Tour password for user %usr% is expired.)
goto exit
:gotit
blat -body %body% -to %email% -server %smtpserver% -f %from_user%
-subject %sub% -sig %signature%
goto exit
But I get an error as below
C:\batch script>(
set date=17
set usr=priyanka
set email=pripawar@gmail.com
set nodays=9
set sub=Notification for password expiry
GOTO checkv
GOTO gotit
)
The syntax of the command is incorrect.
C:\batch script>IF [9] LEQ [10]
C:\batch script>
It seems it fails at the If condition. Can anyone help to get it work...
My code is
@echo on
setlocal ENABLEDELAYEDEXPANSION
setlocal
for /f "tokens=*" %%i in (output.csv)
do
(
for /f "tokens=1,2,3,4 delims=," %%a in ("%%i")
do
(
set date=%%a
set usr=%%b
set email=%%c
set nodays=%%d
set sub=Notification for password expiry
GOTO checkv
GOTO gotit
)
)
:checkv
IF [%nodays%] LEQ [10]
IF [%nodays%] GTR [0] (echo Your password for user %usr% is about to expire.)
IF [%nodays%] LEQ [0] (echo Tour password for user %usr% is expired.)
goto exit
:gotit
blat -body %body% -to %email% -server %smtpserver% -f %from_user%
-subject %sub% -sig %signature%
goto exit
But I get an error as below
C:\batch script>(
set date=17
set usr=priyanka
set email=pripawar@gmail.com
set nodays=9
set sub=Notification for password expiry
GOTO checkv
GOTO gotit
)
The syntax of the command is incorrect.
C:\batch script>IF [9] LEQ [10]
C:\batch script>
It seems it fails at the If condition. Can anyone help to get it work...
Fast way to find a matrix with only $0$ and $1$ as entries full-rank or not?
Fast way to find a matrix with only $0$ and $1$ as entries full-rank or not?
I have a huge number of small Zero-One Matrices($4\times 4$,
$5\times5$,$6\times6$) and I want to determine whether they are full-rank
or not one by one.
Gaussian elimination is a option, I want to know is there any faster way
since only $1$s and $0$s in the matrices.
I have a huge number of small Zero-One Matrices($4\times 4$,
$5\times5$,$6\times6$) and I want to determine whether they are full-rank
or not one by one.
Gaussian elimination is a option, I want to know is there any faster way
since only $1$s and $0$s in the matrices.
Binding exception with dynamic keyword in c#
Binding exception with dynamic keyword in c#
I am loading my assemblies at run time and I am also using Instance
Activator to get the code at the runtime. Following code will summerize
what I am doing:
dynamic powerTool;
System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(
@"C:\Users\c_desaik\Desktop\PowerTool.exe");
Type type = assembly.GetType("PowerTool.Automation");
powerTool = Activator.CreateInstance(type);
Now, as you have noticed, Powertool has been declared as dynamic because I
do not want my code to fail at Compile time and I want it to resolve all
the operations at the Runtime.
While I do that the code fails to execute down the line with the following
error:
An unexpected exception occurred while binding a dynamic operation
Now I thought that the entire concept behind the dynamic keyword was to be
abl eto resove all the members and operation at the run time. How can I
resolve this error?
I am loading my assemblies at run time and I am also using Instance
Activator to get the code at the runtime. Following code will summerize
what I am doing:
dynamic powerTool;
System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(
@"C:\Users\c_desaik\Desktop\PowerTool.exe");
Type type = assembly.GetType("PowerTool.Automation");
powerTool = Activator.CreateInstance(type);
Now, as you have noticed, Powertool has been declared as dynamic because I
do not want my code to fail at Compile time and I want it to resolve all
the operations at the Runtime.
While I do that the code fails to execute down the line with the following
error:
An unexpected exception occurred while binding a dynamic operation
Now I thought that the entire concept behind the dynamic keyword was to be
abl eto resove all the members and operation at the run time. How can I
resolve this error?
Copy value of a DateTime
Copy value of a DateTime
I'm sure this is painfully trivial, but I'm trying to do something like this:
DateTime dt1;
DateTime dt2;
At some point, dt1 is given the value DateTime.Now. Later, I want to put
the value of dt1 into dt2 and then put DateTime.Now in dt1 again. When I
try to assign dt2 = dt1 and then do dt1 = DateTime.Now, dt2 now contains
the DateTime.Now I put in dt1, so it is clearly using references instead
of assigning values.
How can I accomplish what I want?
I'm sure this is painfully trivial, but I'm trying to do something like this:
DateTime dt1;
DateTime dt2;
At some point, dt1 is given the value DateTime.Now. Later, I want to put
the value of dt1 into dt2 and then put DateTime.Now in dt1 again. When I
try to assign dt2 = dt1 and then do dt1 = DateTime.Now, dt2 now contains
the DateTime.Now I put in dt1, so it is clearly using references instead
of assigning values.
How can I accomplish what I want?
Mvc .net: Upload Multiple files in multiple fields via one http post
Mvc .net: Upload Multiple files in multiple fields via one http post
I have model, with three properties:
IEnumerable<File> photos
IEnumerable<File>Logos
File Video
Can I post this model to a controller via on POST method? how can I
configure to get files in controller?
I have model, with three properties:
IEnumerable<File> photos
IEnumerable<File>Logos
File Video
Can I post this model to a controller via on POST method? how can I
configure to get files in controller?
Jquery not working in dynamically generated form
Jquery not working in dynamically generated form
I am generating a form in www.sitetwo.com by using some scripts called
from www.siteone.com. As I have to submit the form in www.sitetwo.com to
www.siteone.com, I am using Ajax using JSONP method. But, the generated
form is not supporting any scripts. My code is here:
//script in www.sitetwo.com
<script type="text/javascript">
window.onload = function () {
"use strict";
function js(n) {
var s = document.createElement('script');
s.setAttribute("type", "text/javascript");
s.setAttribute("src", n);
document.getElementsByTagName("head")[0].appendChild(s);
}
js("http://www.siteone.com/script.js");
};
$(document).ready(function(){
$=jQuery.noConflict();
$(".submitbutton").hover(function(){
alert("hai");
}
</script>
<div id="newform">
</div>
The form that is dynamically rendered in div with id newform is as follows:
<form>
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="go" class="submitbutton">
</form>
I tried applying basic script of on hover alert.But it isn't working.
cannot we use directly scripts like this for dynamically generated forms.
If so how can we overcome this problem. I have searched for errors in
browser. No error is shown. What can be the solution??
I am generating a form in www.sitetwo.com by using some scripts called
from www.siteone.com. As I have to submit the form in www.sitetwo.com to
www.siteone.com, I am using Ajax using JSONP method. But, the generated
form is not supporting any scripts. My code is here:
//script in www.sitetwo.com
<script type="text/javascript">
window.onload = function () {
"use strict";
function js(n) {
var s = document.createElement('script');
s.setAttribute("type", "text/javascript");
s.setAttribute("src", n);
document.getElementsByTagName("head")[0].appendChild(s);
}
js("http://www.siteone.com/script.js");
};
$(document).ready(function(){
$=jQuery.noConflict();
$(".submitbutton").hover(function(){
alert("hai");
}
</script>
<div id="newform">
</div>
The form that is dynamically rendered in div with id newform is as follows:
<form>
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="go" class="submitbutton">
</form>
I tried applying basic script of on hover alert.But it isn't working.
cannot we use directly scripts like this for dynamically generated forms.
If so how can we overcome this problem. I have searched for errors in
browser. No error is shown. What can be the solution??
SAP Com Objects and .GetType/.GetProperties
SAP Com Objects and .GetType/.GetProperties
I'm trying to access the table that is returned from BAPI function calls.
They don't return a normal status/error message but a table called
BAPIRET1. The table is then stored in a COM Object called Bapi_return.
I've been desperately trying to get the data out of this COM Object, but
to no avail. I've seen someone use Reflections with .GetType and
.GetProperties in C#. The relevant parts of his code look like this:
Type type = bapiReturn.GetType();
PropertyInfo[] infos = type.GetProperties();
foreach (PropertyInfo info in infos)
{
switch (info.Name.ToUpper())
{
case "TYPE":
myType = (string)info.GetValue(bapiReturn, null);
break;
...
Source
I've tried to do the same in VB .NET:
...
'Code that returns the Table
CO13 = R3.add("BAPI_PRODORDCONF_CANCEL")
CO13.exports("CONFIRMATION") = confirmationnr
CO13.exports("CONFIRMATIONCOUNTER") = cnfrmcnt
Bapi_return = CO13.imports("RETURN")
BapiService.Transactioncommit()
'Trying to access the table data via GetProperties
Dim type As Type
Dim infos As Reflection.PropertyInfo()
type = Bapi_return.GetType()
infos = type.GetProperties()
This is where I am stuck though. GetProperties only returns a generic COM
Object with which I can't really do anything and leaves the array "infos"
empty. There is a workaround to get the proper type with InvokeMember:
type = Bapi_return.GetType().InvokeMember("Type",
System.Reflection.BindingFlags.GetProperty, Nothing, Bapi_return,
Nothing)
This returns the correct type (BAPIRET1) but can't be assigned to the
variable type because "BAPIRET1" is returned as a string. I would assume
that VB .NET simply doesn't know the BAPIRET1 and therefore my method
can't work, but the website I have the C# code from successfully uses
.GetType and .GetProperty on BAPIRET1. So there must be a way.
Any help on my specific problem or help on reading BAPIRET1 tables in VB.
NET would be greatly appreciated!
I'm trying to access the table that is returned from BAPI function calls.
They don't return a normal status/error message but a table called
BAPIRET1. The table is then stored in a COM Object called Bapi_return.
I've been desperately trying to get the data out of this COM Object, but
to no avail. I've seen someone use Reflections with .GetType and
.GetProperties in C#. The relevant parts of his code look like this:
Type type = bapiReturn.GetType();
PropertyInfo[] infos = type.GetProperties();
foreach (PropertyInfo info in infos)
{
switch (info.Name.ToUpper())
{
case "TYPE":
myType = (string)info.GetValue(bapiReturn, null);
break;
...
Source
I've tried to do the same in VB .NET:
...
'Code that returns the Table
CO13 = R3.add("BAPI_PRODORDCONF_CANCEL")
CO13.exports("CONFIRMATION") = confirmationnr
CO13.exports("CONFIRMATIONCOUNTER") = cnfrmcnt
Bapi_return = CO13.imports("RETURN")
BapiService.Transactioncommit()
'Trying to access the table data via GetProperties
Dim type As Type
Dim infos As Reflection.PropertyInfo()
type = Bapi_return.GetType()
infos = type.GetProperties()
This is where I am stuck though. GetProperties only returns a generic COM
Object with which I can't really do anything and leaves the array "infos"
empty. There is a workaround to get the proper type with InvokeMember:
type = Bapi_return.GetType().InvokeMember("Type",
System.Reflection.BindingFlags.GetProperty, Nothing, Bapi_return,
Nothing)
This returns the correct type (BAPIRET1) but can't be assigned to the
variable type because "BAPIRET1" is returned as a string. I would assume
that VB .NET simply doesn't know the BAPIRET1 and therefore my method
can't work, but the website I have the C# code from successfully uses
.GetType and .GetProperty on BAPIRET1. So there must be a way.
Any help on my specific problem or help on reading BAPIRET1 tables in VB.
NET would be greatly appreciated!
Wednesday, 21 August 2013
exist-db update insert very slow
exist-db update insert very slow
I am a beginner with exist-db. I am building an xml document through Java.
I process data through JAXB and then insert into exist-db resource through
insert update. I am testing with around 500 nodes at this time and it
starts taking up to 10 seconds per insert after a few dozen have executed.
My XML has the following general structure.
<realestatedata>
<agents>
<author id="1">
<name>Author_A</name>
</author>
<author id="2">
<name>Author_B</name>
</author>
<portal id="1">
<name>Portal_A</name>
</portal>
</agents>
<artifacts>
<document id="1">
<latitude>51.37392</latitude>
<longitude>-0.00866</longitude>
<bathroom_number>1</bathroom_number>
<bedroom_number>3</bedroom_number>
<price>365000</price>
</document>
<theme id="1">
<name>Garden</name>
</theme>
<place id="1">
<name>BR4</name>
<location>
<lat>51.37392</lat>
<lon>-0.00866</lon>
</location>
</place>
</artifacts>
</realestatedata>
To ensure elements are placed at correct order, I am using the following
code for insert update so a new record of its type is either the first one
or is appended at the end of similar elements based on ids.
public void saveAuthor(Author author) {
XQueryService xQueryService = null;
CompiledExpression compiled = null;
int currentId = authorIdSequence.get();
StringWriter authorXml = new StringWriter();
try {
xQueryService = Utils.getXQeuryService();
if (getAuthorByName(author.getName()) == null) {
author.setId(String.valueOf(authorIdSequence.incrementAndGet()));
marshaller.marshal(author, authorXml);
if(currentId == 0){
compiled = xQueryService
.compile("update insert " + authorXml.toString()
+ " into //agents");
}
else{
compiled = xQueryService
.compile("update insert " + authorXml.toString()
+ " following //author[@id =
'"+String.valueOf(currentId)+"']");
}
xQueryService.execute(compiled);
}
} catch (XMLDBException e) {
e.printStackTrace();
} catch (JAXBException e) {
e.printStackTrace();
}
}
The same methods are executed for other elements like document, place etc.
After a few updates, it gets very slow. It starts taking up to ten seconds
to insert one record.
I am a beginner with exist-db. I am building an xml document through Java.
I process data through JAXB and then insert into exist-db resource through
insert update. I am testing with around 500 nodes at this time and it
starts taking up to 10 seconds per insert after a few dozen have executed.
My XML has the following general structure.
<realestatedata>
<agents>
<author id="1">
<name>Author_A</name>
</author>
<author id="2">
<name>Author_B</name>
</author>
<portal id="1">
<name>Portal_A</name>
</portal>
</agents>
<artifacts>
<document id="1">
<latitude>51.37392</latitude>
<longitude>-0.00866</longitude>
<bathroom_number>1</bathroom_number>
<bedroom_number>3</bedroom_number>
<price>365000</price>
</document>
<theme id="1">
<name>Garden</name>
</theme>
<place id="1">
<name>BR4</name>
<location>
<lat>51.37392</lat>
<lon>-0.00866</lon>
</location>
</place>
</artifacts>
</realestatedata>
To ensure elements are placed at correct order, I am using the following
code for insert update so a new record of its type is either the first one
or is appended at the end of similar elements based on ids.
public void saveAuthor(Author author) {
XQueryService xQueryService = null;
CompiledExpression compiled = null;
int currentId = authorIdSequence.get();
StringWriter authorXml = new StringWriter();
try {
xQueryService = Utils.getXQeuryService();
if (getAuthorByName(author.getName()) == null) {
author.setId(String.valueOf(authorIdSequence.incrementAndGet()));
marshaller.marshal(author, authorXml);
if(currentId == 0){
compiled = xQueryService
.compile("update insert " + authorXml.toString()
+ " into //agents");
}
else{
compiled = xQueryService
.compile("update insert " + authorXml.toString()
+ " following //author[@id =
'"+String.valueOf(currentId)+"']");
}
xQueryService.execute(compiled);
}
} catch (XMLDBException e) {
e.printStackTrace();
} catch (JAXBException e) {
e.printStackTrace();
}
}
The same methods are executed for other elements like document, place etc.
After a few updates, it gets very slow. It starts taking up to ten seconds
to insert one record.
Different of mapsto and right arrow
Different of mapsto and right arrow
Could someone please explain to me what is the difference in the two
arrows$$\rightarrow$$ and $$\mapsto$$ For example in Probability wih
Martingales (Willams)
Thank you.
Could someone please explain to me what is the difference in the two
arrows$$\rightarrow$$ and $$\mapsto$$ For example in Probability wih
Martingales (Willams)
Thank you.
How do I shutdown a node project started by Forever? ungit
How do I shutdown a node project started by Forever? ungit
I'm using the open source project called Ungit. It is based on node.js and
I really enjoy it but I don't know how to shut it off other than rebooting
the whole box.
Ungit is using "forever-monitor" to have a process run forever. So when I
do nohup ungit > /dev/null & I can't shut it down by killing it's process
as it will restart it.
I have looked up forever-monitor project and I was able to install it
globally and try to shut it by running forever stop [number] but forever
list shows nothing and I don't know how to shut it down.
Thanks for any advices,
I'm using the open source project called Ungit. It is based on node.js and
I really enjoy it but I don't know how to shut it off other than rebooting
the whole box.
Ungit is using "forever-monitor" to have a process run forever. So when I
do nohup ungit > /dev/null & I can't shut it down by killing it's process
as it will restart it.
I have looked up forever-monitor project and I was able to install it
globally and try to shut it by running forever stop [number] but forever
list shows nothing and I don't know how to shut it down.
Thanks for any advices,
javascript code in while loop
javascript code in while loop
i want to use javascript code in a php while loop, but it doesn't work. I
get records from mysql database by a while loop. But javascript code works
for only first record and doesn't work for others. How can i fix this
trouble? This is my code:
$query_d="SELECT id,videocode FROM series ORDER BY id DESC LIMIT 0,12";
$result_d= @mysql_query ($query_d) or die(mysql_error());
while($row_d= mysql_fetch_row($result_d))
{
echo "<video id='vid1' width=\"280\" height=\"200\"
style=\"float:left;margin-right:5px\" controls>";
echo "<source src=".$url_path.$row_dizi[5].".mp4"." type=\"video/mp4\">";
echo "<source src=".$url_path.$row_dizi[5].".ogv"." type=\"video/ogg\">";
echo "Your browser does not support the video tag.";echo "</video>";
echo "<scriptlanguage= 'javascript'type='text/javascript'>".
"document.getElementById('vid1').addEventListener('loadedmetadata',
function() {this.currentTime = 10;}, false);</script>";
}
i want to use javascript code in a php while loop, but it doesn't work. I
get records from mysql database by a while loop. But javascript code works
for only first record and doesn't work for others. How can i fix this
trouble? This is my code:
$query_d="SELECT id,videocode FROM series ORDER BY id DESC LIMIT 0,12";
$result_d= @mysql_query ($query_d) or die(mysql_error());
while($row_d= mysql_fetch_row($result_d))
{
echo "<video id='vid1' width=\"280\" height=\"200\"
style=\"float:left;margin-right:5px\" controls>";
echo "<source src=".$url_path.$row_dizi[5].".mp4"." type=\"video/mp4\">";
echo "<source src=".$url_path.$row_dizi[5].".ogv"." type=\"video/ogg\">";
echo "Your browser does not support the video tag.";echo "</video>";
echo "<scriptlanguage= 'javascript'type='text/javascript'>".
"document.getElementById('vid1').addEventListener('loadedmetadata',
function() {this.currentTime = 10;}, false);</script>";
}
Sorting values of an excel column by max occurrences using VB.net
Sorting values of an excel column by max occurrences using VB.net
I have an excel file which has column B1 to B500 (may vary) filled with
numbers. For example:
![sample data][1]
I need the output to be like:
![sample output][2]
I have this much code till now:
Sub Max()
Dim i As Long, j As Long
Dim cl As Excel.Range
i = 1
j = 1
For i = sheet.UsedRange.Rows.Count To 1 Step -1
cl = sheet.Cells(i, 2) '## Examine the cell in Column B
If xl.WorksheetFunction.CountIf(sheet.Range("B:B"), cl.Value) > 1
Then
cl.Value = sheet.Cells(j, 3).value 'copy to Column C
End If
j = j + 1
Next i
End Sub
What this code does is to find duplicates in column B and remove other
entries from the column. Nothing gets written in column C. I want the
column B to be unedited at the end. Also cannot figure out how to achieve
the sorting here.
Please help.
I have an excel file which has column B1 to B500 (may vary) filled with
numbers. For example:
![sample data][1]
I need the output to be like:
![sample output][2]
I have this much code till now:
Sub Max()
Dim i As Long, j As Long
Dim cl As Excel.Range
i = 1
j = 1
For i = sheet.UsedRange.Rows.Count To 1 Step -1
cl = sheet.Cells(i, 2) '## Examine the cell in Column B
If xl.WorksheetFunction.CountIf(sheet.Range("B:B"), cl.Value) > 1
Then
cl.Value = sheet.Cells(j, 3).value 'copy to Column C
End If
j = j + 1
Next i
End Sub
What this code does is to find duplicates in column B and remove other
entries from the column. Nothing gets written in column C. I want the
column B to be unedited at the end. Also cannot figure out how to achieve
the sorting here.
Please help.
How to generate card number so the users cannot follow how much is sold?
How to generate card number so the users cannot follow how much is sold?
I want some generator script to generate unique numbers but not in one
order. We need to sell tickets.
For example currently ticket numbers are like this:
100000
100001
100002
...
So the users can see how many are sold.
How can I generate unique numbers?
for example:
151647
457561
752163
...
I could use random number generator, but then I have always check in
database if such number has not been generated.
Hmm, maybe when using index on that column - the check would not take long.
Still now I have to get last card number, if I want to add 1 to it, but
getting last is fast enough.
And the more tickets will be sold, then bigger chance that RNG will
generate existing number. So migth be more checks in future. SO the best
would be to take last number and generate next by it.
I want some generator script to generate unique numbers but not in one
order. We need to sell tickets.
For example currently ticket numbers are like this:
100000
100001
100002
...
So the users can see how many are sold.
How can I generate unique numbers?
for example:
151647
457561
752163
...
I could use random number generator, but then I have always check in
database if such number has not been generated.
Hmm, maybe when using index on that column - the check would not take long.
Still now I have to get last card number, if I want to add 1 to it, but
getting last is fast enough.
And the more tickets will be sold, then bigger chance that RNG will
generate existing number. So migth be more checks in future. SO the best
would be to take last number and generate next by it.
What is the maximum number of rows in column set with varchar
What is the maximum number of rows in column set with varchar
What is the maximum number of rows allowed in a column set with a variable
length (varchar) data type?
What is the maximum number of rows allowed in a column set with a variable
length (varchar) data type?
Tuesday, 20 August 2013
Get last updated time for all items grouped by category
Get last updated time for all items grouped by category
here is my table of items:
id (int)
category_id (int)
title (varchar 255)
updated_timestamp (int)
Each item has a category_id. Let's say I have this data:
1 | 14 | item 1 | 1376164492
2 | 11 | item 2 | 1376164508
3 | 12 | item 3 | 1376164512
4 | 14 | item 4 | 1376164532
5 | 12 | item 5 | 1376164542
6 | 11 | item 6 | 1376164552
My goal is to get last update timestamp for each category. As a result I
need this:
11 = 1376164522 (greatest value for all items with category_id = 11)
12 = 1376164542 (greatest value for all items with category_id = 12)
14 = 1376164532 (greatest value for all items with category_id = 14)
Here is my SQL:
SELECT
`category_id`, `updated_timestamp`
FROM
`my_table`
GROUP BY
`category_id`
ORDER BY
`updated_timestamp`
DESC
But when I run it I have a result like this:
11 = 1376164508 (lowest value for all items with category_id = 11)
12 = 1376164512 (greatest value for all items with category_id = 12)
14 = 1376164492 (greatest value for all items with category_id = 14)
Another words, DESC does not work. What I am doing wrong?
Thank you!
here is my table of items:
id (int)
category_id (int)
title (varchar 255)
updated_timestamp (int)
Each item has a category_id. Let's say I have this data:
1 | 14 | item 1 | 1376164492
2 | 11 | item 2 | 1376164508
3 | 12 | item 3 | 1376164512
4 | 14 | item 4 | 1376164532
5 | 12 | item 5 | 1376164542
6 | 11 | item 6 | 1376164552
My goal is to get last update timestamp for each category. As a result I
need this:
11 = 1376164522 (greatest value for all items with category_id = 11)
12 = 1376164542 (greatest value for all items with category_id = 12)
14 = 1376164532 (greatest value for all items with category_id = 14)
Here is my SQL:
SELECT
`category_id`, `updated_timestamp`
FROM
`my_table`
GROUP BY
`category_id`
ORDER BY
`updated_timestamp`
DESC
But when I run it I have a result like this:
11 = 1376164508 (lowest value for all items with category_id = 11)
12 = 1376164512 (greatest value for all items with category_id = 12)
14 = 1376164492 (greatest value for all items with category_id = 14)
Another words, DESC does not work. What I am doing wrong?
Thank you!
How do I set up a second monitor? Ubuntu 12.04 (Dell Inspiron 3520 Laptop + Dell E173FP monitor)
How do I set up a second monitor? Ubuntu 12.04 (Dell Inspiron 3520 Laptop
+ Dell E173FP monitor)
I have Ubuntu 12.04 installed as my primary os and I want to add a second
monitor. I went to system settings and displays, but my second monitor was
not recognized. I tried to click detect displays and it didn't recognize
it. I downloaded the drivers for the monitor, but I don't know how to
install them.
Files included in my driver download from dell.com for the monitor:
e173fp.cat
E173FP.icm
E173FP.inf
Readme.txt
Read me file:
Introduction
This E173FP.INF file is a digitally signed driver that supports the
following Dell monitor in Microsoft(R) Windows(R) XP and Windows(R) 2000
operating systems:
Dell E173FP
Installation
Microsoft(R) Windows(R) XP Operating System
To manually install or update the driver, perform the following steps:
Click Start-> Control Panel-> and then double-click Display icon.
In the Display Properties window, click the Settings tab, and then click
Advanced.
Click the Monitor tab, and then click Properties -> Driver tab -> Update
Driver.
When the Hardware Update Wizard dialog box appears, choose "Install from a
list or specific location" and then click NEXT.
Check the "Include this location in the search" box.
Type the path to the location where the driver files were extracted (most
likely "C:\Dell\Drivers\R74922") or use the browse button to select the
location.
Click Next -> Finish to complete the installation.
Microsoft(R) Windows(R) 2000 Operating System
To manually install or update the driver, perform the following steps:
Click Start--> Settings--> Control Panel and then double-click Display.
In the Display Properties window, click the Settings tab, and then click
Advanced.
Click the Monitor tab, and then click Properties--> Driver--> Update Driver.
When the Update Device Driver Wizard dialog box appears, click "NEXT".
Choose "Display a list of the known drivers for this device so that I can
choose a specific driver" then click "NEXT".
Click "Have Disk" tab.
Type in or select from the "Browse" option the location of the driver
files (most likely "C:\Dell\Drivers\R74922") and then click "OK".
Select the appropriate model of your monitor then click "NEXT"
Click "NEXT" to install driver.
Click "FINISH" to complete installation.
What would the equivalent of display "properties" be in Ubuntu 12.04? If I
am going about this the wrong way any help would be greatly appreciated.
+ Dell E173FP monitor)
I have Ubuntu 12.04 installed as my primary os and I want to add a second
monitor. I went to system settings and displays, but my second monitor was
not recognized. I tried to click detect displays and it didn't recognize
it. I downloaded the drivers for the monitor, but I don't know how to
install them.
Files included in my driver download from dell.com for the monitor:
e173fp.cat
E173FP.icm
E173FP.inf
Readme.txt
Read me file:
Introduction
This E173FP.INF file is a digitally signed driver that supports the
following Dell monitor in Microsoft(R) Windows(R) XP and Windows(R) 2000
operating systems:
Dell E173FP
Installation
Microsoft(R) Windows(R) XP Operating System
To manually install or update the driver, perform the following steps:
Click Start-> Control Panel-> and then double-click Display icon.
In the Display Properties window, click the Settings tab, and then click
Advanced.
Click the Monitor tab, and then click Properties -> Driver tab -> Update
Driver.
When the Hardware Update Wizard dialog box appears, choose "Install from a
list or specific location" and then click NEXT.
Check the "Include this location in the search" box.
Type the path to the location where the driver files were extracted (most
likely "C:\Dell\Drivers\R74922") or use the browse button to select the
location.
Click Next -> Finish to complete the installation.
Microsoft(R) Windows(R) 2000 Operating System
To manually install or update the driver, perform the following steps:
Click Start--> Settings--> Control Panel and then double-click Display.
In the Display Properties window, click the Settings tab, and then click
Advanced.
Click the Monitor tab, and then click Properties--> Driver--> Update Driver.
When the Update Device Driver Wizard dialog box appears, click "NEXT".
Choose "Display a list of the known drivers for this device so that I can
choose a specific driver" then click "NEXT".
Click "Have Disk" tab.
Type in or select from the "Browse" option the location of the driver
files (most likely "C:\Dell\Drivers\R74922") and then click "OK".
Select the appropriate model of your monitor then click "NEXT"
Click "NEXT" to install driver.
Click "FINISH" to complete installation.
What would the equivalent of display "properties" be in Ubuntu 12.04? If I
am going about this the wrong way any help would be greatly appreciated.
Uncaught TypeError: Illegal invocation - not solved
Uncaught TypeError: Illegal invocation - not solved
Uncaught TypeError: Illegal invocation jquery-2.0.3.js:6665
i jquery-2.0.3.js:6665
_t jquery-2.0.3.js:6717
_t jquery-2.0.3.js:6712
_t jquery-2.0.3.js:6712
x.param jquery-2.0.3.js:6685
x.extend.ajax jquery-2.0.3.js:7186
(anonymous function) marker.s45.webhost1.ru/:96
x.event.dispatch jquery-2.0.3.js:4676
y.handle
I'm getting this error while sending an ajax request.
$.ajax({
type: "POST",
url: "components/authorization.php",
cache: false,
data : {
eu_name : eu_name,
eu_society : eu_society,
eu_notes : eu_notes,
eu_want_team : eu_want_team
}
}).done(function( html ) {
$(".auth").html(html);
});
I dont get whats the problem. Thanks for any help!
Uncaught TypeError: Illegal invocation jquery-2.0.3.js:6665
i jquery-2.0.3.js:6665
_t jquery-2.0.3.js:6717
_t jquery-2.0.3.js:6712
_t jquery-2.0.3.js:6712
x.param jquery-2.0.3.js:6685
x.extend.ajax jquery-2.0.3.js:7186
(anonymous function) marker.s45.webhost1.ru/:96
x.event.dispatch jquery-2.0.3.js:4676
y.handle
I'm getting this error while sending an ajax request.
$.ajax({
type: "POST",
url: "components/authorization.php",
cache: false,
data : {
eu_name : eu_name,
eu_society : eu_society,
eu_notes : eu_notes,
eu_want_team : eu_want_team
}
}).done(function( html ) {
$(".auth").html(html);
});
I dont get whats the problem. Thanks for any help!
One line If statement with Razor and .NET
One line If statement with Razor and .NET
Razor doesn't seem to like my one line If statements... Normally in
VB.NET, I can write a one line If statement like so:
If True Then Dim x As Integer
However, when I do the same with Razor in a .vbhtml file like this...
@If True Then Dim x As Integer
I get the error
The "If" block was not terminated. All "If" statements must be terminated
with a matching "End If".
What gives? Why won't Razor take this? I realize that a simple solution is
to just use a code block like
@code
If True Then Dim x As Integer
End Code
But thats not what I'm looking for. I'm curious why Razor can't recognize
a VB.Net one line If statement. Any ideas?
Razor doesn't seem to like my one line If statements... Normally in
VB.NET, I can write a one line If statement like so:
If True Then Dim x As Integer
However, when I do the same with Razor in a .vbhtml file like this...
@If True Then Dim x As Integer
I get the error
The "If" block was not terminated. All "If" statements must be terminated
with a matching "End If".
What gives? Why won't Razor take this? I realize that a simple solution is
to just use a code block like
@code
If True Then Dim x As Integer
End Code
But thats not what I'm looking for. I'm curious why Razor can't recognize
a VB.Net one line If statement. Any ideas?
Page not redirect after session expire
Page not redirect after session expire
From the previous forums and information from internet I found out that
the only logical solution to be redirected to login.xhtml or login page
when the session expires is using OmniFaces.
After using omnifaces, I am able to be directed login.xhtml when session
expires. Unfortunately, when ajax=true at primefaces I am not able to
directed to login.xhtml when session expires. I think the problem comes
with primefaces. Because, when I use pure Jsf such like h:commandButton
and when ajax=true, I can be directed to login.xhtml when session expires.
But it does not work when I use primefaces when ajax=true. You can
understand what I meant more clear below :
<!-- It can be directed to login.xhtm after session expire -->
<h:commandButton value="throw SQL exception on ajax request"
action="#{kdsHome.openCandidateAtmSelectPanelListener}">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
<!-- It can't be directed to login -->
<p:commandButton value="throw SQL exception on ajax request"
action="#{kdsHome.openCandidateAtmSelectPanelListener}"
update="@form">
</p:commandButton>
From the previous forums and information from internet I found out that
the only logical solution to be redirected to login.xhtml or login page
when the session expires is using OmniFaces.
After using omnifaces, I am able to be directed login.xhtml when session
expires. Unfortunately, when ajax=true at primefaces I am not able to
directed to login.xhtml when session expires. I think the problem comes
with primefaces. Because, when I use pure Jsf such like h:commandButton
and when ajax=true, I can be directed to login.xhtml when session expires.
But it does not work when I use primefaces when ajax=true. You can
understand what I meant more clear below :
<!-- It can be directed to login.xhtm after session expire -->
<h:commandButton value="throw SQL exception on ajax request"
action="#{kdsHome.openCandidateAtmSelectPanelListener}">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
<!-- It can't be directed to login -->
<p:commandButton value="throw SQL exception on ajax request"
action="#{kdsHome.openCandidateAtmSelectPanelListener}"
update="@form">
</p:commandButton>
Get notification before deleting the file
Get notification before deleting the file
I want to save the deleted files like Dumpster. I am using the
fileobserver, but its not working . Its notifying after the file deletion.
I want to save the deleted files like Dumpster. I am using the
fileobserver, but its not working . Its notifying after the file deletion.
Can I change the getenv 's return value?
Can I change the getenv 's return value?
I want to know what exactly will happened if I change the memory return
from getenv
I know this is not a good code. I know setenv by the way.
Like:
char *new_path = "/home/user/dev/myTry1";
char *path = getenv("PATH");// assume there is : PATH=/home/user/dev/myTry
//now *path = "/home/user/dev/myTry"
memcpy(path,new_path,strlen(new_path)+1);
Is this a undefined behavior ? Or just a wrong code?
I tried it and no error or segmentation fault happened.
I want to know what exactly will happened if I change the memory return
from getenv
I know this is not a good code. I know setenv by the way.
Like:
char *new_path = "/home/user/dev/myTry1";
char *path = getenv("PATH");// assume there is : PATH=/home/user/dev/myTry
//now *path = "/home/user/dev/myTry"
memcpy(path,new_path,strlen(new_path)+1);
Is this a undefined behavior ? Or just a wrong code?
I tried it and no error or segmentation fault happened.
Monday, 19 August 2013
Why this in onDeviceReady is not this as usual?
Why this in onDeviceReady is not this as usual?
Below code is from index.js generated by PhoneGap 3.0, my question is why
it was not designed to allow us to use this.receivedEvent as usual (and
get event object as a parameter).
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function() {
app.receivedEvent('deviceready');
},
Thanks,
Below code is from index.js generated by PhoneGap 3.0, my question is why
it was not designed to allow us to use this.receivedEvent as usual (and
get event object as a parameter).
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function() {
app.receivedEvent('deviceready');
},
Thanks,
Error creating GIF using images2gif.py
Error creating GIF using images2gif.py
I'm trying to create a GIF file using images2fig.py from the visvis package
With this very simple code
import glob
from PIL import Image
from visvis.vvmovie.images2gif import writeGif
images = [Image.open(image) for image in glob.glob("*.png")]
filename = "test.gif"
writeGif(filename, images, duration=0.2)
I got an error
writeGif(filename, images, duration=0.2)
File "C:\Python27\lib\site-packages\visvis\vvmovie\images2gif.py", line
570, in writeGif
images = gifWriter.convertImagesToPIL(images, dither, nq)
File "C:\Python27\lib\site-packages\visvis\vvmovie\images2gif.py", line
373, in convertImagesToPIL
im = Image.fromarray(im,'RGB')
File "C:\Python27\lib\site-packages\PIL\Image.py", line 1937, in fromarray
obj = obj.tobytes()
AttributeError: 'numpy.ndarray' object has no attribute 'tobytes'
What did I do wrong? How do I fix this?
I'm trying to create a GIF file using images2fig.py from the visvis package
With this very simple code
import glob
from PIL import Image
from visvis.vvmovie.images2gif import writeGif
images = [Image.open(image) for image in glob.glob("*.png")]
filename = "test.gif"
writeGif(filename, images, duration=0.2)
I got an error
writeGif(filename, images, duration=0.2)
File "C:\Python27\lib\site-packages\visvis\vvmovie\images2gif.py", line
570, in writeGif
images = gifWriter.convertImagesToPIL(images, dither, nq)
File "C:\Python27\lib\site-packages\visvis\vvmovie\images2gif.py", line
373, in convertImagesToPIL
im = Image.fromarray(im,'RGB')
File "C:\Python27\lib\site-packages\PIL\Image.py", line 1937, in fromarray
obj = obj.tobytes()
AttributeError: 'numpy.ndarray' object has no attribute 'tobytes'
What did I do wrong? How do I fix this?
Facebook Graph API: Using the uid modifier removes permissions
Facebook Graph API: Using the uid modifier removes permissions
I'm having difficulty accessing facebook graph information on a
person-by-person basis.
To experiment, I'm using the facebook graph explorer (though the behavior
is the same in my client). When hit this request:
<myIdentifier>?fields=friends.fields(birthday,work,education,first_name,last_name)
I am getting everything back correctly as expected.
I'd like to ask for just the names up front, and then later ask for the
birthday, work, and education info as needed (to speed things up).
However, when I try to add a 'uid' modifier to the request, all i get back
is the identifiers. For example, if i try hitting this url
<myIdentifier>?fields=friends.uid(<friendIdentifier>).fields(birthday,first_name,last_name)
I no longer receive any birthday, work, education, or name information.
Also, if i do this using the explorer tool, those fields become grayed
out, suggesting i don't have access to that data. Anyone know whats going
on?
I'm having difficulty accessing facebook graph information on a
person-by-person basis.
To experiment, I'm using the facebook graph explorer (though the behavior
is the same in my client). When hit this request:
<myIdentifier>?fields=friends.fields(birthday,work,education,first_name,last_name)
I am getting everything back correctly as expected.
I'd like to ask for just the names up front, and then later ask for the
birthday, work, and education info as needed (to speed things up).
However, when I try to add a 'uid' modifier to the request, all i get back
is the identifiers. For example, if i try hitting this url
<myIdentifier>?fields=friends.uid(<friendIdentifier>).fields(birthday,first_name,last_name)
I no longer receive any birthday, work, education, or name information.
Also, if i do this using the explorer tool, those fields become grayed
out, suggesting i don't have access to that data. Anyone know whats going
on?
save global variables in spreadsheet
save global variables in spreadsheet
I have a module with a load of global variables. I would like the name of
the global variables in this module to be saved in the first column, and
the global variable value to be saved in the second column
i.e public variable1 as string public variable2 as string public variable3
as string
variable1 = David
variable2 = Chicken
Variable3 = Apple
column a: variable1, variable2, variable3 column b: david,chicken,apple
I have a module with a load of global variables. I would like the name of
the global variables in this module to be saved in the first column, and
the global variable value to be saved in the second column
i.e public variable1 as string public variable2 as string public variable3
as string
variable1 = David
variable2 = Chicken
Variable3 = Apple
column a: variable1, variable2, variable3 column b: david,chicken,apple
Afirst order non-linear ordinary differential equation
Afirst order non-linear ordinary differential equation
How do we solve the first order non-linear ordinary differential equation
, $$y^3=xy^2 \frac{dy}{dx} + x^4 \Big(\frac{dy}{dx}\Big)^2$$
How do we solve the first order non-linear ordinary differential equation
, $$y^3=xy^2 \frac{dy}{dx} + x^4 \Big(\frac{dy}{dx}\Big)^2$$
Sunday, 18 August 2013
Powershell Script for TFS Build Definition
Powershell Script for TFS Build Definition
I am trying to create a powershell script to create TFS build definition.
I this example in C# to create it
(http://geekswithblogs.net/jakob/archive/2010/04/26/creating-a-build-definition-using-the-tfs-2010-api.aspx).
However, I am having trouble creating a build definition.
My Script:
param(
[Parameter(Mandatory=$true)]
[string] $buildName,`enter code here`
[string] $teamProject="Templates",
[string] $buildTemplateName = "TestBuildTemplate",
[string] $buildDescription = "Test Descirption",
[string] $buildController = "TFS - Controller"
)
Clear-Host
$ErrorActionPreference = "Stop" ;
if ($Verbose) { $VerbosePreference = "Continue" ; }
$assemblylist =
"Microsoft.TeamFoundation.Build.Client",
"Microsoft.TeamFoundation.Build.Workflow",
"Microsoft.TeamFoundation.Client",
"Microsoft.TeamFoundation.Common",
"Microsoft.TeamFoundation.WorkItemTracking.Client"
Write-Verbose -Message "Loading TFS Build assembly…"
foreach ($asm in $assemblylist)
{
$asm = [Reflection.Assembly]::LoadWithPartialName($asm)
}
$tfsCollectionUrl = "TFS Server IP Address"
$server.EnsureAuthenticated()
if(!$server.HasAuthenticated)
{
Write-Host "Failed to authenticate TFS"
exit
}
Write-Host "Connected to TFS...."
$buildServer =
$server.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer])
$def = $buildserver.CreateBuildDefinition($teamProject)
$def.Name = $buildTemplateName
$def.Description = $buildDescription
$def.Workspace.AddMapping("$/Default/Sampleapplication1",
'"$(SourceDir)"', 0)
$def.Workspace.AddMapping('"$/OtherPath/"', "", 1)
$def.BuildController = $buildserver.GetBuildController($buildController)
$def.DefaultDropLocation = "Drop Location Share"
enter code here
Write-Host "Get default template...."
$def.Save()
The error i am getting is unable to save as Process is not defined. What I
am I missing here?
I am trying to create a powershell script to create TFS build definition.
I this example in C# to create it
(http://geekswithblogs.net/jakob/archive/2010/04/26/creating-a-build-definition-using-the-tfs-2010-api.aspx).
However, I am having trouble creating a build definition.
My Script:
param(
[Parameter(Mandatory=$true)]
[string] $buildName,`enter code here`
[string] $teamProject="Templates",
[string] $buildTemplateName = "TestBuildTemplate",
[string] $buildDescription = "Test Descirption",
[string] $buildController = "TFS - Controller"
)
Clear-Host
$ErrorActionPreference = "Stop" ;
if ($Verbose) { $VerbosePreference = "Continue" ; }
$assemblylist =
"Microsoft.TeamFoundation.Build.Client",
"Microsoft.TeamFoundation.Build.Workflow",
"Microsoft.TeamFoundation.Client",
"Microsoft.TeamFoundation.Common",
"Microsoft.TeamFoundation.WorkItemTracking.Client"
Write-Verbose -Message "Loading TFS Build assembly…"
foreach ($asm in $assemblylist)
{
$asm = [Reflection.Assembly]::LoadWithPartialName($asm)
}
$tfsCollectionUrl = "TFS Server IP Address"
$server.EnsureAuthenticated()
if(!$server.HasAuthenticated)
{
Write-Host "Failed to authenticate TFS"
exit
}
Write-Host "Connected to TFS...."
$buildServer =
$server.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer])
$def = $buildserver.CreateBuildDefinition($teamProject)
$def.Name = $buildTemplateName
$def.Description = $buildDescription
$def.Workspace.AddMapping("$/Default/Sampleapplication1",
'"$(SourceDir)"', 0)
$def.Workspace.AddMapping('"$/OtherPath/"', "", 1)
$def.BuildController = $buildserver.GetBuildController($buildController)
$def.DefaultDropLocation = "Drop Location Share"
enter code here
Write-Host "Get default template...."
$def.Save()
The error i am getting is unable to save as Process is not defined. What I
am I missing here?
Rails Precompiling Custom Assets
Rails Precompiling Custom Assets
I have a custom application_admin.css.scss under app/assets/stylesheets
and I have this line in my config/environments/production.rb file
config.assets.precompile += [%w(application_admin.css)]
When I run bundle exec rake assets:precompile the custom stylesheet
doesn't compile
I came across this post but I already have what they suggested. Rails
Assets custom manifests are not precompiling
What else should I check?
I have a custom application_admin.css.scss under app/assets/stylesheets
and I have this line in my config/environments/production.rb file
config.assets.precompile += [%w(application_admin.css)]
When I run bundle exec rake assets:precompile the custom stylesheet
doesn't compile
I came across this post but I already have what they suggested. Rails
Assets custom manifests are not precompiling
What else should I check?
How fast should a Python factoring script be?
How fast should a Python factoring script be?
Just how efficient is "good enough" for all intents and purposes? I wrote
a script to simply list off all numbers that divide into an input, x, as
pairs (i, n//i) and was just curious how efficient I should be going for?
what is the acceptable rate at which the script starts to lose its
efficiency? This is my code (although advice is appreciated, I just want
to give an idea as to how it works).
import time
print('''This program determines all basic factors of a given number, x,
as ordered pairs, (a, b) where ab=x.
Type "quit" to exit.''')
timer = input('Would you like a timer? (y/n) ')
while 1:
try:
x =(input('x = '))
T0 = time.time()
b = []
n = int(x)**0.5
ran = list(range(1, int(n)+1))
if int(x) % 2 == 1:
ran = ran[::2]
for i in ran:
if int(x) % i == 0:
m = (i, int(x)//i)
b.append(m)
else:
pass
except ValueError as error_1:
if x == 'quit':
break
else:
print(error_1)
except EOFError as error_2:
print(error_2)
except OverflowError as error_3:
print(error_3)
except MemoryError as error_4:
print(error_4)
T1 = time.time()
total = T1-T0
print(b)
print(str(len(b)) + ' pairs.')
if timer == 'y':
print("%.5f" % total + ' seconds.')
some of the results are:
x = 9
[(1, 9), (3, 3)]
2 pairs.
0.00000 seconds.
x = 8234324543
[(1, 8234324543)]
1 pairs.
0.07404 seconds.
x = 438756349875
[(1, 438756349875), (3, 146252116625), (5, 87751269975), (15,
29250423325), (25, 17550253995), (75, 5850084665), (125,
3510050799), (375, 1170016933), (557, 787713375), (1671, 262571125),
(2785, 157542675), (8355, 52514225), (13925, 31508535), (41775,
10502845), (69625, 6301707), (208875, 2100569)]
16 pairs.
0.88859 seconds.
So this program can be pretty quick, but then the speed drops rather
rapidly once you get up to higher numbers. Anyways, ya, I was just
wondering what is considered acceptable by todays standards?
Just how efficient is "good enough" for all intents and purposes? I wrote
a script to simply list off all numbers that divide into an input, x, as
pairs (i, n//i) and was just curious how efficient I should be going for?
what is the acceptable rate at which the script starts to lose its
efficiency? This is my code (although advice is appreciated, I just want
to give an idea as to how it works).
import time
print('''This program determines all basic factors of a given number, x,
as ordered pairs, (a, b) where ab=x.
Type "quit" to exit.''')
timer = input('Would you like a timer? (y/n) ')
while 1:
try:
x =(input('x = '))
T0 = time.time()
b = []
n = int(x)**0.5
ran = list(range(1, int(n)+1))
if int(x) % 2 == 1:
ran = ran[::2]
for i in ran:
if int(x) % i == 0:
m = (i, int(x)//i)
b.append(m)
else:
pass
except ValueError as error_1:
if x == 'quit':
break
else:
print(error_1)
except EOFError as error_2:
print(error_2)
except OverflowError as error_3:
print(error_3)
except MemoryError as error_4:
print(error_4)
T1 = time.time()
total = T1-T0
print(b)
print(str(len(b)) + ' pairs.')
if timer == 'y':
print("%.5f" % total + ' seconds.')
some of the results are:
x = 9
[(1, 9), (3, 3)]
2 pairs.
0.00000 seconds.
x = 8234324543
[(1, 8234324543)]
1 pairs.
0.07404 seconds.
x = 438756349875
[(1, 438756349875), (3, 146252116625), (5, 87751269975), (15,
29250423325), (25, 17550253995), (75, 5850084665), (125,
3510050799), (375, 1170016933), (557, 787713375), (1671, 262571125),
(2785, 157542675), (8355, 52514225), (13925, 31508535), (41775,
10502845), (69625, 6301707), (208875, 2100569)]
16 pairs.
0.88859 seconds.
So this program can be pretty quick, but then the speed drops rather
rapidly once you get up to higher numbers. Anyways, ya, I was just
wondering what is considered acceptable by todays standards?
Automatic start Chronometer in Android
Automatic start Chronometer in Android
I would like to ask how can I able to start my chronometer without
clicking a button? For example, if I click the "Play" button, the next
chronometer in the next layout will automatically start.
I tried to just start it in my level 1 class, but after I run it, I got
this error in my console:
ActivityManager: Warning: Activity not started, its current task has been
brought to the front.
thanks.
I would like to ask how can I able to start my chronometer without
clicking a button? For example, if I click the "Play" button, the next
chronometer in the next layout will automatically start.
I tried to just start it in my level 1 class, but after I run it, I got
this error in my console:
ActivityManager: Warning: Activity not started, its current task has been
brought to the front.
thanks.
MVC 4 ViewModel not being sent back to Controller
MVC 4 ViewModel not being sent back to Controller
I can't seem to figure out how to send back the entire ViewModel to the
controller to the 'Validate and Save' function.
Here is my controller:
[HttpPost]
public ActionResult Send(BitcoinTransactionViewModel transaction)
{
}
Here is the form in the view:
<li class="check">
<h3>Transaction Id</h3>
<p>@Html.DisplayFor(m => m.Transaction.TransactionId)</p>
</li>
<li class="money">
<h3>Deposited Amount</h3>
<p>@Model.Transaction.Amount.ToString() BTC</p>
</li>
<li class="time">
<h3>Time</h3>
<p>@Model.Transaction.Time.ToString()</p>
</li>
@using (Html.BeginForm("Send", "DepositDetails", FormMethod.Post, new {
transaction = Model }))
{
@Html.HiddenFor(m => m.Token);
@Html.HiddenFor(m => m.Transaction.TransactionId);
@Html.TextBoxFor(m => m.WalletAddress, new { placeholder = "Wallet
Address", maxlength = "34" })
<input type="submit" value="Send" />
@Html.ValidationMessage("walletAddress", new { @class = "validation" })
}
When i click on submit, the conroller contains the correct value of the
walletAddress field but transaction.Transaction.Time,
transaction.Transaction.Location, transaction.Transaction.TransactionId
are empty.
Is there a way i could pass the entire Model back to the controller?
Edit:
When i dont even receive the walletAddress in the controller. Everything
gets nulled! When i remove this line alone: @Html.HiddenFor(m =>
m.Transaction.TransactionId); it works and i get the Token property on the
controller, but when i add it back, all the properties of the transaction
object on the controller are NULL.
Any ideas?
I can't seem to figure out how to send back the entire ViewModel to the
controller to the 'Validate and Save' function.
Here is my controller:
[HttpPost]
public ActionResult Send(BitcoinTransactionViewModel transaction)
{
}
Here is the form in the view:
<li class="check">
<h3>Transaction Id</h3>
<p>@Html.DisplayFor(m => m.Transaction.TransactionId)</p>
</li>
<li class="money">
<h3>Deposited Amount</h3>
<p>@Model.Transaction.Amount.ToString() BTC</p>
</li>
<li class="time">
<h3>Time</h3>
<p>@Model.Transaction.Time.ToString()</p>
</li>
@using (Html.BeginForm("Send", "DepositDetails", FormMethod.Post, new {
transaction = Model }))
{
@Html.HiddenFor(m => m.Token);
@Html.HiddenFor(m => m.Transaction.TransactionId);
@Html.TextBoxFor(m => m.WalletAddress, new { placeholder = "Wallet
Address", maxlength = "34" })
<input type="submit" value="Send" />
@Html.ValidationMessage("walletAddress", new { @class = "validation" })
}
When i click on submit, the conroller contains the correct value of the
walletAddress field but transaction.Transaction.Time,
transaction.Transaction.Location, transaction.Transaction.TransactionId
are empty.
Is there a way i could pass the entire Model back to the controller?
Edit:
When i dont even receive the walletAddress in the controller. Everything
gets nulled! When i remove this line alone: @Html.HiddenFor(m =>
m.Transaction.TransactionId); it works and i get the Token property on the
controller, but when i add it back, all the properties of the transaction
object on the controller are NULL.
Any ideas?
Nested data in ExtJS
Nested data in ExtJS
I download several entities one ajax-request. Then i add them to stores. I
need to commit a changes alike one ajax-request. How properly to do it?
Json structure:
{
entity1: [],
entity2: [],
entyty3: []
}
success: function(responce) {
var data = Ext.decode(response.responseText);
store1.add(data['entity1']);
store2.add(data['entity2']);
store3.add(data['entity3']);
}
I download several entities one ajax-request. Then i add them to stores. I
need to commit a changes alike one ajax-request. How properly to do it?
Json structure:
{
entity1: [],
entity2: [],
entyty3: []
}
success: function(responce) {
var data = Ext.decode(response.responseText);
store1.add(data['entity1']);
store2.add(data['entity2']);
store3.add(data['entity3']);
}
Saturday, 17 August 2013
how can i upgrade this script to make it sort and have ore checks in it?
how can i upgrade this script to make it sort and have ore checks in it?
ok so i want to make this script upload more then one file and have more
checks also im trying to figure out hoe to sort out category's for each of
the photos so that when i have to go threw the photos later to make sure
there are no inappropriate things uploaded how would i do this to make it
easier on my self? its a screw around script! i threw it together with
other scripts online! im more concerned about the uploading and sorting
part of there script then anything! the displaying of the photos it
perfect and i love how its all set up im just wanting more checks and
better sorting options to integrate into my uploading script! can anyone
help me with this? my script below is what im using its nothing pretty im
still pretty new to programming :D its an all in one script meaning its a
php with html all in one!
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Thorbis | Pictures</title>
<link rel="shortcut icon" href="bin/favicon.ico" />
<link
href="http://fonts.googleapis.com/css?family=Open+Sans:300,600,700"
rel="stylesheet" />
<link rel="stylesheet" type="text/css"
href="bin/lightbox/lightbox.css" />
<link
href="http://fonts.googleapis.com/css?family=Open+Sans:300,600,700"
rel="stylesheet" />
<script src="js/jquery.min.js"></script>
<script src="js/config.js"></script>
<script src="js/skel.min.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel-noscript.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-desktop.css" />
</noscript>
<script src="bin/lightbox/jquery-1.7.2.min.js"></script>
<script src="bin/lightbox/lightbox.js"></script>
<!-- Nav -->
<nav id="nav">
<ul>
<li><a href="#work">Top</a></li>
<li><a
href="http://www.thorbis.com/index.html#home">Home</a></li>
<li><a href="#pictures">Pictures</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<div class="wrapper wrapper-style2">
<article id="work">
<header>
<span><strong>You can upload funny pictures
only! All others will be
deleted!</strong></span></br>
<span>All the pictures sort alphabetically
and some images overlay others if they have
the same name so make yours
unique!</span></br>
<span> You can upload <strong>ONLY</strong>
".png", ".PNG", ".jpg", ".JPG", ".jpeg",
".JPEG", ".gif", ".GIF" </span>
</header>
<div style="margin:1em auto;">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>"
method="POST" enctype="multipart/form-data">
<input type="file" name="fileup"/><input type="submit"
name='submit' value="Upload" />
</form>
</div>
</head>
<?php
$uploadpath = 'galleries/'; // directory to store the uploaded files
$max_size = 5000; // maximum file size, in KiloBytes
$alwidth = 1200; // maximum allowed width, in pixels
$alheight = 1000; // maximum allowed height, in pixels
$allowtype = array('bmp', 'gif', 'jpg', 'jpe', 'png'); // allowed
extensions
if(isset($_FILES['fileup']) && strlen($_FILES['fileup']['name']) > 1) {
$uploadpath = $uploadpath . basename( $_FILES['fileup']['name']);
// gets the file name
$sepext = explode('.', strtolower($_FILES['fileup']['name']));
$type = end($sepext); // gets extension
list($width, $height) = getimagesize($_FILES['fileup']['tmp_name']);
// gets image width and height
$err = ''; // to store the errors
// Checks if the file has allowed type, size, width and height (for images)
if(!in_array($type, $allowtype)) $err .= 'The file: <b>'.
$_FILES['fileup']['name']. '</b> not has the allowed extension type.';
if($_FILES['fileup']['size'] > $max_size*1000) $err .= '<br/>Maximum
file size must be: '. $max_size. ' KB.';
if(isset($width) && isset($height) && ($width >= $alwidth || $height >=
$alheight)) $err .= '<br/>The maximum Width x Height must be: '.
$alwidth. ' x '. $alheight;
// If no errors, upload the image, else, output the errors
if($err == '') {
if(move_uploaded_file($_FILES['fileup']['tmp_name'], $uploadpath)) {
echo 'File: <b>'. basename( $_FILES['fileup']['name']). '</b>
successfully uploaded:';
echo '<br />Size: <b>'.
number_format($_FILES['fileup']['size']/1024, 3, '.', '') .'</b>
KB';
if(isset($width) && isset($height))
echo "</br><img height='70px' width='70px'
src='http://www.thorbis.com/pictures/$uploadpath'></img>";
}
else echo '<b>Unable to upload the file.</b>';
}
else echo $err;
}
?>
<footer>
<a href="#pictures" class="button
button-big">Pictures</a>
</footer>
</article>
</div>
<div class="wrapper wrapper-style6">
<article id="pictures">
<header>
<h2>Great Pictures</h2>
</header>
<div class="container">
<?php
$filetypes = array(".png", ".PNG", ".jpg", ".JPG",
".jpeg", ".JPEG", ".gif", ".GIF");
$basedir = 'galleries/';
$currentdir = '';
if(isset($_GET['f']) ? $_GET['f'] : '')
{
$currentdir = '/'.$_GET['f'].'/';
}
function scandirSorted($path)
{
$sortedData = array();
$data1 = array();
$data2 = array();
foreach(scandir($path) as $file)
{
if(!strstr($path, '..'))
{
if(is_file($path.$file))
{
array_push($data2, $file);
}
else
{
array_push($data1, $file);
}
}
}
$sortedData = array_merge($data1, $data2);
return $sortedData;
}
function strpos_arr($haystack, $needle)
{
if(!is_array($needle))
{
$needle = array($needle);
}
foreach($needle as $what)
{
if(($pos = strpos($haystack, $what)) !== false)
{
return $pos;
}
}
return false;
}
function addThumb($filename)
{
$filename = array_reverse(explode('.', $filename));
$filename[0] = 'smpgthumb.'.$filename[0];
$filename = implode('.', array_reverse($filename));
return $filename;
}
if(is_dir($basedir.$currentdir))
{
$folder =
array_diff(scandirSorted($basedir.$currentdir),
array('..', '.', 'Thumbs.db', 'thumbs.db',
'.DS_Store'));
}
$navigation = explode('/', $currentdir);
$navigation_elements = count($navigation);
if(isset($_GET['f']))
{
echo('<div id="navigation"><a href="./">Home</a>');
}
foreach($navigation as $element)
{
if($element)
{
echo(' / <a href="?f='.str_replace('//', '/',
str_replace(' ', '%20', substr($currentdir, 0,
strpos($currentdir,
$element)+strlen($element)))).'">'.$element.'</a>');
}
}
if(isset($_GET['f']))
{
echo('</div>');
}
echo('<div id="content">');
foreach($folder as $item)
{
if(!strstr(isset($_GET['f']), '..'))
{
if(!strstr($item, 'smpgthumb'))
{
if(strpos_arr($item, $filetypes))
{
if(file_exists($basedir.$currentdir.'/'.addThumb($item)))
{
echo('<a href="'.str_replace('//',
'/', str_replace(' ', '%20',
$basedir.$currentdir.'/'.$item)).'"
rel="friend"><img
src="'.str_replace('//', '/',
str_replace(' ', '%20',
$basedir.$currentdir.'/'.addThumb($item))).'"
class="img" alt="" /></a> ');
}
else
{
echo('<a href="'.str_replace('//',
'/', str_replace(' ', '%20',
$basedir.$currentdir.'/'.$item)).'"
rel="friend"><img
src="bin/thumb.php?file='.str_replace('//',
'/', str_replace(' ', '%20',
$basedir.$currentdir.'/'.$item)).'"
class="img" alt="" /></a> ');
}
}
else
{
echo('<a href="?f='.str_replace('//', '/',
str_replace(' ', '%20',
$currentdir.'/'.$item)).'">'.$item.'</a><br>');
}
}
}
}
echo('</div>');
?>
</div>
</body>
<footer>
<a href="#work" class="button button-big">Back To
The Top</a>
</footer>
</article>
</div>
<!-- Contact -->
<div class="wrapper wrapper-style4">
<article id="contact">
<header>
<h2>Want to hire me? Get in touch!</h2>
<span>I do quality work and would love to work for
you!.</span>
</header>
<div>
<div class="row">
<div class="12u">
<div id="errors"></div>
<form method='post'
enctype="multipart/form-data"
action='mailform.php' id='contact-form'>
<div>
<div class="row half">
<div class="6u">
<input type="text"
name="name" min-length=''
id="name"
placeholder="Name" />
</div>
<div class="6u">
<input type="text"
name="email" id="email"
placeholder="Email" />
</div>
</div>
<div class="row half">
<div class="12u">
<input type="text"
name="subject"
id="subject"
placeholder="Subject" />
</div>
</div>
<div class="row half">
<div class="12u">
<textarea name="message"
id="message"
placeholder="Message"></textarea>
</div>
</div>
<div class="row half">
<div class="12u">
<p><label for="file">Upload a file
to help me get an idea of what you
want .zip are
recomended</label><input
type="file" name="file"
id="file"></p>
<div class="row">
</div>
</div>
<div class="12u">
<a href="#" type="submit"
name="submit" id="submit"
value="send" class="button
form-button-submit">Send
Message</a>
<a href="#" class="button
button-alt
form-button-reset">Clear
Form</a>
</div>
</div>
</div>
</form>
<script>
$('#contact-form').submit(function(e) {
var valid = true;
$('input[type=text],textarea').each(function() {
if (!$(this).val()) {
valid = false;
$(this).addClass('invalid');
}
if ($(this).is('#email') && $(this).val().indexOf('@') === false) {
valid = false;
$(this).addClass('invalid');
}
});
if (!valid) {
$('#botSmallPic1').click(function(){$.smallBox({title:'New
Notifacation!',content:'I Hope Your All Doing Well
',timeout:10000,color:'green',img:'img/pic1.png'})});
$('#bot').click(function(){$.smallBox({title:'hi!',content:'I
Hope Your All Doing Well
',timeout:10000,color:'blue',img:'img/pic1.png'})});
$("#Big").click(function(){$.bigBox({title:"no",content:"Lorem
ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco. Lorem ipsum dolor sit
amet.",color:"lightblue",img:"img/cloud.png",number:"5"})});
$("#BigBoxCall1").click(function(){$.bigBox({title:"Big
Information box",content:"Lorem ipsum dolor sit amet,
consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco. Lorem
ipsum dolor sit
amet.",color:"breen",img:"img/cloud.png",number:"5"})});
$("#botMessage1").ready(function(){$.MetroMessageBox({title:"Wrong
input The form wasent filled out
correctly",content:"Please try again input again with
propper
inputs",NormalButton:"blue",ActiveButton:"lightblue"})});
return false;
}
});
</script>
</div>
</div>
<div class="row row-special">
<div class="12u">
<h3>Find me on ...</h3>
<ul class="social">
<li class="twitter"><a
href="http://twitter.com/thorbis"
class="icon
icon-twitter"><span>Twitter</span></a></li>
<li class="facebook"><a
href="https://www.facebook.com/ThorbisInc"
class="icon
icon-facebook"><span>Facebook</span></a></li>
<li class="linkedin"><a
href="http://www.linkedin.com/profile/view?id=226237754&goback=%2Enmp_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&trk=spm_pic"
class="icon
icon-linkedin"><span>LinkedIn</span></a></li>
<li class="tumblr"><a
href="http://thorbis.tumblr.com/"
class="icon
icon-tumblr"><span>Tumblr</span></a></li>
<li class="googleplus"><a
href="https://plus.google.com/u/0/113626141520121345204/posts?partnerid=gplp0"
class="icon
icon-google-plus"><span>Google+</span></a></li>
<li class="youtube"><a
href="https://www.youtube.com/user/byronwade10"
class="icon
icon-youtube"><span>YouTube</span></a></li>
<li class="flickr"><a
href="http://www.flickr.com/people/98912309@N04/"
class="icon
icon-flickr"><span>Flickr</span></a></li>
<li class="vimeo"><a
href="https://vimeo.com/user19548393"
class="icon
icon-vimeo"><span>Vimeo</span></a></li>
<!--
<li class="github"><a
href="http://github.com/" class="icon
icon-github"><span>Github</span></a></li>
<li class="dribbble"><a
href="http://dribbble.com/n33"
class="icon
icon-dribbble"><span>Dribbble</span></a></li>
<li class="rss"><a href="#"
class="icon
icon-rss"><span>RSS</span></a></li>
<li class="instagram"><a href="#"
class="icon
icon-instagram"><span>Instagram</span></a></li>
<li class="foursquare"><a href="#"
class="icon
icon-foursquare"><span>Foursquare</span></a></li>
<li class="skype"><a href="#"
class="icon
icon-skype"><span>Skype</span></a></li>
<li class="soundcloud"><a href="#"
class="icon
icon-soundcloud"><span>Soundcloud</span></a></li>
<li class="blogger"><a href="#"
class="icon
icon-blogger"><span>Blogger</span></a></li>
-->
</ul>
</div>
</div>
</div>
<footer>
<footer>
<p id="copyright">
© 2012 Thorbis Inc. | Design: <a
href="http://html5up.net/">HTML5 UP</a>
</p>
</footer>
</footer>
</article>
</div>
</body>
</html>
ok so i want to make this script upload more then one file and have more
checks also im trying to figure out hoe to sort out category's for each of
the photos so that when i have to go threw the photos later to make sure
there are no inappropriate things uploaded how would i do this to make it
easier on my self? its a screw around script! i threw it together with
other scripts online! im more concerned about the uploading and sorting
part of there script then anything! the displaying of the photos it
perfect and i love how its all set up im just wanting more checks and
better sorting options to integrate into my uploading script! can anyone
help me with this? my script below is what im using its nothing pretty im
still pretty new to programming :D its an all in one script meaning its a
php with html all in one!
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Thorbis | Pictures</title>
<link rel="shortcut icon" href="bin/favicon.ico" />
<link
href="http://fonts.googleapis.com/css?family=Open+Sans:300,600,700"
rel="stylesheet" />
<link rel="stylesheet" type="text/css"
href="bin/lightbox/lightbox.css" />
<link
href="http://fonts.googleapis.com/css?family=Open+Sans:300,600,700"
rel="stylesheet" />
<script src="js/jquery.min.js"></script>
<script src="js/config.js"></script>
<script src="js/skel.min.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel-noscript.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-desktop.css" />
</noscript>
<script src="bin/lightbox/jquery-1.7.2.min.js"></script>
<script src="bin/lightbox/lightbox.js"></script>
<!-- Nav -->
<nav id="nav">
<ul>
<li><a href="#work">Top</a></li>
<li><a
href="http://www.thorbis.com/index.html#home">Home</a></li>
<li><a href="#pictures">Pictures</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<div class="wrapper wrapper-style2">
<article id="work">
<header>
<span><strong>You can upload funny pictures
only! All others will be
deleted!</strong></span></br>
<span>All the pictures sort alphabetically
and some images overlay others if they have
the same name so make yours
unique!</span></br>
<span> You can upload <strong>ONLY</strong>
".png", ".PNG", ".jpg", ".JPG", ".jpeg",
".JPEG", ".gif", ".GIF" </span>
</header>
<div style="margin:1em auto;">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>"
method="POST" enctype="multipart/form-data">
<input type="file" name="fileup"/><input type="submit"
name='submit' value="Upload" />
</form>
</div>
</head>
<?php
$uploadpath = 'galleries/'; // directory to store the uploaded files
$max_size = 5000; // maximum file size, in KiloBytes
$alwidth = 1200; // maximum allowed width, in pixels
$alheight = 1000; // maximum allowed height, in pixels
$allowtype = array('bmp', 'gif', 'jpg', 'jpe', 'png'); // allowed
extensions
if(isset($_FILES['fileup']) && strlen($_FILES['fileup']['name']) > 1) {
$uploadpath = $uploadpath . basename( $_FILES['fileup']['name']);
// gets the file name
$sepext = explode('.', strtolower($_FILES['fileup']['name']));
$type = end($sepext); // gets extension
list($width, $height) = getimagesize($_FILES['fileup']['tmp_name']);
// gets image width and height
$err = ''; // to store the errors
// Checks if the file has allowed type, size, width and height (for images)
if(!in_array($type, $allowtype)) $err .= 'The file: <b>'.
$_FILES['fileup']['name']. '</b> not has the allowed extension type.';
if($_FILES['fileup']['size'] > $max_size*1000) $err .= '<br/>Maximum
file size must be: '. $max_size. ' KB.';
if(isset($width) && isset($height) && ($width >= $alwidth || $height >=
$alheight)) $err .= '<br/>The maximum Width x Height must be: '.
$alwidth. ' x '. $alheight;
// If no errors, upload the image, else, output the errors
if($err == '') {
if(move_uploaded_file($_FILES['fileup']['tmp_name'], $uploadpath)) {
echo 'File: <b>'. basename( $_FILES['fileup']['name']). '</b>
successfully uploaded:';
echo '<br />Size: <b>'.
number_format($_FILES['fileup']['size']/1024, 3, '.', '') .'</b>
KB';
if(isset($width) && isset($height))
echo "</br><img height='70px' width='70px'
src='http://www.thorbis.com/pictures/$uploadpath'></img>";
}
else echo '<b>Unable to upload the file.</b>';
}
else echo $err;
}
?>
<footer>
<a href="#pictures" class="button
button-big">Pictures</a>
</footer>
</article>
</div>
<div class="wrapper wrapper-style6">
<article id="pictures">
<header>
<h2>Great Pictures</h2>
</header>
<div class="container">
<?php
$filetypes = array(".png", ".PNG", ".jpg", ".JPG",
".jpeg", ".JPEG", ".gif", ".GIF");
$basedir = 'galleries/';
$currentdir = '';
if(isset($_GET['f']) ? $_GET['f'] : '')
{
$currentdir = '/'.$_GET['f'].'/';
}
function scandirSorted($path)
{
$sortedData = array();
$data1 = array();
$data2 = array();
foreach(scandir($path) as $file)
{
if(!strstr($path, '..'))
{
if(is_file($path.$file))
{
array_push($data2, $file);
}
else
{
array_push($data1, $file);
}
}
}
$sortedData = array_merge($data1, $data2);
return $sortedData;
}
function strpos_arr($haystack, $needle)
{
if(!is_array($needle))
{
$needle = array($needle);
}
foreach($needle as $what)
{
if(($pos = strpos($haystack, $what)) !== false)
{
return $pos;
}
}
return false;
}
function addThumb($filename)
{
$filename = array_reverse(explode('.', $filename));
$filename[0] = 'smpgthumb.'.$filename[0];
$filename = implode('.', array_reverse($filename));
return $filename;
}
if(is_dir($basedir.$currentdir))
{
$folder =
array_diff(scandirSorted($basedir.$currentdir),
array('..', '.', 'Thumbs.db', 'thumbs.db',
'.DS_Store'));
}
$navigation = explode('/', $currentdir);
$navigation_elements = count($navigation);
if(isset($_GET['f']))
{
echo('<div id="navigation"><a href="./">Home</a>');
}
foreach($navigation as $element)
{
if($element)
{
echo(' / <a href="?f='.str_replace('//', '/',
str_replace(' ', '%20', substr($currentdir, 0,
strpos($currentdir,
$element)+strlen($element)))).'">'.$element.'</a>');
}
}
if(isset($_GET['f']))
{
echo('</div>');
}
echo('<div id="content">');
foreach($folder as $item)
{
if(!strstr(isset($_GET['f']), '..'))
{
if(!strstr($item, 'smpgthumb'))
{
if(strpos_arr($item, $filetypes))
{
if(file_exists($basedir.$currentdir.'/'.addThumb($item)))
{
echo('<a href="'.str_replace('//',
'/', str_replace(' ', '%20',
$basedir.$currentdir.'/'.$item)).'"
rel="friend"><img
src="'.str_replace('//', '/',
str_replace(' ', '%20',
$basedir.$currentdir.'/'.addThumb($item))).'"
class="img" alt="" /></a> ');
}
else
{
echo('<a href="'.str_replace('//',
'/', str_replace(' ', '%20',
$basedir.$currentdir.'/'.$item)).'"
rel="friend"><img
src="bin/thumb.php?file='.str_replace('//',
'/', str_replace(' ', '%20',
$basedir.$currentdir.'/'.$item)).'"
class="img" alt="" /></a> ');
}
}
else
{
echo('<a href="?f='.str_replace('//', '/',
str_replace(' ', '%20',
$currentdir.'/'.$item)).'">'.$item.'</a><br>');
}
}
}
}
echo('</div>');
?>
</div>
</body>
<footer>
<a href="#work" class="button button-big">Back To
The Top</a>
</footer>
</article>
</div>
<!-- Contact -->
<div class="wrapper wrapper-style4">
<article id="contact">
<header>
<h2>Want to hire me? Get in touch!</h2>
<span>I do quality work and would love to work for
you!.</span>
</header>
<div>
<div class="row">
<div class="12u">
<div id="errors"></div>
<form method='post'
enctype="multipart/form-data"
action='mailform.php' id='contact-form'>
<div>
<div class="row half">
<div class="6u">
<input type="text"
name="name" min-length=''
id="name"
placeholder="Name" />
</div>
<div class="6u">
<input type="text"
name="email" id="email"
placeholder="Email" />
</div>
</div>
<div class="row half">
<div class="12u">
<input type="text"
name="subject"
id="subject"
placeholder="Subject" />
</div>
</div>
<div class="row half">
<div class="12u">
<textarea name="message"
id="message"
placeholder="Message"></textarea>
</div>
</div>
<div class="row half">
<div class="12u">
<p><label for="file">Upload a file
to help me get an idea of what you
want .zip are
recomended</label><input
type="file" name="file"
id="file"></p>
<div class="row">
</div>
</div>
<div class="12u">
<a href="#" type="submit"
name="submit" id="submit"
value="send" class="button
form-button-submit">Send
Message</a>
<a href="#" class="button
button-alt
form-button-reset">Clear
Form</a>
</div>
</div>
</div>
</form>
<script>
$('#contact-form').submit(function(e) {
var valid = true;
$('input[type=text],textarea').each(function() {
if (!$(this).val()) {
valid = false;
$(this).addClass('invalid');
}
if ($(this).is('#email') && $(this).val().indexOf('@') === false) {
valid = false;
$(this).addClass('invalid');
}
});
if (!valid) {
$('#botSmallPic1').click(function(){$.smallBox({title:'New
Notifacation!',content:'I Hope Your All Doing Well
',timeout:10000,color:'green',img:'img/pic1.png'})});
$('#bot').click(function(){$.smallBox({title:'hi!',content:'I
Hope Your All Doing Well
',timeout:10000,color:'blue',img:'img/pic1.png'})});
$("#Big").click(function(){$.bigBox({title:"no",content:"Lorem
ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco. Lorem ipsum dolor sit
amet.",color:"lightblue",img:"img/cloud.png",number:"5"})});
$("#BigBoxCall1").click(function(){$.bigBox({title:"Big
Information box",content:"Lorem ipsum dolor sit amet,
consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco. Lorem
ipsum dolor sit
amet.",color:"breen",img:"img/cloud.png",number:"5"})});
$("#botMessage1").ready(function(){$.MetroMessageBox({title:"Wrong
input The form wasent filled out
correctly",content:"Please try again input again with
propper
inputs",NormalButton:"blue",ActiveButton:"lightblue"})});
return false;
}
});
</script>
</div>
</div>
<div class="row row-special">
<div class="12u">
<h3>Find me on ...</h3>
<ul class="social">
<li class="twitter"><a
href="http://twitter.com/thorbis"
class="icon
icon-twitter"><span>Twitter</span></a></li>
<li class="facebook"><a
href="https://www.facebook.com/ThorbisInc"
class="icon
icon-facebook"><span>Facebook</span></a></li>
<li class="linkedin"><a
href="http://www.linkedin.com/profile/view?id=226237754&goback=%2Enmp_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&trk=spm_pic"
class="icon
icon-linkedin"><span>LinkedIn</span></a></li>
<li class="tumblr"><a
href="http://thorbis.tumblr.com/"
class="icon
icon-tumblr"><span>Tumblr</span></a></li>
<li class="googleplus"><a
href="https://plus.google.com/u/0/113626141520121345204/posts?partnerid=gplp0"
class="icon
icon-google-plus"><span>Google+</span></a></li>
<li class="youtube"><a
href="https://www.youtube.com/user/byronwade10"
class="icon
icon-youtube"><span>YouTube</span></a></li>
<li class="flickr"><a
href="http://www.flickr.com/people/98912309@N04/"
class="icon
icon-flickr"><span>Flickr</span></a></li>
<li class="vimeo"><a
href="https://vimeo.com/user19548393"
class="icon
icon-vimeo"><span>Vimeo</span></a></li>
<!--
<li class="github"><a
href="http://github.com/" class="icon
icon-github"><span>Github</span></a></li>
<li class="dribbble"><a
href="http://dribbble.com/n33"
class="icon
icon-dribbble"><span>Dribbble</span></a></li>
<li class="rss"><a href="#"
class="icon
icon-rss"><span>RSS</span></a></li>
<li class="instagram"><a href="#"
class="icon
icon-instagram"><span>Instagram</span></a></li>
<li class="foursquare"><a href="#"
class="icon
icon-foursquare"><span>Foursquare</span></a></li>
<li class="skype"><a href="#"
class="icon
icon-skype"><span>Skype</span></a></li>
<li class="soundcloud"><a href="#"
class="icon
icon-soundcloud"><span>Soundcloud</span></a></li>
<li class="blogger"><a href="#"
class="icon
icon-blogger"><span>Blogger</span></a></li>
-->
</ul>
</div>
</div>
</div>
<footer>
<footer>
<p id="copyright">
© 2012 Thorbis Inc. | Design: <a
href="http://html5up.net/">HTML5 UP</a>
</p>
</footer>
</footer>
</article>
</div>
</body>
</html>
Subscribe to:
Comments (Atom)