function, JSON, and variable
I've a problem with creation a function. For example I have a parsed json
date, I want to get value of 'test' and return it.
function returnVal(name) {
parsedJSON = JSON.parse('{"test": "hello"}');
return parsedJSON.name;
}
Thanks for any advices, and excuse me for my bad English :)
Saturday, 31 August 2013
JS in Rails App only loads the first time
JS in Rails App only loads the first time
I am using a fade effect on some links on my applications home page. This
is being accomplished by some JQuery:
javascripts/pages.js
$(document).ready(function() {
$('.home_tile_text').hide().removeClass('text').addClass('text-js');
$('.home_tile_overlay').hide().removeClass('overlay').addClass('overlay-js');
$('.home_tile').mouseenter(function(){
$(this).find('.text-js').finish().hide().fadeIn();
$(this).find('.overlay-js').finish().hide().fadeIn();
});
$('.home_tile').mouseleave(function(){
$(this).find('.text-js').finish().show().fadeOut();
$(this).find('.overlay-js').finish().show().fadeOut();
});
});
This all works great when I fire up the app for the first time. However,
if I navigate away from the home page, when I come back, the fade effect
no longer works until I "refresh" the page. Any ideas?
I am using a fade effect on some links on my applications home page. This
is being accomplished by some JQuery:
javascripts/pages.js
$(document).ready(function() {
$('.home_tile_text').hide().removeClass('text').addClass('text-js');
$('.home_tile_overlay').hide().removeClass('overlay').addClass('overlay-js');
$('.home_tile').mouseenter(function(){
$(this).find('.text-js').finish().hide().fadeIn();
$(this).find('.overlay-js').finish().hide().fadeIn();
});
$('.home_tile').mouseleave(function(){
$(this).find('.text-js').finish().show().fadeOut();
$(this).find('.overlay-js').finish().show().fadeOut();
});
});
This all works great when I fire up the app for the first time. However,
if I navigate away from the home page, when I come back, the fade effect
no longer works until I "refresh" the page. Any ideas?
Switching views in Xcode
Switching views in Xcode
pI am new to Xcode and I need to switch views: /p pgame *test = [[game
alloc] initWithNibName: nil bundle: nil]; [self
presentModalViewController:test animated:YES];/p pThat is the code that I
have and it is not switching views. Any help would be great./p
pI am new to Xcode and I need to switch views: /p pgame *test = [[game
alloc] initWithNibName: nil bundle: nil]; [self
presentModalViewController:test animated:YES];/p pThat is the code that I
have and it is not switching views. Any help would be great./p
One time popup box
One time popup box
Just like on gmail when google introduces a new feature I would like to
include a one time pop when a new user opens an account, then have the
"okay, I got it" button to click once they have read the message and it no
longer shows them the message again even after the session cleared.
Just like on gmail when google introduces a new feature I would like to
include a one time pop when a new user opens an account, then have the
"okay, I got it" button to click once they have read the message and it no
longer shows them the message again even after the session cleared.
what is ?
what is ?
I came across this data:text/html, <html contenteditable> in a blog. I've
used contenteditable for the div element before. But what exactly is this?
And how does it turn the browser to an editor?
I came across this data:text/html, <html contenteditable> in a blog. I've
used contenteditable for the div element before. But what exactly is this?
And how does it turn the browser to an editor?
How to make array data in custom jQuery Function?
How to make array data in custom jQuery Function?
I'm looking for some tutorial to make an array data in custom jQuery
Function, but I can't find any. Can you tell me how to make an array in
jQuery Function? I want to call my function like this :
$(this).myPlugin({
data_first: '1'
data_second: 'Hello'
});
my function script
(function($) {
$.fn.myPlugin = function(data) {
return this.each(function() {
alert(data[data_first]+' bla bla '+ data[data_second]);
});
}
})(jQuery);
I'm looking for some tutorial to make an array data in custom jQuery
Function, but I can't find any. Can you tell me how to make an array in
jQuery Function? I want to call my function like this :
$(this).myPlugin({
data_first: '1'
data_second: 'Hello'
});
my function script
(function($) {
$.fn.myPlugin = function(data) {
return this.each(function() {
alert(data[data_first]+' bla bla '+ data[data_second]);
});
}
})(jQuery);
Spring error with Linux Path
Spring error with Linux Path
I have been developing a java webapp on a windows machine and I got it to
work on my localhost.
Inside my applicationContext-service.xml is:
<property name="dlPath" value="C:/webapp/web/" />
Since my webapp worked perfectly on my localhost windows machine, I
decided to upload it to my live Linux Ubuntu machine and adjust the
property. I adjusted it to:
<property name="dlPath" value="/var/lib/tomcat7/ROOT/" />
Thinking that this line of code is the perfect "Linux version" of the
windows path, it should work, when instead, I get the following error:
[com.action.DownloadAction]: Bean property 'dlPath' is not writable or has
an invalid setter method. Does the parameter type of the setter match the
return type of the getter?
Getters and Setters are all set. It can't have anything to do with getters
and setters since it works perfectly on my localhost box.
I have been developing a java webapp on a windows machine and I got it to
work on my localhost.
Inside my applicationContext-service.xml is:
<property name="dlPath" value="C:/webapp/web/" />
Since my webapp worked perfectly on my localhost windows machine, I
decided to upload it to my live Linux Ubuntu machine and adjust the
property. I adjusted it to:
<property name="dlPath" value="/var/lib/tomcat7/ROOT/" />
Thinking that this line of code is the perfect "Linux version" of the
windows path, it should work, when instead, I get the following error:
[com.action.DownloadAction]: Bean property 'dlPath' is not writable or has
an invalid setter method. Does the parameter type of the setter match the
return type of the getter?
Getters and Setters are all set. It can't have anything to do with getters
and setters since it works perfectly on my localhost box.
Xcode build script to create Icon.png and Default.png assets
Xcode build script to create Icon.png and Default.png assets
I am building an application that exists of two different "versions". Each
version has a different layout (different strings, images, colors and
fonts). I accomplished this using macro's: there's one header file (let's
call it Layout.h for now) that is included in all classes. Layout.h
contains a #define statement that determines what version should be built.
If this statement, let's call it DARK_STYLE, is true, DarkStyle.h is
imported. If the statement is false, BrightStyle.h is included. Both
DarkStyle.h and BrightStyle.h contain the same defines, but with different
values. For example:
<DarkStyle.h>
#define TEXT_COLOR [UIColor blackColor]
<BrightStyle.h>
#define TEXT_COLOR [UIColor whiteColor]
So far so good. Now I have come to the point where the application has to
be shipped. Unfortunately, each version has a different app icon and
different splash screen. What I'm trying to do now is to get the app's
Icon.png and Default.png files generated automatically based on the
DARK_STYLE macro from Layout.h using an Xcode build script.
The build script I have at this point is able to determine whether
DARK_STYLE is set to 1 or 0. The next step is the one I have trouble with:
copy the Icon.png and Default.png assets belonging to the dark style to
the application's bundle (the build script is executed after the "Copy
Bundle Resources" phase).
The following does not work:
if find $SRCROOT -name "Layout.h" -exec echo {} \; -exec grep "#define
DARK_STYLE" {} \; -exec grep 1 {} \;
then
# Copy dark style resources and rename them
find $SRCROOT -name "dark_icon.png" -exec cp "{}"
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/" \;
mv
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/dark_icon.png"
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Icon.png"
else
find $SRCROOT -name "bright_icon.png" -exec cp "{}"
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/" \;
mv
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/bright_icon.png"
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Icon.png"
fi
What am I missing here?
I am building an application that exists of two different "versions". Each
version has a different layout (different strings, images, colors and
fonts). I accomplished this using macro's: there's one header file (let's
call it Layout.h for now) that is included in all classes. Layout.h
contains a #define statement that determines what version should be built.
If this statement, let's call it DARK_STYLE, is true, DarkStyle.h is
imported. If the statement is false, BrightStyle.h is included. Both
DarkStyle.h and BrightStyle.h contain the same defines, but with different
values. For example:
<DarkStyle.h>
#define TEXT_COLOR [UIColor blackColor]
<BrightStyle.h>
#define TEXT_COLOR [UIColor whiteColor]
So far so good. Now I have come to the point where the application has to
be shipped. Unfortunately, each version has a different app icon and
different splash screen. What I'm trying to do now is to get the app's
Icon.png and Default.png files generated automatically based on the
DARK_STYLE macro from Layout.h using an Xcode build script.
The build script I have at this point is able to determine whether
DARK_STYLE is set to 1 or 0. The next step is the one I have trouble with:
copy the Icon.png and Default.png assets belonging to the dark style to
the application's bundle (the build script is executed after the "Copy
Bundle Resources" phase).
The following does not work:
if find $SRCROOT -name "Layout.h" -exec echo {} \; -exec grep "#define
DARK_STYLE" {} \; -exec grep 1 {} \;
then
# Copy dark style resources and rename them
find $SRCROOT -name "dark_icon.png" -exec cp "{}"
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/" \;
mv
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/dark_icon.png"
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Icon.png"
else
find $SRCROOT -name "bright_icon.png" -exec cp "{}"
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/" \;
mv
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/bright_icon.png"
"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Icon.png"
fi
What am I missing here?
CSS3 image rotating spinner in JS for non CSS3 browsers?
CSS3 image rotating spinner in JS for non CSS3 browsers?
I have a rotating image spinner that looks fantastic...in browsers that
support it. it can be seen at kingpetroleum.co.uk/background.php - it's in
the top corner.
I need to somehow create the same effect for users that are using browsers
that can't display it.
I'm not great with javascript so would be hoping on finding a good
tutorial / guide etc but after a bit of googling I've not come up with
anything.
Any help is appreciated.
I have a rotating image spinner that looks fantastic...in browsers that
support it. it can be seen at kingpetroleum.co.uk/background.php - it's in
the top corner.
I need to somehow create the same effect for users that are using browsers
that can't display it.
I'm not great with javascript so would be hoping on finding a good
tutorial / guide etc but after a bit of googling I've not come up with
anything.
Any help is appreciated.
Friday, 30 August 2013
Laravel 4 - resource controller adding group prefix without changing route names
Laravel 4 - resource controller adding group prefix without changing route
names
See this example:
Route::group(array('prefix' => 'admin'), function()
{
//this resolves to admin/departments
Route::resource('departments', 'DepartmentsAdminController');
//this resolves to admin/users
Route::resource('users', 'UsersAdminController');
//this resolves to admin/companies
Route::resource('companies', 'CompaniesAdminController');
Route::resource('projects', 'ProjectsAdminController');
Route::resource('jobs', 'JobsAdminController');
Route::resource('milestones', 'MilestonesAdminController');
Route::resource('hours', 'HoursAdminController');
Route::resource('notes', 'NotesAdminController');
Route::resource('briefs', 'BriefsAdminController');
Route::resource('brief_items', 'BriefItemsAdminController');
});
Laravel changes route names based on the prefix in this case the prefix is
admin
so all route names now prefixed with admin see:
admin.users.create
admin.users.edit
But what if i want to change the prefix to something else I will have to
change the route names in my entire application.
Is there a way to keep the route names in resource controllers static and
change the prefix anytime i want ?
names
See this example:
Route::group(array('prefix' => 'admin'), function()
{
//this resolves to admin/departments
Route::resource('departments', 'DepartmentsAdminController');
//this resolves to admin/users
Route::resource('users', 'UsersAdminController');
//this resolves to admin/companies
Route::resource('companies', 'CompaniesAdminController');
Route::resource('projects', 'ProjectsAdminController');
Route::resource('jobs', 'JobsAdminController');
Route::resource('milestones', 'MilestonesAdminController');
Route::resource('hours', 'HoursAdminController');
Route::resource('notes', 'NotesAdminController');
Route::resource('briefs', 'BriefsAdminController');
Route::resource('brief_items', 'BriefItemsAdminController');
});
Laravel changes route names based on the prefix in this case the prefix is
admin
so all route names now prefixed with admin see:
admin.users.create
admin.users.edit
But what if i want to change the prefix to something else I will have to
change the route names in my entire application.
Is there a way to keep the route names in resource controllers static and
change the prefix anytime i want ?
Thursday, 29 August 2013
Issue with spaces in path name in Excel macro
Issue with spaces in path name in Excel macro
VLOOKUP definition is: "=IF(ISNA(VLOOKUP(RC[-7],'[\sqlc\Curr table &
Checklist\Currency table -
foreign.xlsx]Sheet1'!R2C1:R9999C2,2,FALSE))=FALSE,VLOOKUP(RC[-7],'[\sqlc\Curr
table & Checklist\Currency table -
foreign.xlsx]Sheet1'!R2C1:R9999C2,2,FALSE),""No a/c"")"
Excel is throwing an error due to the space between 'Curr' and 'table' in
the path name (and would also get upset about the following spaces in the
path name as well).
Q: Where do I insert speech marks (") to overcome the problem. Have tried
several options but no luck so far.
Thanks, Nigel.
VLOOKUP definition is: "=IF(ISNA(VLOOKUP(RC[-7],'[\sqlc\Curr table &
Checklist\Currency table -
foreign.xlsx]Sheet1'!R2C1:R9999C2,2,FALSE))=FALSE,VLOOKUP(RC[-7],'[\sqlc\Curr
table & Checklist\Currency table -
foreign.xlsx]Sheet1'!R2C1:R9999C2,2,FALSE),""No a/c"")"
Excel is throwing an error due to the space between 'Curr' and 'table' in
the path name (and would also get upset about the following spaces in the
path name as well).
Q: Where do I insert speech marks (") to overcome the problem. Have tried
several options but no luck so far.
Thanks, Nigel.
How to execute GO statement in Entity Framework Migrations CodeFirst
How to execute GO statement in Entity Framework Migrations CodeFirst
when we try to create a new database from our product is gives and error
in mirgrations. We are using GO statement in the migrations which is
causing the error. Following is the error:
System.Data.SqlClient.SqlException (0x80131904): Could not find stored
procedure 'GO'
Following is the migration class created :
namespace One234C.SRC.DomainModel.ORMapping.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AdditionOfBatchCostedFlagColumn : DbMigration
{
public override void Up()
{
AddColumn("Service.ServiceOrderComponentDetails",
"BatchCostedFlag", c => c.Byte(nullable: true));
Sql("GO");
string queryStr ="UPDATE
[Service].ServiceOrderComponentDetails " +
"SET BatchCostedFlag = 1";
Sql(queryStr);
AlterColumn("Service.ServiceOrderComponentDetails",
"BatchCostedFlag", c => c.Byte(nullable: false,
defaultValue:0));
}
public override void Down()
{
DropColumn("Service.ServiceOrderComponentDetails",
"BatchCostedFlag");
}
}
}
Is there anyway to do this operation without using go statement in
EntityFramework.
when we try to create a new database from our product is gives and error
in mirgrations. We are using GO statement in the migrations which is
causing the error. Following is the error:
System.Data.SqlClient.SqlException (0x80131904): Could not find stored
procedure 'GO'
Following is the migration class created :
namespace One234C.SRC.DomainModel.ORMapping.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AdditionOfBatchCostedFlagColumn : DbMigration
{
public override void Up()
{
AddColumn("Service.ServiceOrderComponentDetails",
"BatchCostedFlag", c => c.Byte(nullable: true));
Sql("GO");
string queryStr ="UPDATE
[Service].ServiceOrderComponentDetails " +
"SET BatchCostedFlag = 1";
Sql(queryStr);
AlterColumn("Service.ServiceOrderComponentDetails",
"BatchCostedFlag", c => c.Byte(nullable: false,
defaultValue:0));
}
public override void Down()
{
DropColumn("Service.ServiceOrderComponentDetails",
"BatchCostedFlag");
}
}
}
Is there anyway to do this operation without using go statement in
EntityFramework.
Edit specific Element in XDocument
Edit specific Element in XDocument
thanks for taking the time to answer my question. I recently started
learning C# and I ran into a problem using XML.Linq to store data. I hope
the question is understandable as I am not familiar with all the correct
terms yet and as English isn't my first language.
I read a lot of Questions/googled but I can not figure it out myself.
I want to update an existing XDocument File that looks like this:
<Data>
<IDCounter>2</IDCounter>
<Highscores>
.......
</Highscores>
<savegames>
<savegame>
<IdNumber>2</IdNumber>
<salutation>Mr</salutation>
<prename>Prename1</prename>
<surname>Surname1</surname>
<maximumbalance>100</maximumbalance>
<balance>100</balance>
</savegame>
<savegame>
<IdNumber>2</IdNumber>
<salutation>Mr</salutation>
<prename>Prename2</prename>
<surname>Surname2</surname>
<maximumbalance>100</maximumbalance>
<balance>100</balance>
</savegame>
</savegames>
</Data>
What is the easiest way to change a value in a specific Element?
Let's say I want to change the "balance" of a specific "savegame".
I want to access the savegame by "IdNumber" (these numbers are unique)
Then I want to change the value of "balance" (for example to 50) and then
save these changes to my document.
Thank you in advance!
thanks for taking the time to answer my question. I recently started
learning C# and I ran into a problem using XML.Linq to store data. I hope
the question is understandable as I am not familiar with all the correct
terms yet and as English isn't my first language.
I read a lot of Questions/googled but I can not figure it out myself.
I want to update an existing XDocument File that looks like this:
<Data>
<IDCounter>2</IDCounter>
<Highscores>
.......
</Highscores>
<savegames>
<savegame>
<IdNumber>2</IdNumber>
<salutation>Mr</salutation>
<prename>Prename1</prename>
<surname>Surname1</surname>
<maximumbalance>100</maximumbalance>
<balance>100</balance>
</savegame>
<savegame>
<IdNumber>2</IdNumber>
<salutation>Mr</salutation>
<prename>Prename2</prename>
<surname>Surname2</surname>
<maximumbalance>100</maximumbalance>
<balance>100</balance>
</savegame>
</savegames>
</Data>
What is the easiest way to change a value in a specific Element?
Let's say I want to change the "balance" of a specific "savegame".
I want to access the savegame by "IdNumber" (these numbers are unique)
Then I want to change the value of "balance" (for example to 50) and then
save these changes to my document.
Thank you in advance!
Wednesday, 28 August 2013
MySQL Update by Row number
MySQL Update by Row number
I need to update rows by their number(not AI ID, cause some of the rows
may will be removed). How can I do this? I mean something like this:
UPDATE cars SET idx = value WHERE row_number = i
I would do this in a 'for' statement, and i is the integer of my
statement. So I would update every row in the statement.
Sorry for my bad english, and thanks!
I need to update rows by their number(not AI ID, cause some of the rows
may will be removed). How can I do this? I mean something like this:
UPDATE cars SET idx = value WHERE row_number = i
I would do this in a 'for' statement, and i is the integer of my
statement. So I would update every row in the statement.
Sorry for my bad english, and thanks!
Set ttl and namespace using Memcached in Zend Framework 2
Set ttl and namespace using Memcached in Zend Framework 2
As far as I can figure this seems to be the way to set up Memcached and
set the TTL and Namespace but they have no effect in the cache. The key is
not prefixed with a namespace and the expire is infinite.
$MemcachedResourceManager = new
\Zend\Cache\Storage\Adapter\MemcachedResourceManager(1, new
\Zend\Cache\Storage\Adapter\Memcached());
$MemcachedResourceManager->addServer(1, array('localhost', 11211));
$MemcachedOptions->setResourceManager($MemcachedResourceManager);
$MemcachedOptions->setNamespace('FooBar_');
$MemcachedOptions->setTtl(10);
$cache = $MemcachedOptions->getResourceManager()->getResource(1);
$cache->set('foobar_key','I am in cache');
Does anyone have any tips, clues? Any help would be much appreciated.
As far as I can figure this seems to be the way to set up Memcached and
set the TTL and Namespace but they have no effect in the cache. The key is
not prefixed with a namespace and the expire is infinite.
$MemcachedResourceManager = new
\Zend\Cache\Storage\Adapter\MemcachedResourceManager(1, new
\Zend\Cache\Storage\Adapter\Memcached());
$MemcachedResourceManager->addServer(1, array('localhost', 11211));
$MemcachedOptions->setResourceManager($MemcachedResourceManager);
$MemcachedOptions->setNamespace('FooBar_');
$MemcachedOptions->setTtl(10);
$cache = $MemcachedOptions->getResourceManager()->getResource(1);
$cache->set('foobar_key','I am in cache');
Does anyone have any tips, clues? Any help would be much appreciated.
bootstrap - using visible-phone to change CSS not working
bootstrap - using visible-phone to change CSS not working
CSS nob looking at bootstrap...
I assumed classes like .visible-phone, .visible-desktop, etc... were
applied to the body tag. Looking in firebug that doesn't appear to be the
case.
What I'm trying to do is change CSS settings based on .visible-xxxx, for
example:
.ugly-color { color: red; }
.visible-desktop .ugly-color { color: green; }
<div class="visible-desktop">I see this text</div>
<div class="ugly-color">Why is this red and not green</div>
Does anyone know where the .visible-desktop is applied? as if it was the
body tag, then ugly-color would be inside .visible-desktop
All input appreciated. Thanks!
CSS nob looking at bootstrap...
I assumed classes like .visible-phone, .visible-desktop, etc... were
applied to the body tag. Looking in firebug that doesn't appear to be the
case.
What I'm trying to do is change CSS settings based on .visible-xxxx, for
example:
.ugly-color { color: red; }
.visible-desktop .ugly-color { color: green; }
<div class="visible-desktop">I see this text</div>
<div class="ugly-color">Why is this red and not green</div>
Does anyone know where the .visible-desktop is applied? as if it was the
body tag, then ugly-color would be inside .visible-desktop
All input appreciated. Thanks!
Set in the BundleConfig but load script fail - MVC4 Razor
Set in the BundleConfig but load script fail - MVC4 Razor
I have set the bundleConfig file like this :
bundles.Add(new
ScriptBundle("~/bundles/MyTest").Include("~/Scripts/test.js").Include(
"~/Scripts/test.init.js"));
bundles.Add(new
ScriptBundle("~/bundles/Angular").Include("~/Scripts/angular.min.js"));
I call them is my Layout like this :
@Scripts.Render("~/bundles/Angular") <!-- ERROR -->
@Scripts.Render("~/bundles/MyTest") <!-- SUCCESS -->
Where's my error, please ?
I have set the bundleConfig file like this :
bundles.Add(new
ScriptBundle("~/bundles/MyTest").Include("~/Scripts/test.js").Include(
"~/Scripts/test.init.js"));
bundles.Add(new
ScriptBundle("~/bundles/Angular").Include("~/Scripts/angular.min.js"));
I call them is my Layout like this :
@Scripts.Render("~/bundles/Angular") <!-- ERROR -->
@Scripts.Render("~/bundles/MyTest") <!-- SUCCESS -->
Where's my error, please ?
Translating iptables rule to ip6tables
Translating iptables rule to ip6tables
What's the equivalent of this iptables rule in ip6tables:
-A OUTPUT -s 127.0.0.1/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports
8080
I tried this and it doesn't seem to work:
-A OUTPUT -s ::1/128 -p tcp -m tcp --dport 80 -j REDIRECT --on-port 8080
What's the equivalent of this iptables rule in ip6tables:
-A OUTPUT -s 127.0.0.1/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports
8080
I tried this and it doesn't seem to work:
-A OUTPUT -s ::1/128 -p tcp -m tcp --dport 80 -j REDIRECT --on-port 8080
Tuesday, 27 August 2013
I using mvc:resource mapping to map resources
I using mvc:resource mapping to map resources
Ok under my web root I have placed all resources js, css, images in a
folder, then in my app-context.xml I put the mvc:resources annotation.
webroot ... layout js css images
the problem is third party libs look for resources of the root and they
can't be found, even if I place an images folder of the root,
Ok under my web root I have placed all resources js, css, images in a
folder, then in my app-context.xml I put the mvc:resources annotation.
webroot ... layout js css images
the problem is third party libs look for resources of the root and they
can't be found, even if I place an images folder of the root,
PHP Shorthand If/Else when using return
PHP Shorthand If/Else when using return
There are few nice ways to write shorthands in PHP.
Less common but shortest example:
!isset( $search_order ) && $search_order = 'ASC';
More common but a little longer:
!isset( $search_order ) ? $search_order = 'ASC' : $search_order = NULL;
We can even combine examples above in to an amazing shorthand:
!isset( $_POST['unique_id'] ) && preg_match( '/^[a-zA-Z0-9]{8}$/',
$_POST['unique_id'] ) ? $post_unique_id = $_POST['unique_id'] :
$post_unique_id = NULL;
But how do we use examples above with functions and return, example:
function filter_gender_request($data) {
preg_match('/(fe)?male/i', $data, $data);
isset($data[0]) && return $data[0]; // It doesn't work here with return
}
At the same time, if I state the following, instead of isset($data[0]) &&
return $data[0]; then everything works as expected:
if (isset($data[0]) ) {
return $data[0];
}
What am I doing wrong here? If the very first and shortest example works
outside of function flawlessly, why then it doesn't work with return?
Is there a possibility to use shorthands with return?
There are few nice ways to write shorthands in PHP.
Less common but shortest example:
!isset( $search_order ) && $search_order = 'ASC';
More common but a little longer:
!isset( $search_order ) ? $search_order = 'ASC' : $search_order = NULL;
We can even combine examples above in to an amazing shorthand:
!isset( $_POST['unique_id'] ) && preg_match( '/^[a-zA-Z0-9]{8}$/',
$_POST['unique_id'] ) ? $post_unique_id = $_POST['unique_id'] :
$post_unique_id = NULL;
But how do we use examples above with functions and return, example:
function filter_gender_request($data) {
preg_match('/(fe)?male/i', $data, $data);
isset($data[0]) && return $data[0]; // It doesn't work here with return
}
At the same time, if I state the following, instead of isset($data[0]) &&
return $data[0]; then everything works as expected:
if (isset($data[0]) ) {
return $data[0];
}
What am I doing wrong here? If the very first and shortest example works
outside of function flawlessly, why then it doesn't work with return?
Is there a possibility to use shorthands with return?
Javascript - objects in arrays
Javascript - objects in arrays
I'm quite a beginner in Javascript and trying to make a blackjack game.
Arrays and objects:
card = {}, //every card is an object having 3 properties: suit, number and
points
playerCards = [], //an array containing player cards (objects)
dealerCards = [], //an array containing dealer cards (objects)
I also created manually some cards for testing purposes, like this:
card = {
suit : "spade",
number : "queen",
points : 10
};
playerCards.push(card);
Then i have a function to randomly create a new card
function createCard(card, suit, number, points) {
"use strict";
var i = Math.floor(Math.random() * 4);
card.suit = suit[i];
i = Math.floor(Math.random() * 13);
card.number = number[i];
card.points = points[i];
return card;
}
It works, but when it creates a new card it replaces the last one manually
added in playerCards/dealerCards array. I can prevent it with creating a
pointless sample card and not adding it to array (then this one will be
replaced), but it doesn't seem right. So what should i do?
Thanks in advance!
I'm quite a beginner in Javascript and trying to make a blackjack game.
Arrays and objects:
card = {}, //every card is an object having 3 properties: suit, number and
points
playerCards = [], //an array containing player cards (objects)
dealerCards = [], //an array containing dealer cards (objects)
I also created manually some cards for testing purposes, like this:
card = {
suit : "spade",
number : "queen",
points : 10
};
playerCards.push(card);
Then i have a function to randomly create a new card
function createCard(card, suit, number, points) {
"use strict";
var i = Math.floor(Math.random() * 4);
card.suit = suit[i];
i = Math.floor(Math.random() * 13);
card.number = number[i];
card.points = points[i];
return card;
}
It works, but when it creates a new card it replaces the last one manually
added in playerCards/dealerCards array. I can prevent it with creating a
pointless sample card and not adding it to array (then this one will be
replaced), but it doesn't seem right. So what should i do?
Thanks in advance!
deciding what to support
deciding what to support
I am creating a library for converting html to PDF, the end result will
potentially support all html4.0 elements. There are JS libraries
available, however they do not offer customization. What would you like to
support in this library? Custom positioning is available as well as font
type, color, and size. Text alignment is also supported.
I would like to add images but do not know the syntax so this may take a
while. Html tables and list will also be supported. For now i can not
think of anything else to support.
I am creating a library for converting html to PDF, the end result will
potentially support all html4.0 elements. There are JS libraries
available, however they do not offer customization. What would you like to
support in this library? Custom positioning is available as well as font
type, color, and size. Text alignment is also supported.
I would like to add images but do not know the syntax so this may take a
while. Html tables and list will also be supported. For now i can not
think of anything else to support.
Error in if loop
Error in if loop
I am a beginner. In my project I am using java and mysql workbench. while
displaying user details in a table I found some errors but I cant identify
where is that error. The code is mentioning below.
<%
if((Integer.parseInt((rs.getString("setter")).trim())==1) and
(Integer.parseInt((rs.getString("scrutinizer")).trim())==1))
{
out.println("Both")
}
else if(Integer.parseInt((rs.getString("setter")).trim())==1)
{
out.println("Question Setter");
}
else if(Integer.parseInt((rs.getString("scrutinizer")).trim())==1)
{
out.println("Scrutinizer");
}
%>
The error showing are ) Expected ; Expected else without if Illegal Start
of type. missing return statement etc... Please some body help me.
I am a beginner. In my project I am using java and mysql workbench. while
displaying user details in a table I found some errors but I cant identify
where is that error. The code is mentioning below.
<%
if((Integer.parseInt((rs.getString("setter")).trim())==1) and
(Integer.parseInt((rs.getString("scrutinizer")).trim())==1))
{
out.println("Both")
}
else if(Integer.parseInt((rs.getString("setter")).trim())==1)
{
out.println("Question Setter");
}
else if(Integer.parseInt((rs.getString("scrutinizer")).trim())==1)
{
out.println("Scrutinizer");
}
%>
The error showing are ) Expected ; Expected else without if Illegal Start
of type. missing return statement etc... Please some body help me.
What is the most efficient data structure in R?
What is the most efficient data structure in R?
I would like to reprogram a large simulation to make it more efficient. An
obvious first step is to preallocate variables etc and I would like to
decide on a data structure that is most efficient in terms of computing
speed.
Also is it advisable to use the same data structure throughout the whole
simulaton?
Data mainly consists of multiple rows and columns of numbers and
operations are:
search in specific rows and columns, add new columns and values, execute
functions sequentially of each row, choose the largest number in a row,
and many replications.
I would like to reprogram a large simulation to make it more efficient. An
obvious first step is to preallocate variables etc and I would like to
decide on a data structure that is most efficient in terms of computing
speed.
Also is it advisable to use the same data structure throughout the whole
simulaton?
Data mainly consists of multiple rows and columns of numbers and
operations are:
search in specific rows and columns, add new columns and values, execute
functions sequentially of each row, choose the largest number in a row,
and many replications.
Monday, 26 August 2013
jQuery menu open after page load, should start out closed
jQuery menu open after page load, should start out closed
My menu starts out open on my page, i need it to start out closed, thanks,
i pasted both the jquery and the html with php, i dont know what else to
add to this, i'm not very good with jquery
jQuery.noConflict();
var gbs = {};
gbs.ready = function($) {
// Location drop
var local_config = {
sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
interval: 80, // number = milliseconds for onMouseOver polling interval
over: doOpen, // function = onMouseOver callback (REQUIRED)
timeout: 500, // number = milliseconds delay before onMouseOut
out: doClose // function = onMouseOut callback (REQUIRED)
};
function doOpen() {
jQuery('#locations_header_wrap').slideDown("fast");
jQuery(this).addClass('active');
}
function doClose() {
jQuery('#locations_header_wrap').slideUp("medium");
jQuery('.header-locations-drop-link').removeClass('active');
}
jQuery('.header-locations-drop-link').hoverIntent(local_config);
<?php $locations = gb_get_locations();
if ( !empty( $locations ) && !is_wp_error( $locations ) ) : ?>
<div id="location">
<div class="header-locations-drop-link gb_ff">
<span class="current_location"><?php
gb_current_location_extended(); ?></span>
<div id="locations_header_wrap" class="clearfix cloak
header_color font_small">
<?php gb_list_locations(); ?>
</div><!-- #locations_header_wrap. -->
</div>
</div>
<?php endif; ?>
My menu starts out open on my page, i need it to start out closed, thanks,
i pasted both the jquery and the html with php, i dont know what else to
add to this, i'm not very good with jquery
jQuery.noConflict();
var gbs = {};
gbs.ready = function($) {
// Location drop
var local_config = {
sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
interval: 80, // number = milliseconds for onMouseOver polling interval
over: doOpen, // function = onMouseOver callback (REQUIRED)
timeout: 500, // number = milliseconds delay before onMouseOut
out: doClose // function = onMouseOut callback (REQUIRED)
};
function doOpen() {
jQuery('#locations_header_wrap').slideDown("fast");
jQuery(this).addClass('active');
}
function doClose() {
jQuery('#locations_header_wrap').slideUp("medium");
jQuery('.header-locations-drop-link').removeClass('active');
}
jQuery('.header-locations-drop-link').hoverIntent(local_config);
<?php $locations = gb_get_locations();
if ( !empty( $locations ) && !is_wp_error( $locations ) ) : ?>
<div id="location">
<div class="header-locations-drop-link gb_ff">
<span class="current_location"><?php
gb_current_location_extended(); ?></span>
<div id="locations_header_wrap" class="clearfix cloak
header_color font_small">
<?php gb_list_locations(); ?>
</div><!-- #locations_header_wrap. -->
</div>
</div>
<?php endif; ?>
Its possible to a static var recieve "require __DIR__.'/paths.php'"?
Its possible to a static var recieve "require __DIR__.'/paths.php'"?
workspace: php 5.4, apache 2.4
My code:
class Test{
private static $paths = array();
self::$paths = require __DIR__.'paths.php';
//another code
}
is it possible to use this? My objective is to create a variable to recive
an array that contain many paths for the app.
workspace: php 5.4, apache 2.4
My code:
class Test{
private static $paths = array();
self::$paths = require __DIR__.'paths.php';
//another code
}
is it possible to use this? My objective is to create a variable to recive
an array that contain many paths for the app.
Can I use iterlocked classes set 2 variables in a multithreaded env
Can I use iterlocked classes set 2 variables in a multithreaded env
I'm new to programming/C# and have a question.. I have multiple threads
reading from files (1 thread/file) on a multicore/cpu machine. A file can
contain either ticks(bid/ask info,etc) or bars(open,high,low,close,vol). I
have a worker class, which is the target of the thread doWork, which reads
the file. A worker/thread can only read either bars or ticks, not both,
that is 1 file will be all bars, or all ticks, etc.. Each thread reads the
ticks or bars into its own buffer.
I don't use generics or inheritance for performance reasons(I'll probably
implement both and test performance). I use a ringbuffer (only 1
read/1writer thread per buffer so this is safe). I also instead check the
type of worker to determine if I have a tick or bar.
What I want to do is then process a tick or bar in order by time.. So when
a worker adds a bar/tick to its buffer, I want it to get the time and
compare to a global mintime, and if it's less, then set the global mintime
and set the global index variable so the main thread will know which index
to use in its list to get the data in order.
Do I have to lock (I avoid locking using a ringbuffer) or use the
interlocked class somehow in both the main and worker?
Code below is pseudocode so not fully correct, but hopefully you get the
idea. I'm looking for the best way performance wise.
In my current implementation, before I call GetTick or GetBar in Main, I
call NextTime on every simworker in a loop and then sort an array in the
main worker list. I think keeping track in the worker thread itself will
be more efficient, just not sure about synchronization. Maybe having to
synchronize will erase any benefit.
Pseudocode EX:
Main()
{
List<worker> workers = new List<worker>;
workers.Add(new worker(0,TICK));
workers.Add(new worker(1,BAR));
workers.Add(new worker(2,TICK));
workers.Add(new worker(3,BAR)); //etcc, etc.. I do this in a loop.
//also start all workers - RunAsync.. then.
if(workers[index].workerType == TICK)
Tick= workers[index].GetTick();
else
Bar b = workers[index].GetBar();
}
public long mintime;
public int index;
class worker : BackgroundWorker
{
RingBuffer<tick> trb
RingBuffer<bar> brb
int idx;
public type workerType;
worker(int i, type wtype)
{ idx = i; workerType = wtype }
doWork()
{while(reader.NextData) ;} //calls callback..
callback(tick t) { trb.add(t); if(t.time < mintime) { mintime=t.time;
index= idx}//???
callback(bar b){ brb.add(b); if(b.time < mintime) { mintime=b.time;
index =idx}
Tick GetTick() { trb.Read();}
Bar GetBar() {brb.Read();{
}
I'm new to programming/C# and have a question.. I have multiple threads
reading from files (1 thread/file) on a multicore/cpu machine. A file can
contain either ticks(bid/ask info,etc) or bars(open,high,low,close,vol). I
have a worker class, which is the target of the thread doWork, which reads
the file. A worker/thread can only read either bars or ticks, not both,
that is 1 file will be all bars, or all ticks, etc.. Each thread reads the
ticks or bars into its own buffer.
I don't use generics or inheritance for performance reasons(I'll probably
implement both and test performance). I use a ringbuffer (only 1
read/1writer thread per buffer so this is safe). I also instead check the
type of worker to determine if I have a tick or bar.
What I want to do is then process a tick or bar in order by time.. So when
a worker adds a bar/tick to its buffer, I want it to get the time and
compare to a global mintime, and if it's less, then set the global mintime
and set the global index variable so the main thread will know which index
to use in its list to get the data in order.
Do I have to lock (I avoid locking using a ringbuffer) or use the
interlocked class somehow in both the main and worker?
Code below is pseudocode so not fully correct, but hopefully you get the
idea. I'm looking for the best way performance wise.
In my current implementation, before I call GetTick or GetBar in Main, I
call NextTime on every simworker in a loop and then sort an array in the
main worker list. I think keeping track in the worker thread itself will
be more efficient, just not sure about synchronization. Maybe having to
synchronize will erase any benefit.
Pseudocode EX:
Main()
{
List<worker> workers = new List<worker>;
workers.Add(new worker(0,TICK));
workers.Add(new worker(1,BAR));
workers.Add(new worker(2,TICK));
workers.Add(new worker(3,BAR)); //etcc, etc.. I do this in a loop.
//also start all workers - RunAsync.. then.
if(workers[index].workerType == TICK)
Tick= workers[index].GetTick();
else
Bar b = workers[index].GetBar();
}
public long mintime;
public int index;
class worker : BackgroundWorker
{
RingBuffer<tick> trb
RingBuffer<bar> brb
int idx;
public type workerType;
worker(int i, type wtype)
{ idx = i; workerType = wtype }
doWork()
{while(reader.NextData) ;} //calls callback..
callback(tick t) { trb.add(t); if(t.time < mintime) { mintime=t.time;
index= idx}//???
callback(bar b){ brb.add(b); if(b.time < mintime) { mintime=b.time;
index =idx}
Tick GetTick() { trb.Read();}
Bar GetBar() {brb.Read();{
}
What programming languages can I use in blender=?iso-8859-1?Q?=3F_=96_blender.stackexchange.com?=
What programming languages can I use in blender? – blender.stackexchange.com
What version of python does Blender use and are other languages available?
Also, does python work the same in blender as when you write console
applications or when working with pygame or are there …
What version of python does Blender use and are other languages available?
Also, does python work the same in blender as when you write console
applications or when working with pygame or are there …
I can't reformat my laptop (HP Pavilion dm1 3016au)
I can't reformat my laptop (HP Pavilion dm1 3016au)
The OS that I was using is Windows 8. I wanted to reformat it to Windows
7. But the problem is whenever i put the bootable usb an error message
appeared when booted "A required CD/DVD device driver is missing". I
accidentally deleted the HP recovery manager. Is there a way I can make my
laptop to factory reset?
The OS that I was using is Windows 8. I wanted to reformat it to Windows
7. But the problem is whenever i put the bootable usb an error message
appeared when booted "A required CD/DVD device driver is missing". I
accidentally deleted the HP recovery manager. Is there a way I can make my
laptop to factory reset?
Thieves steal gold by melting it through a hole=?iso-8859-1?Q?=3F_=96_movies.stackexchange.com?=
Thieves steal gold by melting it through a hole? – movies.stackexchange.com
Which Movie is this? I remember the opening scene where the thieves make a
hole under a bank vault and then heat the gold till it melts down into a
trailer placed underneath. I cannot remember what …
Which Movie is this? I remember the opening scene where the thieves make a
hole under a bank vault and then heat the gold till it melts down into a
trailer placed underneath. I cannot remember what …
Sunday, 25 August 2013
Is there any penetration testing toolkit other then LPT Vampireware?
Is there any penetration testing toolkit other then LPT Vampireware?
I'm currently a IT security consultant under a company and I need to run a
penetration testing on their server, I have been using LPT Vampireware as
my favourite set toolkit but what i found is this software only runs in 32
bit machine, is there any recommended set toolkit similar to LPT
vampireware that can be used?
I'm currently a IT security consultant under a company and I need to run a
penetration testing on their server, I have been using LPT Vampireware as
my favourite set toolkit but what i found is this software only runs in 32
bit machine, is there any recommended set toolkit similar to LPT
vampireware that can be used?
zip file not found, while unzipping of files in linux 5.5
zip file not found, while unzipping of files in linux 5.5
Past couple of month im facing issue on my server. File are not unzipping
properly with automated script. The Out of 10 folder, one folder is not
unzipped properly. While unzipping affected folder manully it working
fine. Size of Each zip folder is 1Gb. Kindly help me. Thanks in advance.
Past couple of month im facing issue on my server. File are not unzipping
properly with automated script. The Out of 10 folder, one folder is not
unzipped properly. While unzipping affected folder manully it working
fine. Size of Each zip folder is 1Gb. Kindly help me. Thanks in advance.
Get gmail attachment URL with Imapx in c# (mvc)
Get gmail attachment URL with Imapx in c# (mvc)
I was wondering is it possible to get gmail message attachment URL. I need
URL something like
www.gmail.com/jshgdfj......picture1.jpg
I can use Imapx, imap or whatever free code for accesing gmail. I need
this to get mails faster, because if I download all attachments it is very
slow. I want to show just attachment name with link to download attachment
(something like gmail download button). Can anybody help me?
I was wondering is it possible to get gmail message attachment URL. I need
URL something like
www.gmail.com/jshgdfj......picture1.jpg
I can use Imapx, imap or whatever free code for accesing gmail. I need
this to get mails faster, because if I download all attachments it is very
slow. I want to show just attachment name with link to download attachment
(something like gmail download button). Can anybody help me?
how to make ArcGIS Silverlight web application support arabic and english language?
how to make ArcGIS Silverlight web application support arabic and english
language?
I want to make a web application using Arcgis silverlight API and the web
should support English and Arabic language.
is there are easy way to that through a template or something.
it was so easy in the Web ADF to transform from lesf to right page view to
right to left view
what about the silverlight api ? how to do that?
language?
I want to make a web application using Arcgis silverlight API and the web
should support English and Arabic language.
is there are easy way to that through a template or something.
it was so easy in the Web ADF to transform from lesf to right page view to
right to left view
what about the silverlight api ? how to do that?
Saturday, 24 August 2013
Python: third Friday of a month
Python: third Friday of a month
I am a rookie python programmer and I need to write a script to check if a
given date (passed as a string in the form 'Month, day year') is the third
Friday of the month. I am using Python 2.7.
For example, these dates can help you better understand my problem. Have a
yearly calendar at hand.
input ---> output
'Jan 18, 2013' ---> True
'Feb 22, 2013' ---> False
'Jun 21, 2013' ---> True
'Sep 20, 2013' ---> True
I just want to use standard classes provided by the language, like time,
datetime, calendar, etc.
I have looked into some answers but I see calculations like
addidng/substracting 86400 seconds for every day or even doing comparisons
depending on the number of days that a month has. IMHO these are wrong
because the libreries in Python already take care of these details so
there is no need to reinvent the wheel. Also calendars and dates are
complex: leap years, leap seconds, time zones, week numbers, etc. so I
think is better to let the libraries solve these tricky details.
Thanks in advance for your help.
I am a rookie python programmer and I need to write a script to check if a
given date (passed as a string in the form 'Month, day year') is the third
Friday of the month. I am using Python 2.7.
For example, these dates can help you better understand my problem. Have a
yearly calendar at hand.
input ---> output
'Jan 18, 2013' ---> True
'Feb 22, 2013' ---> False
'Jun 21, 2013' ---> True
'Sep 20, 2013' ---> True
I just want to use standard classes provided by the language, like time,
datetime, calendar, etc.
I have looked into some answers but I see calculations like
addidng/substracting 86400 seconds for every day or even doing comparisons
depending on the number of days that a month has. IMHO these are wrong
because the libreries in Python already take care of these details so
there is no need to reinvent the wheel. Also calendars and dates are
complex: leap years, leap seconds, time zones, week numbers, etc. so I
think is better to let the libraries solve these tricky details.
Thanks in advance for your help.
data being over-written. Android
data being over-written. Android
I am reading data from a sensor into two static double []'s called Gain
and Phase. Then depending on what button the user pressed to start
collecting data from the sensor, I save this data to another double [].
Ex:
if (What_Button == 1){
oGain = gain;
oPhase = phase;
output.setText("OPEN saved");
}
if (What_Button == 2){
sGain = gain;
sPhase = phase;
output.setText("SHORT saved");
}
if (What_Button == 3){
lGain = gain;
lPhase = phase;
output.setText("LOAD saved");
}
I then wish to plot the original Gain and Phase data. Before I do this I
convert the gain into dB and the phase into degrees.
i.e.
for (int i=0; i<_steps; i++) {
phase[i]=Math.toDegrees(phase[i]);
gain[i]=20*Math.log10(gain[i]);
}
This plotting works fine but after gain and phase have been converted my
saved data "lgain" "lphase", etc are changed. It is as if they have been
reassigned to the new Gain and Phase values instantly. I surrounded the
code above with System.out.pritln commands to view the lgain, lphase, etc.
values before and after and this is certainly where they are being changed
at. I used ctrl-f to find all instances of lgain, lphase, etc and they are
not being reassigned anywhere else. Any ideas how to fix this?
C
I am reading data from a sensor into two static double []'s called Gain
and Phase. Then depending on what button the user pressed to start
collecting data from the sensor, I save this data to another double [].
Ex:
if (What_Button == 1){
oGain = gain;
oPhase = phase;
output.setText("OPEN saved");
}
if (What_Button == 2){
sGain = gain;
sPhase = phase;
output.setText("SHORT saved");
}
if (What_Button == 3){
lGain = gain;
lPhase = phase;
output.setText("LOAD saved");
}
I then wish to plot the original Gain and Phase data. Before I do this I
convert the gain into dB and the phase into degrees.
i.e.
for (int i=0; i<_steps; i++) {
phase[i]=Math.toDegrees(phase[i]);
gain[i]=20*Math.log10(gain[i]);
}
This plotting works fine but after gain and phase have been converted my
saved data "lgain" "lphase", etc are changed. It is as if they have been
reassigned to the new Gain and Phase values instantly. I surrounded the
code above with System.out.pritln commands to view the lgain, lphase, etc.
values before and after and this is certainly where they are being changed
at. I used ctrl-f to find all instances of lgain, lphase, etc and they are
not being reassigned anywhere else. Any ideas how to fix this?
C
django-celery process goes to 100 % and tasks are not executed
django-celery process goes to 100 % and tasks are not executed
I am using last version of django-celery with RabbitMQ Worker on Ubuntu
12.04 Server. I start to have problem with celery tasks before a month ago
and I can not figure out what is the problem. I run celery into production
with supervisord, I dont know why but there is moments when some of the
process that run celery go to 100% usages of CPU and stay at that point
until I restart the celery an kill existing process. When this happen
worker does not get more tasks and they are not executed until I restart
the celery. Comman with which I run celery from supervisord is:
django-admin.py celeryd -v 2 -B -s celery -E -l INFO
Thank you for your help.
I am using last version of django-celery with RabbitMQ Worker on Ubuntu
12.04 Server. I start to have problem with celery tasks before a month ago
and I can not figure out what is the problem. I run celery into production
with supervisord, I dont know why but there is moments when some of the
process that run celery go to 100% usages of CPU and stay at that point
until I restart the celery an kill existing process. When this happen
worker does not get more tasks and they are not executed until I restart
the celery. Comman with which I run celery from supervisord is:
django-admin.py celeryd -v 2 -B -s celery -E -l INFO
Thank you for your help.
Programmatically draw (and label) a triangle's angle
Programmatically draw (and label) a triangle's angle
I want to draw and label angle A (alpha) of my ABC triangle while still
being able to change to coordinate of A B and C so that the angle and the
mark adapts to it. I've managed to create something, but partly not really
understanding what I'm doing and looking for a more solid solid solution,
I'm asking for some help here. The drawing that I need, has more than
three points, but I think, once I understand this, the rest will be easier
to understand. (I also have problems with pasting my code in the question.
I always have to edit it.)
\documentclass{article}
\usepackage{pgfplots}
\usetkzobj{all} %also needed
\begin{document}
\begin{tikzpicture}
\coordinate (M) at (0,0) ;
\coordinate (A) at (canvas polar cs:angle=90,radius=3cm) ;
\coordinate (B) at (canvas polar cs:angle=-30,radius=3cm) ;
\coordinate (C) at (canvas polar cs:angle=30,radius=3cm);
\draw[fill=red!30] (A)-- +(-60:2cm) arc (-60:-30:2cm) -- cycle;
\draw (M) circle (3cm);
\fill (M) circle (1pt) node[below left] {M};
\draw (A) -- (B);
\draw (A) -- (C);
\filldraw (A) circle(1pt) node[above] {A};
\filldraw (B) circle(1pt) node[right] {B};
\filldraw (C) circle(1pt) node[right] {C};
\draw (B) -- (C);
\draw(70:2.4cm) node {$\alpha$};
%the answer thanks to Claudio
\tkzMarkAngle[fill= orange,size=0.65cm, opacity=.4](A,C,B)
\tkzLabelAngle[pos = -0.5](A,C,B){$\gamma$}
%end answer
\end{tikzpicture}
\end{document}
I want to draw and label angle A (alpha) of my ABC triangle while still
being able to change to coordinate of A B and C so that the angle and the
mark adapts to it. I've managed to create something, but partly not really
understanding what I'm doing and looking for a more solid solid solution,
I'm asking for some help here. The drawing that I need, has more than
three points, but I think, once I understand this, the rest will be easier
to understand. (I also have problems with pasting my code in the question.
I always have to edit it.)
\documentclass{article}
\usepackage{pgfplots}
\usetkzobj{all} %also needed
\begin{document}
\begin{tikzpicture}
\coordinate (M) at (0,0) ;
\coordinate (A) at (canvas polar cs:angle=90,radius=3cm) ;
\coordinate (B) at (canvas polar cs:angle=-30,radius=3cm) ;
\coordinate (C) at (canvas polar cs:angle=30,radius=3cm);
\draw[fill=red!30] (A)-- +(-60:2cm) arc (-60:-30:2cm) -- cycle;
\draw (M) circle (3cm);
\fill (M) circle (1pt) node[below left] {M};
\draw (A) -- (B);
\draw (A) -- (C);
\filldraw (A) circle(1pt) node[above] {A};
\filldraw (B) circle(1pt) node[right] {B};
\filldraw (C) circle(1pt) node[right] {C};
\draw (B) -- (C);
\draw(70:2.4cm) node {$\alpha$};
%the answer thanks to Claudio
\tkzMarkAngle[fill= orange,size=0.65cm, opacity=.4](A,C,B)
\tkzLabelAngle[pos = -0.5](A,C,B){$\gamma$}
%end answer
\end{tikzpicture}
\end{document}
How to change image of homeAsUpIndicator in default theme Theme.Holo.Light
How to change image of homeAsUpIndicator in default theme Theme.Holo.Light
In my android application,
I am using default theme Theme.Holo.Light.
Now I want to change the "<" sign which is default using this :
<item
name="homeAsUpIndicator">@android:drawable/ic_ab_back_holo_light</item>
By changing this into
<item name="homeAsUpIndicator">@drawable/ic_launcher</item>
But here sign remains as it is,It doesn't change image.I am attaching
screen shot of actionBar. Any help will be appreciated.
In my android application,
I am using default theme Theme.Holo.Light.
Now I want to change the "<" sign which is default using this :
<item
name="homeAsUpIndicator">@android:drawable/ic_ab_back_holo_light</item>
By changing this into
<item name="homeAsUpIndicator">@drawable/ic_launcher</item>
But here sign remains as it is,It doesn't change image.I am attaching
screen shot of actionBar. Any help will be appreciated.
$x^p y^q=(x+y)^{p+q}$ what is the value of $y_2$
$x^p y^q=(x+y)^{p+q}$ what is the value of $y_2$
If $x^p y^q=(x+y)^{p+q}$ then how to compute ${d^2 y}\over{dx^2}$
The result is 0
If $x^p y^q=(x+y)^{p+q}$ then how to compute ${d^2 y}\over{dx^2}$
The result is 0
Friday, 23 August 2013
Post a Video to Facebook Page from c#
Post a Video to Facebook Page from c#
Can we post link and video at once to the Facebook fan page from c# code.
I have used the below code but it is only displaying the video. I need the
link below the video.
var client = new FacebookClient(accesstoken);
var media = new FacebookMediaObject { FileName = filename, ContentType =
type };
var path = Path.Combine(Server.MapPath("posts"), filename);
file.SaveAs(path);
byte[] img = System.IO.File.ReadAllBytes(path);
media.SetValue(img);
postparameters["source"] = media;
postparameters["message"] = txtmsg.Text;
postparameters["link"] = txtlink.Text;
client.Post("/206017329553602/videos", postparameters);
Please help. Thanks, Neer.
Can we post link and video at once to the Facebook fan page from c# code.
I have used the below code but it is only displaying the video. I need the
link below the video.
var client = new FacebookClient(accesstoken);
var media = new FacebookMediaObject { FileName = filename, ContentType =
type };
var path = Path.Combine(Server.MapPath("posts"), filename);
file.SaveAs(path);
byte[] img = System.IO.File.ReadAllBytes(path);
media.SetValue(img);
postparameters["source"] = media;
postparameters["message"] = txtmsg.Text;
postparameters["link"] = txtlink.Text;
client.Post("/206017329553602/videos", postparameters);
Please help. Thanks, Neer.
I need proper sintax for re.sub
I need proper sintax for re.sub
I need to go through strings in a list "listb", replacing the character
"<" with "*".
I tried like this:
import re
for i in listb:
i = re.sub('\<','\*', 0)
But I keep getting TypeError: expected string or buffer.
Not sure what am I doing wrong and examples on the net were not much help.
I need to go through strings in a list "listb", replacing the character
"<" with "*".
I tried like this:
import re
for i in listb:
i = re.sub('\<','\*', 0)
But I keep getting TypeError: expected string or buffer.
Not sure what am I doing wrong and examples on the net were not much help.
Align TikZ node inside equation environment
Align TikZ node inside equation environment
I am trying to insert a TikZ node into an equation but I have some problems:
the = sign is not vertically centred inside the circle
the circle is not vertically aligned with the formula. I want to abtain
the same alignment of the first equation but I failed also using the
baseline option
the equal sign must be at same distance from ) as in the first equation
SOLUTIONS
UNSOLVED
Solved in comments using baseline=-\the\dimexpr\fontdimen22\textfont2\relax
UNSOLVED
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand{\mathnodebase}{%
\tikz[inner sep = 0pt,baseline]{\node[circle,draw=black] (1) {$=$};}}
\newcommand{\mathnode}{%
\tikz[inner sep = 0pt]{\node[circle,draw=black] (1) {$=$};}}
\begin{document}
\begin{equation}
\prod_{z^n=-1}(w_1(z)^n+1) =
\end{equation}
\begin{equation}
\prod_{z^n=-1}(w_1(z)^n+1) \mathnodebase
\end{equation}
\begin{equation}
\prod_{z^n=-1}(w_1(z)^n+1) \mathnode
\end{equation}
\end{document}
I am trying to insert a TikZ node into an equation but I have some problems:
the = sign is not vertically centred inside the circle
the circle is not vertically aligned with the formula. I want to abtain
the same alignment of the first equation but I failed also using the
baseline option
the equal sign must be at same distance from ) as in the first equation
SOLUTIONS
UNSOLVED
Solved in comments using baseline=-\the\dimexpr\fontdimen22\textfont2\relax
UNSOLVED
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand{\mathnodebase}{%
\tikz[inner sep = 0pt,baseline]{\node[circle,draw=black] (1) {$=$};}}
\newcommand{\mathnode}{%
\tikz[inner sep = 0pt]{\node[circle,draw=black] (1) {$=$};}}
\begin{document}
\begin{equation}
\prod_{z^n=-1}(w_1(z)^n+1) =
\end{equation}
\begin{equation}
\prod_{z^n=-1}(w_1(z)^n+1) \mathnodebase
\end{equation}
\begin{equation}
\prod_{z^n=-1}(w_1(z)^n+1) \mathnode
\end{equation}
\end{document}
How to check if an id points to a CGRect?
How to check if an id points to a CGRect?
Supposing we have:
id value = [self valueForKey:@"frame"];
BOOL valueIsCGRect = ???;
How can I decide? Should I cast id to something?
Supposing we have:
id value = [self valueForKey:@"frame"];
BOOL valueIsCGRect = ???;
How can I decide? Should I cast id to something?
URL Rewrite no Redirect if url includes "Demo"
URL Rewrite no Redirect if url includes "Demo"
We have setup our IIS to redirect all incomming traffic to site.com to use
https. But we need to make an exception if the user inputs the subdomain
demo.site.com to NOT use https.
So i guess we will need to put in some argument in our web.config to
stopProcessing the redirect if someone tries to access the subdomain
demo.site.com
We have setup our IIS to redirect all incomming traffic to site.com to use
https. But we need to make an exception if the user inputs the subdomain
demo.site.com to NOT use https.
So i guess we will need to put in some argument in our web.config to
stopProcessing the redirect if someone tries to access the subdomain
demo.site.com
Thursday, 22 August 2013
Is there a convention for precedence of operators in an additive category?
Is there a convention for precedence of operators in an additive category?
The laws for an additive category are that there must be a zero object,
binary products, that every Hom-set is an abelian group, and that the
morphism addition distributes over composition.
My question is a question about convention. If someone writes an
expression $f + g \circ h$, how should I parse this? As $(f + g) \circ h$
or as $f + (g \circ h)$?
Obviously, conventions are conventions, so if the question comes up, which
would have been used by Grothendieck or MacLane. If there is no general
agreement, that works too.
The laws for an additive category are that there must be a zero object,
binary products, that every Hom-set is an abelian group, and that the
morphism addition distributes over composition.
My question is a question about convention. If someone writes an
expression $f + g \circ h$, how should I parse this? As $(f + g) \circ h$
or as $f + (g \circ h)$?
Obviously, conventions are conventions, so if the question comes up, which
would have been used by Grothendieck or MacLane. If there is no general
agreement, that works too.
Using of static virtual generic methods
Using of static virtual generic methods
My question is: how to simple write measure classes? For example, i want
to write classes for Length, so for ex. it will be Meters and Diums. It's
clear enough that dium == 0.0254 meters, and for every instance of Dium
class it will be true. So it's clear that field LengthOfItem (returning
count of meters in one unit) should be static. But i don't know a priori
this value, so it could also be abstract/virtual. But static fields cannot
be virtual. Or can? If you think about it, classes are just instances,
inherited from Type or something like this, it mean classes are specials
singletons object, so logicaly they can inherit something too. For example
i want to write a class Human and inherit it by classes Man and Woman, so
Human has abstract bool HasTits {get;} It's clear enough that it's a
property of class, not of an instance. Okay, i can call this method. But
if i need to call it from base class, for example in the class Human i'm
writing something like this
void Foo<T>() where T: Human // T is Man or Woman
{
var t = typeof (T);
var fieldvalue = t.GetStaticProperty("HasTits");
//working with value
}
but what should i write?
Let's return to our situation. I'm writing a code like this:
using System;
using System.Linq;
using System.Runtime.CompilerServices;
namespace ConsoleApplication119
{
public abstract class Length<T> where T : Length<T>
{
public double Count { get; private set; }
protected static double LengthOfItem;
static Length()
{
RuntimeHelpers.RunClassConstructor(typeof(T).TypeHandle);
}
protected Length(double count)
{
Count = count;
}
public double Meters
{
get
{
return Count*LengthOfItem;
}
}
public Length<T> ConvertTo<T>() where T : Length<T>
{
double count = Count * LengthOfItem / Length<T>.LengthOfItem;
var constructor = typeof (T).GetConstructors().Single(info =>
info.GetParameters().Length == 1);
return (Length<T>) constructor.Invoke(new object[] {count});
}
}
class Meter : Length<Meter>
{
public Meter(double count) : base(count)
{
}
static Meter()
{
LengthOfItem = 1;
}
}
class Dium :Length<Dium>
{
public Dium(double count) : base(count)
{
}
static Dium()
{
LengthOfItem = 0.0254;
}
}
class Program
{
static void Main()
{
var meters = new Meter(5);
var diums = meters.ConvertTo<Dium>();
Console.WriteLine(diums.Count);
Console.ReadKey();
}
}
}
it works fine, but i dislike my method ConvertTo. And static constructors.
They allows to make static virtual field, but they enlarge my code and
make it ugly and complex. And it uses reflection. Imo using reflection and
crutches signify that something is bad. How can i improve it?
P.S. A little question, so little that doesn't require another topics,
let's take a look on this
public abstract class Length<T> where T : Length<T>
isn't this definition recursive, it mean T could be
Length<Length<Length<Length<...>>>> or not?
My question is: how to simple write measure classes? For example, i want
to write classes for Length, so for ex. it will be Meters and Diums. It's
clear enough that dium == 0.0254 meters, and for every instance of Dium
class it will be true. So it's clear that field LengthOfItem (returning
count of meters in one unit) should be static. But i don't know a priori
this value, so it could also be abstract/virtual. But static fields cannot
be virtual. Or can? If you think about it, classes are just instances,
inherited from Type or something like this, it mean classes are specials
singletons object, so logicaly they can inherit something too. For example
i want to write a class Human and inherit it by classes Man and Woman, so
Human has abstract bool HasTits {get;} It's clear enough that it's a
property of class, not of an instance. Okay, i can call this method. But
if i need to call it from base class, for example in the class Human i'm
writing something like this
void Foo<T>() where T: Human // T is Man or Woman
{
var t = typeof (T);
var fieldvalue = t.GetStaticProperty("HasTits");
//working with value
}
but what should i write?
Let's return to our situation. I'm writing a code like this:
using System;
using System.Linq;
using System.Runtime.CompilerServices;
namespace ConsoleApplication119
{
public abstract class Length<T> where T : Length<T>
{
public double Count { get; private set; }
protected static double LengthOfItem;
static Length()
{
RuntimeHelpers.RunClassConstructor(typeof(T).TypeHandle);
}
protected Length(double count)
{
Count = count;
}
public double Meters
{
get
{
return Count*LengthOfItem;
}
}
public Length<T> ConvertTo<T>() where T : Length<T>
{
double count = Count * LengthOfItem / Length<T>.LengthOfItem;
var constructor = typeof (T).GetConstructors().Single(info =>
info.GetParameters().Length == 1);
return (Length<T>) constructor.Invoke(new object[] {count});
}
}
class Meter : Length<Meter>
{
public Meter(double count) : base(count)
{
}
static Meter()
{
LengthOfItem = 1;
}
}
class Dium :Length<Dium>
{
public Dium(double count) : base(count)
{
}
static Dium()
{
LengthOfItem = 0.0254;
}
}
class Program
{
static void Main()
{
var meters = new Meter(5);
var diums = meters.ConvertTo<Dium>();
Console.WriteLine(diums.Count);
Console.ReadKey();
}
}
}
it works fine, but i dislike my method ConvertTo. And static constructors.
They allows to make static virtual field, but they enlarge my code and
make it ugly and complex. And it uses reflection. Imo using reflection and
crutches signify that something is bad. How can i improve it?
P.S. A little question, so little that doesn't require another topics,
let's take a look on this
public abstract class Length<T> where T : Length<T>
isn't this definition recursive, it mean T could be
Length<Length<Length<Length<...>>>> or not?
jQuery, how to capture when text input has changed as a result of another event
jQuery, how to capture when text input has changed as a result of another
event
I have a text input that is updated as a result of a button event. I would
like to detect when the value in the text input has changed. See the
example below:
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#text').bind("input change paste", function(){
console.log("text changed");
// do something
});
$('#click').click (function(){
$('#text').val('something');
});
});
</script>
<body>
<input id='text' type='text'>
<input id='click' type='button' value='click'>
</body>
Later on, that button will trigger a calender so the user select a
date/time which will update the text input. Since the calender is part of
a library we I don't want to change it. I would like to detect when the
text field gets a new value.
thanks!
event
I have a text input that is updated as a result of a button event. I would
like to detect when the value in the text input has changed. See the
example below:
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#text').bind("input change paste", function(){
console.log("text changed");
// do something
});
$('#click').click (function(){
$('#text').val('something');
});
});
</script>
<body>
<input id='text' type='text'>
<input id='click' type='button' value='click'>
</body>
Later on, that button will trigger a calender so the user select a
date/time which will update the text input. Since the calender is part of
a library we I don't want to change it. I would like to detect when the
text field gets a new value.
thanks!
Lost in ubuntu swirling for 15 characters in this title
Lost in ubuntu swirling for 15 characters in this title
Decided to make the switch from windows. Got this ubuntu OS that
'everybody' was raving about. IM LOST IN THE SAUCE!!! The software is not
new user friendly. Can someone maybe point me to a site that explains all
the simple and taken for granted tasks that I used to be able to do on
that other system?
Simple stuff like updates, Where to install new fonts (cause ubuntu fonts
are VERY limited), How the hell do I get a simple media player hat actual
works and plays mp3,4,mpegs, avi, wmv.
And why was the video guide that came loaded on the software so limited?
How to write, how to make a spread sheet, how to do a power point...if you
want to know anything else- yeah well tuff cookies.
Im frustrated, not mad(yet), glad to be away from MS's reign on the
universe.... now i just want to be able to use it.
Thanks, Den
Decided to make the switch from windows. Got this ubuntu OS that
'everybody' was raving about. IM LOST IN THE SAUCE!!! The software is not
new user friendly. Can someone maybe point me to a site that explains all
the simple and taken for granted tasks that I used to be able to do on
that other system?
Simple stuff like updates, Where to install new fonts (cause ubuntu fonts
are VERY limited), How the hell do I get a simple media player hat actual
works and plays mp3,4,mpegs, avi, wmv.
And why was the video guide that came loaded on the software so limited?
How to write, how to make a spread sheet, how to do a power point...if you
want to know anything else- yeah well tuff cookies.
Im frustrated, not mad(yet), glad to be away from MS's reign on the
universe.... now i just want to be able to use it.
Thanks, Den
T-SQL Merging Rows if ID is same and retaining unique information for each row
T-SQL Merging Rows if ID is same and retaining unique information for each
row
I have a table that pulls the name and addresses of individuals and
organizations. Sometimes in this table a individual will have 2 addresses
and thus come back twice. Other times they could only have one address.
AccountNum Name Contact AddressLine1 City County
State Zip AddrType IndivOrBuss
321 Dilbert Law Mr.Dilbert 123 Merrwood Pittsburgh NULL
PA 15212 Home Business
321 Dilbert Law Mr.Dilbert 321 Dogbert Dr. Pittsburgh NULL
PA 15212 Bussiness Business
I have to take this table and make it so that it fits in another table
while the keeping both addresses and having only one row per AccountNum.
The rows will need to be merged to show both addresses and unique fields.
It should look something like this:
AccountNum Name Contact AddressLine1 City
County State Zip AddrType IndivOrBuss Address2Line1
2ndCity 2ndCounty 2ndState 2ndZip 2ndAddrTyp
321 Dilbert Law Mr.Dilbert 123 Merrwood Pittsburgh NULL
PA 15212 Home Business 321 Dogbert Dr.
Pittsburgh NULL PA 15212 Bussiness
I'm unsure as to how to approach the merge while retaining those that
don't need to be merged.
I've already pulled the ones that need merged by using
FROM Address WHERE Address.[AccountNum] IN
(Select Address.[AccountNum]
From Address
Group by Address.[AccountNum]
having count(*)>1);
Which I'm sure is not the best way to do to find the duplicates for a
merging back into the other row. I'd appreciate any ideas.
row
I have a table that pulls the name and addresses of individuals and
organizations. Sometimes in this table a individual will have 2 addresses
and thus come back twice. Other times they could only have one address.
AccountNum Name Contact AddressLine1 City County
State Zip AddrType IndivOrBuss
321 Dilbert Law Mr.Dilbert 123 Merrwood Pittsburgh NULL
PA 15212 Home Business
321 Dilbert Law Mr.Dilbert 321 Dogbert Dr. Pittsburgh NULL
PA 15212 Bussiness Business
I have to take this table and make it so that it fits in another table
while the keeping both addresses and having only one row per AccountNum.
The rows will need to be merged to show both addresses and unique fields.
It should look something like this:
AccountNum Name Contact AddressLine1 City
County State Zip AddrType IndivOrBuss Address2Line1
2ndCity 2ndCounty 2ndState 2ndZip 2ndAddrTyp
321 Dilbert Law Mr.Dilbert 123 Merrwood Pittsburgh NULL
PA 15212 Home Business 321 Dogbert Dr.
Pittsburgh NULL PA 15212 Bussiness
I'm unsure as to how to approach the merge while retaining those that
don't need to be merged.
I've already pulled the ones that need merged by using
FROM Address WHERE Address.[AccountNum] IN
(Select Address.[AccountNum]
From Address
Group by Address.[AccountNum]
having count(*)>1);
Which I'm sure is not the best way to do to find the duplicates for a
merging back into the other row. I'd appreciate any ideas.
URL redirection with htaccess and categorizing them
URL redirection with htaccess and categorizing them
Im having little knowledge on htaccess files and its usage,Im using linux
server with apache on PHP but in my current project I have 4 types of urls
1) domain.com/display.php?content=page&id=2
2) domain.com/display.php?content=category&id=2
3) domain.com/display.php?content=album&id=2
4) domain.com/display.php?content=image&id=2
now i want the same kind of URL for all these 4 like "domain.com/id" so my
plan is to pass like
1) domain.com/display.php?content=page&id=2 => domain.com/2-p
2) domain.com/display.php?content=category&id=2 => domain.com/2-c
3) domain.com/display.php?content=album&id=2 => domain.com/2-a
4) domain.com/display.php?content=image&id=2 => domain.com/2-i
so based on the parameter on last(p/c/a/i) i need to differentiate the
content in htaccess, so can some one assist me how to achieve this?
Im having little knowledge on htaccess files and its usage,Im using linux
server with apache on PHP but in my current project I have 4 types of urls
1) domain.com/display.php?content=page&id=2
2) domain.com/display.php?content=category&id=2
3) domain.com/display.php?content=album&id=2
4) domain.com/display.php?content=image&id=2
now i want the same kind of URL for all these 4 like "domain.com/id" so my
plan is to pass like
1) domain.com/display.php?content=page&id=2 => domain.com/2-p
2) domain.com/display.php?content=category&id=2 => domain.com/2-c
3) domain.com/display.php?content=album&id=2 => domain.com/2-a
4) domain.com/display.php?content=image&id=2 => domain.com/2-i
so based on the parameter on last(p/c/a/i) i need to differentiate the
content in htaccess, so can some one assist me how to achieve this?
Wednesday, 21 August 2013
send a wechat video from an official account
send a wechat video from an official account
I have been told that, in China, it is not possible to send a video from
an official WeChat account to all followers, only text and pictures. Is
this true ?
If not, how can I do it ? it is via a link or an embed video ?
Thank you in advance for your answer
I have been told that, in China, it is not possible to send a video from
an official WeChat account to all followers, only text and pictures. Is
this true ?
If not, how can I do it ? it is via a link or an embed video ?
Thank you in advance for your answer
Custom URL in Rails
Custom URL in Rails
Say my default route in rails is
/states/new-york/cities/new-york-city
What's the best way to customize this route to display as
/new-york/new-york-city
Thanks in advance, any tips/advice is much appreciated
Say my default route in rails is
/states/new-york/cities/new-york-city
What's the best way to customize this route to display as
/new-york/new-york-city
Thanks in advance, any tips/advice is much appreciated
how to fix my php error?
how to fix my php error?
I have created a HTML and a php file that are connected: The data in the
html form must be sent to my email address.
I have uploaded the html file with the php script to my directory on
000webhost.com
when I test the form, and when I want to submit the form, 000webhost tells
me that there is an error in the line 6 of my php script.
Can anybody please help me to find the error and fix it?
MY HTML FILE: .inputtext { width: 300px; height:30px; }
<!--
.button {
display:block;
font-weight:bold;
font-size:18px;
font-family:Calibri;
color:#009933;
background-color:#ffffff;
width:150px;
text-align:center;
padding:4px;
border-top: 1px solid #b2b2b2;
border-bottom: 1px solid #b2b2b2;
border-left: 1px solid #b2b2b2;
border-right: 1px solid #b2b2b2;
}
-->
</style></head>
<form action="mail.php" method="POST">
<div align=center>
<Table border=0><tr><td>
<table border=0>
<tr>
<td valign=top><h3><font face=calibri color=#009933>Name<font face=calibri
color=red>*</font></h3></td>
<td valign=top><input type="text" name="name" class=inputtext></td>
</tr>
<tr>
<td valign=top><font face=calibri color=#009933><h3>Email address<font
face=calibri color=red>*</font></h3></td>
<td valign=top><input type="text" name="email"class=inputtext></td>
</tr>
<tr>
<td valign=top><font face=calibri color=#009933><h3>Select your
gender<font face=calibri color=red>*</font></h3></font></td>
<td valign=top><font face=calibri><input type="radio" name="gender"
value="Male"> Male       <input type=radio
name=gender value=Female> Female</font></td>
</tr>
<tr>
<td valign=top><font face=calibri color=#009933><h3>Select your age<font
face=calibri color=red>*</font></h3></font></td>
<td valign=top><select name="age" size=1>
<option value=Below 18>Below 18</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
<option value=32>32</option>
<option value=33>33</option>
<option value=34>34</option>
<option value=35>35</option>
<option value=36>36</option>
<option value=37>37</option>
<option value=38>38</option>
<option value=39>39</option>
<option value=40>40</option>
<option value=41>41</option>
<option value=42>42</option>
<option value=43>43</option>
<option value=44>44</option>
<option value=45>45</option>
<option value=46>46</option>
<option value=47>47</option>
<option value=48>48</option>
<option value=49>49</option>
<option value=50>50</option>
<option value=51>51</option>
<option value=52>52</option>
<option value=53>53</option>
<option value=54>54</option>
<option value=55>55</option>
<option value=56>56</option>
<option value=57>57</option>
<option value=58>58</option>
<option value=59>59</option>
<option value=60>60</option>
<option value=61>61</option>
<option value=62>62</option>
<option value=63>63</option>
<option value=64>64</option>
<option value=65>65</option>
<option value=66>66</option>
<option value=67>67</option>
<option value=68>68</option>
<option value=69>69</option>
<option value=70>70</option>
<option value=71>71</option>
<option value=72>72</option>
<option value=73>73</option>
<option value=74>74</option>
<option value=75>75</option>
<option value=76>76</option>
<option value=77>77</option>
<option value=78>78</option>
<option value=79>79</option>
<option value=80>80</option>
<option value=81>81</option>
<option value=82>82</option>
<option value=83>83</option>
<option value=84>84</option>
<option value=85>85</option>
<option value=86>86</option>
<option value=87>87</option>
<option value=88>88</option>
<option value=89>89</option>
<option value=90>90</option>
<option value=91>91</option>
<option value=92>92</option>
<option value=93>93</option>
<option value=94>94</option>
<option value=95>95</option>
<option value=96>96</option>
<option value=97>97</option>
<option value=98>98</option>
<option value=99>99</option>
</select></td>
</tr>
</table>
<br><br>
<table border=0>
<tr><td valign=top>
<font face=calibri color=#009933><h3>1) From where did you hear about
Angrybullet2 ?</h3></font>
<font face=calibri color=black><input type=radio name=hear-about
value=Search engines (google, yahoo, bing)> Search engines (google, yahoo,
bing, … )<br>
<input type=radio name=hear-about value=From a friend> From a friend<br>
<input type=radio name=hear-about value=From YouTube> From YouTube<br>
<input type=radio name=hear-about value=Other:> Other</font>
<br><br>
<font face=calibri color=#009933><h3>2) Are you subscribed to Angrybullet2
?</h3></font>
<font face=calibri color=black>
<input type=radio name=sub-or-not value=Yes> Yes, I am<br>
<input type=radio name=sub-or-not value=No, but I wish to subscribe>
No, but I wish to subscribe<br>
<input type=radio name=sub-or-not value=No, I am not, and I won't
subscribe> No, I am not, and I won't subscribe<br>
<input type=radio name=sub-or-not value=No account> I don't have a
YouTube account</font>
<br><br>
<font face=calibri color=#009933><h3>3) How many videos of Angrybullet2
did you watch ?</h3></font>
<font face=calibri color=black><input type=radio name=n videos watched
value=None> None<br>
<input type=radio name=n-vids-watched
value=1-2> 1-2<br>
<input type=radio name=n-vids-watched
value=3-4> 3-4<br>
<input type=radio name=n-vids-watched
value=5-9> 5-9<br>
<input type=radio name=n-vids-watched
value=10 and more> 10 and more</font>
<br><br>
<font face=calibri color=#009933><h3>4) Did you enjoy watching videos from
Angrybullet2 ?</h3></font>
<font face=calibri color=black>
<input type=radio name=enjoy-or-not value=Yes, I did>
Yes, I did<br>
<input type=radio name=enjoy-or-not value=No, I
didn't> No, I didn't<br>
<input type=radio name=enjoy-or-not value=I watched
none of your videos> I watched none of your
videos</font>
<br><br>
<font face=calibri color=#009933><h3>5) What was the type of the video(s)
you watched ?</h3></font>
<font face=calibri color=black>
<input type=checkbox name=vid-type value=Tutorial(s)>
Tutorial(s) (how to)<br>
<input type=checkbox name=vid-type value=Sound
effect(s)> Sound effect(s)<br>
<input type=checkbox name=vid-type
value=Experiment(s)> Experiment(s)<br>
<input type=checkbox name=vid-type value=I watched
none of your videos> I watched none of your
videos</font>
<br><br>
<font face=calibri color=#009933><h3>6) Do you have any suggestion in
order to make Angrybullet2 better ?</h3></font>
<textarea rows="10" cols="75"
name="suggestions"></textarea></td></tr></table>
<table border=0><tr><td valign=top>
<input type="submit" value="Submit survey" class=button></td><td><input
type="reset" value="Reset survey fields" class=button></td></tr></table>
</td></tr></Table>
</form>
</div>
</html>
MY PHP SCRIPT:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$gender = $_POST['gender'];
$age = $_POST['age'];
$hear about = $_POST['hear-about'];
$sub-or-not = $_POST['sub-or-not'];
$n-vids-watched = $_POST['n-vids-watched'];
$enjoy-or-not = $_POST['enjoy-or-not'];
$vid-type = $_POST['vid-type'];
$suggestions = $_POST['suggestions'];
$formcontent=" Name: $name \n Email: $email \n Gender: $gender \n Age:
$age \n Hear-about: $hear-about \n Sub-or-not: $sub-or-not \n
N-vids-watched: $n-vids-watched \n Enjoy-or-not: $enjoy-or-not \n
Vid-type: $vid-type \n Suggestions: $suggestions";
$recipient = "angrybullet2@gmail.com";
$subject = "Survey response";
$mailheader = "From: $name \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!"<a href=http://google.com>go to google</a>;
?>
I have created a HTML and a php file that are connected: The data in the
html form must be sent to my email address.
I have uploaded the html file with the php script to my directory on
000webhost.com
when I test the form, and when I want to submit the form, 000webhost tells
me that there is an error in the line 6 of my php script.
Can anybody please help me to find the error and fix it?
MY HTML FILE: .inputtext { width: 300px; height:30px; }
<!--
.button {
display:block;
font-weight:bold;
font-size:18px;
font-family:Calibri;
color:#009933;
background-color:#ffffff;
width:150px;
text-align:center;
padding:4px;
border-top: 1px solid #b2b2b2;
border-bottom: 1px solid #b2b2b2;
border-left: 1px solid #b2b2b2;
border-right: 1px solid #b2b2b2;
}
-->
</style></head>
<form action="mail.php" method="POST">
<div align=center>
<Table border=0><tr><td>
<table border=0>
<tr>
<td valign=top><h3><font face=calibri color=#009933>Name<font face=calibri
color=red>*</font></h3></td>
<td valign=top><input type="text" name="name" class=inputtext></td>
</tr>
<tr>
<td valign=top><font face=calibri color=#009933><h3>Email address<font
face=calibri color=red>*</font></h3></td>
<td valign=top><input type="text" name="email"class=inputtext></td>
</tr>
<tr>
<td valign=top><font face=calibri color=#009933><h3>Select your
gender<font face=calibri color=red>*</font></h3></font></td>
<td valign=top><font face=calibri><input type="radio" name="gender"
value="Male"> Male       <input type=radio
name=gender value=Female> Female</font></td>
</tr>
<tr>
<td valign=top><font face=calibri color=#009933><h3>Select your age<font
face=calibri color=red>*</font></h3></font></td>
<td valign=top><select name="age" size=1>
<option value=Below 18>Below 18</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
<option value=32>32</option>
<option value=33>33</option>
<option value=34>34</option>
<option value=35>35</option>
<option value=36>36</option>
<option value=37>37</option>
<option value=38>38</option>
<option value=39>39</option>
<option value=40>40</option>
<option value=41>41</option>
<option value=42>42</option>
<option value=43>43</option>
<option value=44>44</option>
<option value=45>45</option>
<option value=46>46</option>
<option value=47>47</option>
<option value=48>48</option>
<option value=49>49</option>
<option value=50>50</option>
<option value=51>51</option>
<option value=52>52</option>
<option value=53>53</option>
<option value=54>54</option>
<option value=55>55</option>
<option value=56>56</option>
<option value=57>57</option>
<option value=58>58</option>
<option value=59>59</option>
<option value=60>60</option>
<option value=61>61</option>
<option value=62>62</option>
<option value=63>63</option>
<option value=64>64</option>
<option value=65>65</option>
<option value=66>66</option>
<option value=67>67</option>
<option value=68>68</option>
<option value=69>69</option>
<option value=70>70</option>
<option value=71>71</option>
<option value=72>72</option>
<option value=73>73</option>
<option value=74>74</option>
<option value=75>75</option>
<option value=76>76</option>
<option value=77>77</option>
<option value=78>78</option>
<option value=79>79</option>
<option value=80>80</option>
<option value=81>81</option>
<option value=82>82</option>
<option value=83>83</option>
<option value=84>84</option>
<option value=85>85</option>
<option value=86>86</option>
<option value=87>87</option>
<option value=88>88</option>
<option value=89>89</option>
<option value=90>90</option>
<option value=91>91</option>
<option value=92>92</option>
<option value=93>93</option>
<option value=94>94</option>
<option value=95>95</option>
<option value=96>96</option>
<option value=97>97</option>
<option value=98>98</option>
<option value=99>99</option>
</select></td>
</tr>
</table>
<br><br>
<table border=0>
<tr><td valign=top>
<font face=calibri color=#009933><h3>1) From where did you hear about
Angrybullet2 ?</h3></font>
<font face=calibri color=black><input type=radio name=hear-about
value=Search engines (google, yahoo, bing)> Search engines (google, yahoo,
bing, … )<br>
<input type=radio name=hear-about value=From a friend> From a friend<br>
<input type=radio name=hear-about value=From YouTube> From YouTube<br>
<input type=radio name=hear-about value=Other:> Other</font>
<br><br>
<font face=calibri color=#009933><h3>2) Are you subscribed to Angrybullet2
?</h3></font>
<font face=calibri color=black>
<input type=radio name=sub-or-not value=Yes> Yes, I am<br>
<input type=radio name=sub-or-not value=No, but I wish to subscribe>
No, but I wish to subscribe<br>
<input type=radio name=sub-or-not value=No, I am not, and I won't
subscribe> No, I am not, and I won't subscribe<br>
<input type=radio name=sub-or-not value=No account> I don't have a
YouTube account</font>
<br><br>
<font face=calibri color=#009933><h3>3) How many videos of Angrybullet2
did you watch ?</h3></font>
<font face=calibri color=black><input type=radio name=n videos watched
value=None> None<br>
<input type=radio name=n-vids-watched
value=1-2> 1-2<br>
<input type=radio name=n-vids-watched
value=3-4> 3-4<br>
<input type=radio name=n-vids-watched
value=5-9> 5-9<br>
<input type=radio name=n-vids-watched
value=10 and more> 10 and more</font>
<br><br>
<font face=calibri color=#009933><h3>4) Did you enjoy watching videos from
Angrybullet2 ?</h3></font>
<font face=calibri color=black>
<input type=radio name=enjoy-or-not value=Yes, I did>
Yes, I did<br>
<input type=radio name=enjoy-or-not value=No, I
didn't> No, I didn't<br>
<input type=radio name=enjoy-or-not value=I watched
none of your videos> I watched none of your
videos</font>
<br><br>
<font face=calibri color=#009933><h3>5) What was the type of the video(s)
you watched ?</h3></font>
<font face=calibri color=black>
<input type=checkbox name=vid-type value=Tutorial(s)>
Tutorial(s) (how to)<br>
<input type=checkbox name=vid-type value=Sound
effect(s)> Sound effect(s)<br>
<input type=checkbox name=vid-type
value=Experiment(s)> Experiment(s)<br>
<input type=checkbox name=vid-type value=I watched
none of your videos> I watched none of your
videos</font>
<br><br>
<font face=calibri color=#009933><h3>6) Do you have any suggestion in
order to make Angrybullet2 better ?</h3></font>
<textarea rows="10" cols="75"
name="suggestions"></textarea></td></tr></table>
<table border=0><tr><td valign=top>
<input type="submit" value="Submit survey" class=button></td><td><input
type="reset" value="Reset survey fields" class=button></td></tr></table>
</td></tr></Table>
</form>
</div>
</html>
MY PHP SCRIPT:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$gender = $_POST['gender'];
$age = $_POST['age'];
$hear about = $_POST['hear-about'];
$sub-or-not = $_POST['sub-or-not'];
$n-vids-watched = $_POST['n-vids-watched'];
$enjoy-or-not = $_POST['enjoy-or-not'];
$vid-type = $_POST['vid-type'];
$suggestions = $_POST['suggestions'];
$formcontent=" Name: $name \n Email: $email \n Gender: $gender \n Age:
$age \n Hear-about: $hear-about \n Sub-or-not: $sub-or-not \n
N-vids-watched: $n-vids-watched \n Enjoy-or-not: $enjoy-or-not \n
Vid-type: $vid-type \n Suggestions: $suggestions";
$recipient = "angrybullet2@gmail.com";
$subject = "Survey response";
$mailheader = "From: $name \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!"<a href=http://google.com>go to google</a>;
?>
Receiver () has no segue with identifier 'test''.......and more
Receiver () has no segue with identifier 'test''.......and more
I know the title of my issue is similar to others, but I have looked at
almost every other topic on this and nothing fixes my issue. Allow me to
explain:
I have this happening when I click a button (in my class ViewController.m):
MyQueryTableController *myController = [[MyQueryTableController alloc] init];
[self.navigationController pushViewController:myController animated:YES];
Now when I want to go to a different view from MyQueryTableController by
clicking on a table cell I have this:
[self performSegueWithIdentifier:@"test" sender:self];
which brings us to this error: 'Receiver () has no segue with identifier
'test''
I'm guessing this means that the myController is not on the storyboard or
something, so it doesn't recognize the segue.
To fix this, I tried declaring myController like this:
MyQueryTableController *myController = [self.storyboard
instantiateViewControllerWithIdentifier:@"table"];
and pushing it the same way:
[self.navigationController pushViewController:myController animated:YES];
When I do this, I get this error: 'NSInternalInconsistencyException',
reason: '-[UITableViewController loadView] loaded the
"wOE-Bf-310-view-jaT-Nk-xnR" nib but didn't get a UITableView.'
MyQueryTableController is a subclass of PFQueryTableViewController, which
I believe is a subclass of UITableViewController. I'm using Parse for my
backend.
Sorry if this is all confusing, but does anyone think they could make some
sense out of this?
Thanks
I know the title of my issue is similar to others, but I have looked at
almost every other topic on this and nothing fixes my issue. Allow me to
explain:
I have this happening when I click a button (in my class ViewController.m):
MyQueryTableController *myController = [[MyQueryTableController alloc] init];
[self.navigationController pushViewController:myController animated:YES];
Now when I want to go to a different view from MyQueryTableController by
clicking on a table cell I have this:
[self performSegueWithIdentifier:@"test" sender:self];
which brings us to this error: 'Receiver () has no segue with identifier
'test''
I'm guessing this means that the myController is not on the storyboard or
something, so it doesn't recognize the segue.
To fix this, I tried declaring myController like this:
MyQueryTableController *myController = [self.storyboard
instantiateViewControllerWithIdentifier:@"table"];
and pushing it the same way:
[self.navigationController pushViewController:myController animated:YES];
When I do this, I get this error: 'NSInternalInconsistencyException',
reason: '-[UITableViewController loadView] loaded the
"wOE-Bf-310-view-jaT-Nk-xnR" nib but didn't get a UITableView.'
MyQueryTableController is a subclass of PFQueryTableViewController, which
I believe is a subclass of UITableViewController. I'm using Parse for my
backend.
Sorry if this is all confusing, but does anyone think they could make some
sense out of this?
Thanks
Need a way to transform the twitter's bootstrap tabs into an accordion on smaller screens
Need a way to transform the twitter's bootstrap tabs into an accordion on
smaller screens
Are there any bootstrap compatible plugins solution available or do I have
to go with some other tab plugin and adapt it to bootstrap?
Thanks
smaller screens
Are there any bootstrap compatible plugins solution available or do I have
to go with some other tab plugin and adapt it to bootstrap?
Thanks
Generic interface implementing multiple generic types - how to share a method implementation?
Generic interface implementing multiple generic types - how to share a
method implementation?
Let's say I have the following interface
public interface IFilter<T>
{
IEnumerable<T> ApplyFilter(IEnumerable<T> list);
}
And a specific implementation like this:
public class PetFilter: IFilter<Dog>, IFilter<Cat>
{
public IEnumerable<Dog> ApplyFilter(IEnumerable<Dog> list)
{
return ApplyFilter<Dog>(list);
}
public IEnumerable<Cat> ApplyFilter(IEnumerable<Cat> list)
{
return ApplyFilter<Dog>(list);
}
private IEnumerable<T> ApplyFilter<T>(IEnumerable<T> list)
{
// do the work here
}
}
Is there any way to avoid having to implement separate methods for both
Dog and Cat, given that they share the same implementation?
method implementation?
Let's say I have the following interface
public interface IFilter<T>
{
IEnumerable<T> ApplyFilter(IEnumerable<T> list);
}
And a specific implementation like this:
public class PetFilter: IFilter<Dog>, IFilter<Cat>
{
public IEnumerable<Dog> ApplyFilter(IEnumerable<Dog> list)
{
return ApplyFilter<Dog>(list);
}
public IEnumerable<Cat> ApplyFilter(IEnumerable<Cat> list)
{
return ApplyFilter<Dog>(list);
}
private IEnumerable<T> ApplyFilter<T>(IEnumerable<T> list)
{
// do the work here
}
}
Is there any way to avoid having to implement separate methods for both
Dog and Cat, given that they share the same implementation?
Tuesday, 20 August 2013
css showing text in a straigt column without using table
css showing text in a straigt column without using table
pIts very simple thing but i am stucked on it. I have text that is
generated dyanamically i want to show it like below without using table /p
precodetext1abc re:text1 tex2 re:abc testsfsdf re:ddd /code/pre pi want to
show column 2 at fixed length from column 1 and both column 1 and column 2
are generated like/p precodelt;divgt;text1abclt;/divgt; lt;div
style=margin-left:20pxgt;re:text1lt;/divgt; lt;divgt;tex2lt;/divgt; lt;div
style=margin-left:20pxgt;re:abclt;/divgt; lt;divgt;testsfsdflt;/divgt;
lt;div style=margin-left:20pxgt;re:dddlt;/divgt; /code/pre pbut this
margin left style does not work it shows like/p precodetext1abc re:text1
tex2 re:abc testsfsdfs re:ddd /code/pre
pIts very simple thing but i am stucked on it. I have text that is
generated dyanamically i want to show it like below without using table /p
precodetext1abc re:text1 tex2 re:abc testsfsdf re:ddd /code/pre pi want to
show column 2 at fixed length from column 1 and both column 1 and column 2
are generated like/p precodelt;divgt;text1abclt;/divgt; lt;div
style=margin-left:20pxgt;re:text1lt;/divgt; lt;divgt;tex2lt;/divgt; lt;div
style=margin-left:20pxgt;re:abclt;/divgt; lt;divgt;testsfsdflt;/divgt;
lt;div style=margin-left:20pxgt;re:dddlt;/divgt; /code/pre pbut this
margin left style does not work it shows like/p precodetext1abc re:text1
tex2 re:abc testsfsdfs re:ddd /code/pre
Proof that a set of functions are independent
Proof that a set of functions are independent
The problem is an outline of a proof by induction for the following. Give
$r_1,\dots,r_n$ distinct real numbers, $Q_1,\dots,Q_n$ be $n$ polynomials,
none of which is the zero polynomial, prove that
$Q_1e^{r_1x},\dots,Q_ne^{r_nx}$ are independent. So the problem asks that
you do this by, knowing that it is true for $n=1$,$n=2$, assuming the
statement true for $n=p$, and then proving $\sum_{k=1}^{p+1}
c_kQ_k(x)e^{r_kx} = 0$ by multiplying the sum by $e^{-r_{p+1}x}$ and then
differentiating, then using the inductive hypothesis to show all $c_k=0$.
When I differentiate the sum I get: $$
\sum_{k=1}^{p+1}\frac{d}{dx}c_kQ_k(x)e^{(r_k-r_{p+1})x} =
\left(\sum_{k=1}^p
c_ke^{(r_k-r_{p+1})x}((r_k-r_{p+1})Q_k(x)+Q'_k(x))\right)+c_{p+1}Q'_{p+1}(x)
= 0 $$ and I'm not sure how to bring the inductive hypothesis into play.
The problem is an outline of a proof by induction for the following. Give
$r_1,\dots,r_n$ distinct real numbers, $Q_1,\dots,Q_n$ be $n$ polynomials,
none of which is the zero polynomial, prove that
$Q_1e^{r_1x},\dots,Q_ne^{r_nx}$ are independent. So the problem asks that
you do this by, knowing that it is true for $n=1$,$n=2$, assuming the
statement true for $n=p$, and then proving $\sum_{k=1}^{p+1}
c_kQ_k(x)e^{r_kx} = 0$ by multiplying the sum by $e^{-r_{p+1}x}$ and then
differentiating, then using the inductive hypothesis to show all $c_k=0$.
When I differentiate the sum I get: $$
\sum_{k=1}^{p+1}\frac{d}{dx}c_kQ_k(x)e^{(r_k-r_{p+1})x} =
\left(\sum_{k=1}^p
c_ke^{(r_k-r_{p+1})x}((r_k-r_{p+1})Q_k(x)+Q'_k(x))\right)+c_{p+1}Q'_{p+1}(x)
= 0 $$ and I'm not sure how to bring the inductive hypothesis into play.
How to Include or Autoload Class Files in Solarium for SOLR
How to Include or Autoload Class Files in Solarium for SOLR
I'm Trying to include or autoload Solarium for SOLR in PHP and I keep
getting errors. I know I'm doing it incorrectly but I'm new to
autoloading. I have the extension installed for php and that works. Here
is the error I receive:
Fatal error: Class 'Solarium\Client' not found in /Users/...
Here is my php file with code I'm testing—I realize that there is no
autoloading setup in my example, I'm new to autoloading confused at how to
use it:
<?php
require(__DIR__.'/init.php');
// check solarium version available
echo 'Solarium library version: ' . Solarium\Client::VERSION . ' - ';
I'm Trying to include or autoload Solarium for SOLR in PHP and I keep
getting errors. I know I'm doing it incorrectly but I'm new to
autoloading. I have the extension installed for php and that works. Here
is the error I receive:
Fatal error: Class 'Solarium\Client' not found in /Users/...
Here is my php file with code I'm testing—I realize that there is no
autoloading setup in my example, I'm new to autoloading confused at how to
use it:
<?php
require(__DIR__.'/init.php');
// check solarium version available
echo 'Solarium library version: ' . Solarium\Client::VERSION . ' - ';
vb Cannot run program on another computer
vb Cannot run program on another computer
I have made a program using visual basic 2010, which contains a database.
When I copy my program across to another computer and attempt to debug it,
I get the following error message:
An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred in System.Data.dll
Additional information: Login failed for user 'Aaron\Aaron'.
And the following line of code is highlighted within the form load sub:
Me.Table1TableAdapter.Fill(Me.Database1DataSet1.Table1)
When I publish the program it also fails to run on any computer other than
the one I created it on.
Any help would be much appreciated as I'm still very new to programming,
thank you.
I have made a program using visual basic 2010, which contains a database.
When I copy my program across to another computer and attempt to debug it,
I get the following error message:
An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred in System.Data.dll
Additional information: Login failed for user 'Aaron\Aaron'.
And the following line of code is highlighted within the form load sub:
Me.Table1TableAdapter.Fill(Me.Database1DataSet1.Table1)
When I publish the program it also fails to run on any computer other than
the one I created it on.
Any help would be much appreciated as I'm still very new to programming,
thank you.
RedHat 5 - pstack and gdb
RedHat 5 - pstack and gdb
I'm chasing a weird bug and I have a clue, but I don't know what it means.
I have a program that uses OpenGL and Motif running on RH5 workstations.
On two machines, the program takes 5 minutes or so to come up, when on all
the other machines (five of them), it comes up immediately. All seven
machines are loaded the same and have the same hardware.
So here's my clue. If I run the process on either of the two "slow"
machines under gdb, or do a pstack while it is hung, it comes up right
away. I know this must be telling me something important, but I cannot
figure out what.
Any ideas?
I'm chasing a weird bug and I have a clue, but I don't know what it means.
I have a program that uses OpenGL and Motif running on RH5 workstations.
On two machines, the program takes 5 minutes or so to come up, when on all
the other machines (five of them), it comes up immediately. All seven
machines are loaded the same and have the same hardware.
So here's my clue. If I run the process on either of the two "slow"
machines under gdb, or do a pstack while it is hung, it comes up right
away. I know this must be telling me something important, but I cannot
figure out what.
Any ideas?
AvalonEditor SearchPanel
AvalonEditor SearchPanel
I use avalonEdit:TextEditor to show XML-Files and want to add the
Search-Function using ICSharpCode.AvalonEdit.Search.SearchPanel:
SearchPanel sp = new SearchPanel();
sp.Attach(textEditor.TextArea);
sp.Open();
It works well, but the text box in the panel does not have focus. The
method "Reactivate" doesn't work either. Can anyone tell me how to set the
focus on the text box in SearchPanel? Thank you!
I use avalonEdit:TextEditor to show XML-Files and want to add the
Search-Function using ICSharpCode.AvalonEdit.Search.SearchPanel:
SearchPanel sp = new SearchPanel();
sp.Attach(textEditor.TextArea);
sp.Open();
It works well, but the text box in the panel does not have focus. The
method "Reactivate" doesn't work either. Can anyone tell me how to set the
focus on the text box in SearchPanel? Thank you!
c# - Reading double from file , Precision issue
c# - Reading double from file , Precision issue
I have to read a tab-delimited file, where each row contains both strings
and doubles.
string line = reader.ReadLine();
string[] elements = line.Split('\t');
My problem is that all doubles read from the file are converted to a lower
precision. For example: 0.34704774 is stored as 0.35 in the string array
elements.
How can I read and store all the values as they are written in the file?
I have to read a tab-delimited file, where each row contains both strings
and doubles.
string line = reader.ReadLine();
string[] elements = line.Split('\t');
My problem is that all doubles read from the file are converted to a lower
precision. For example: 0.34704774 is stored as 0.35 in the string array
elements.
How can I read and store all the values as they are written in the file?
Monday, 19 August 2013
Is timer instance can be reused in java?
Is timer instance can be reused in java?
In the following code is it possible to reuse the same timer1 object again
instead of timer2 for invoking timertask?
Timer timer1 = new Timer();
timer1.scheduleAtFixedRate(new TimerTask() {
int counter = 0;
@Override
public void run() {
PriorityQueueHandler.getQueueInstance().addToQueue(passengers.get(counter));
counter++;
if(counter == passengers.size()){
counter = 0;
}
}
}, DELAY, ARRIVAL_INTERVAL);
PriorityQueueHandler.getQueueInstance().print();
Timer timer2 = new Timer();
timer2.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
PriorityQueueHandler.getQueueInstance().print();
}
}, DELAY, BOOKING_INTERVAL);
In the following code is it possible to reuse the same timer1 object again
instead of timer2 for invoking timertask?
Timer timer1 = new Timer();
timer1.scheduleAtFixedRate(new TimerTask() {
int counter = 0;
@Override
public void run() {
PriorityQueueHandler.getQueueInstance().addToQueue(passengers.get(counter));
counter++;
if(counter == passengers.size()){
counter = 0;
}
}
}, DELAY, ARRIVAL_INTERVAL);
PriorityQueueHandler.getQueueInstance().print();
Timer timer2 = new Timer();
timer2.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
PriorityQueueHandler.getQueueInstance().print();
}
}, DELAY, BOOKING_INTERVAL);
Why is this one says undefined?
Why is this one says undefined?
<section id="clickme">
<p>Stuff goes here.</p>
</section>
$("#clickme").on("click", function(){
alert(this.innerHTML);
setTimeout(function(){
alert(this.innerHTML);
}, 1000);
})
Does anyone know why the second alert is undefined?
<section id="clickme">
<p>Stuff goes here.</p>
</section>
$("#clickme").on("click", function(){
alert(this.innerHTML);
setTimeout(function(){
alert(this.innerHTML);
}, 1000);
})
Does anyone know why the second alert is undefined?
Dismissing alerts created using an event
Dismissing alerts created using an event
I am trying to learn jquery and bootstrap. I have two kinds of alerts: 1.
Alert upon page load 2. Alert based on action (button click) in the simple
example.
Pressing 'x' on the alert created by page load clears it. The same does
not happen with the one loaded by the button. Am I missing something in my
script?
<div class="container">
<div class="row">
<div class="span12">
<div id="alert-section" class="alert alert-success">
<button type="button" class="close"
data-dismiss="alert">×</button>
<h4>Page load alert!</h4>
This alert is displayed when page loads.
</div>
<button type="button" id="btn-alert" href="#">Open my
alert</button>
<div id="le-alert"></div>
</div>
</div>
</div>
$('#btn-alert').click(function () {
$('#le-alert').addClass('alert in');
$('#le-alert').append('<button type="button" class="close"
data-dismiss="alert">×</button><h4>Alert title</h4><p>This
alert is dispalyed on button click</p>');
});
$('.close').click(function () {
$(this).parent().removeClass('alert in');
$(this).parent().empty();
});
Code demo: http://jsfiddle.net/HgeUn/
I am trying to learn jquery and bootstrap. I have two kinds of alerts: 1.
Alert upon page load 2. Alert based on action (button click) in the simple
example.
Pressing 'x' on the alert created by page load clears it. The same does
not happen with the one loaded by the button. Am I missing something in my
script?
<div class="container">
<div class="row">
<div class="span12">
<div id="alert-section" class="alert alert-success">
<button type="button" class="close"
data-dismiss="alert">×</button>
<h4>Page load alert!</h4>
This alert is displayed when page loads.
</div>
<button type="button" id="btn-alert" href="#">Open my
alert</button>
<div id="le-alert"></div>
</div>
</div>
</div>
$('#btn-alert').click(function () {
$('#le-alert').addClass('alert in');
$('#le-alert').append('<button type="button" class="close"
data-dismiss="alert">×</button><h4>Alert title</h4><p>This
alert is dispalyed on button click</p>');
});
$('.close').click(function () {
$(this).parent().removeClass('alert in');
$(this).parent().empty();
});
Code demo: http://jsfiddle.net/HgeUn/
Get the argument value of a directive in a controller
Get the argument value of a directive in a controller
I would like to create a directive and use the argument in my controller:
<body ng-app="UssdAuto">
<navigationbar tst="hello">
</navigationbar>
</body>
For this I create a directive and its controller:
navigationBar = {};
navigationBar.directives = {};
navigationBar.controllers = {};
navigationBar.directives.navigationbar = function () {
return {
restrict: 'E',
scope: {
t1: '@tst',
t2: '=tst',
t3: '&tst'
},
templateUrl: "common/navigation_bar/navigation_bar.tpl.html",
controller: "NavigationBarController"
}
};
navigationBar.controllers.NavigationBarController = function ($scope, Api) {
console.log($scope);
console.log($scope.t1);
console.log($scope.t2);
console.log($scope.t3);
};
testApp.directive(navigationBar.directives);
testApp.controller(navigationBar.controllers);
In the console I got this:
Scope {$id: "003", $$childTail: null, $$childHead: null, $$prevSibling:
null, $$nextSibling: null…}
$$asyncQueue: Array[0]
$$childHead: Child
$$childTail: Child
$$destroyed: false
$$isolateBindings: Object
$$listeners: Object
$$nextSibling: Child
$$phase: null
$$prevSibling: null
$$watchers: Array[9]
$id: "003"
$parent: Scope
$root: Scope
nav: Object
t1: "hello"
t2: undefined
t3: function (locals) {
this: Scope
__proto__: Object
and:
undefined navigation_bar.js:33
undefined navigation_bar.js:34
function (locals) {
return parentGet(parentScope, locals);
}
I would like to understand why the console.log($scope.t1); doesn't display
the value as it is in the scope->t1: "hello"
Thank you for your help,
Julio
I would like to create a directive and use the argument in my controller:
<body ng-app="UssdAuto">
<navigationbar tst="hello">
</navigationbar>
</body>
For this I create a directive and its controller:
navigationBar = {};
navigationBar.directives = {};
navigationBar.controllers = {};
navigationBar.directives.navigationbar = function () {
return {
restrict: 'E',
scope: {
t1: '@tst',
t2: '=tst',
t3: '&tst'
},
templateUrl: "common/navigation_bar/navigation_bar.tpl.html",
controller: "NavigationBarController"
}
};
navigationBar.controllers.NavigationBarController = function ($scope, Api) {
console.log($scope);
console.log($scope.t1);
console.log($scope.t2);
console.log($scope.t3);
};
testApp.directive(navigationBar.directives);
testApp.controller(navigationBar.controllers);
In the console I got this:
Scope {$id: "003", $$childTail: null, $$childHead: null, $$prevSibling:
null, $$nextSibling: null…}
$$asyncQueue: Array[0]
$$childHead: Child
$$childTail: Child
$$destroyed: false
$$isolateBindings: Object
$$listeners: Object
$$nextSibling: Child
$$phase: null
$$prevSibling: null
$$watchers: Array[9]
$id: "003"
$parent: Scope
$root: Scope
nav: Object
t1: "hello"
t2: undefined
t3: function (locals) {
this: Scope
__proto__: Object
and:
undefined navigation_bar.js:33
undefined navigation_bar.js:34
function (locals) {
return parentGet(parentScope, locals);
}
I would like to understand why the console.log($scope.t1); doesn't display
the value as it is in the scope->t1: "hello"
Thank you for your help,
Julio
CakePHP fixtures for views not tables
CakePHP fixtures for views not tables
I've got a fixture that is based off of a MySQL view as opposed to a
standard table. When I run the unit tests I get the following error
message.
MissingTableException : Table price_records for model PriceRecord was not
found in datasource test.
Is there someway that I can get Cake to build the MySQL view as a table or
is there another work around?
I've got a fixture that is based off of a MySQL view as opposed to a
standard table. When I run the unit tests I get the following error
message.
MissingTableException : Table price_records for model PriceRecord was not
found in datasource test.
Is there someway that I can get Cake to build the MySQL view as a table or
is there another work around?
Sunday, 18 August 2013
Can't use kendoComboBox in kendoGrid
Can't use kendoComboBox in kendoGrid
I would like to bind combobox into kendo grid
Please give me example code grid that have bind combobox from database
var provinces = $("#ddlProvince").kendoComboBox({
placeholder: "Choose Province",
dataTextField: "pname",
dataValueField: "pcode",
dataSource:data_province
}).data("kendoComboBox");
<div id="gridData"></div>
I would like to bind combobox into kendo grid
Please give me example code grid that have bind combobox from database
var provinces = $("#ddlProvince").kendoComboBox({
placeholder: "Choose Province",
dataTextField: "pname",
dataValueField: "pcode",
dataSource:data_province
}).data("kendoComboBox");
<div id="gridData"></div>
Elements initiated from jQuery load 'slower' than elements hard coded
Elements initiated from jQuery load 'slower' than elements hard coded
I've noticed that when an element with an image gets loaded from jQuery
that it will load last , or after all other images that were hard coded
into the page. Is it possible to have everything load in order? Is there a
way to work around this?
I've noticed that when an element with an image gets loaded from jQuery
that it will load last , or after all other images that were hard coded
into the page. Is it possible to have everything load in order? Is there a
way to work around this?
Take data from one div and insert into another section of page
Take data from one div and insert into another section of page
What would be the best solution to this ... I want to take the 3rd content
div's image filename, link, and text), and duplicate it as the first entry
in the old section. Basically duplicating the data contents, but using the
div structure from the old section. The differences in structure as you
can see are the image file name (one using featured, and the other being
boxart), and the imgframenew and posterimage div.
If you need me to clarify let me know as this is a little abstract, and
difficult for me to describe easily in writing.
<div class="new">
<div class="content"><div class="imgframenew">
<div class="posterimage"
style="background:url(/media/images/featured/pic1.jpg);"></div></div>
<div class="title"><a rel="/media/link1/">Example 1</a></div></div>
<div class="content"><div class="imgframenew">
<div class="posterimage"
style="background:url(/media/images/featured/pic2.jpg);"></div></div>
<div class="title"><a rel="/media/link2/">Example 2</a></div></div>
<div class="content"><div class="imgframenew">
<div class="posterimage"
style="background:url(/media/images/featured/pic3.jpg);"></div></div>
<div class="title"><a rel="/media/link3/">Example 3</a></div></div>
</div><div class="old">
<!-- Duplicate 3rd div content from above, here, but using the div
structure from below -->
<div class="content"><div class="imgframe"
style="background:url(/media/images/boxart/pic1.jpg);"></div>
<div class="title"><a rel="/media/link1">Example 1</a></div></div>
<div class="content"><div class="imgframe"
style="background:url(/media/images/boxart/pic2.jpg);"></div>
<div class="title"><a rel="/media/link2">Example 2</a></div></div>
<div class="content"><div class="imgframe"
style="background:url(/media/images/boxart/pic3.jpg);"></div>
<div class="title"><a rel="/media/link3">Example 3</a></div></div>
What would be the best solution to this ... I want to take the 3rd content
div's image filename, link, and text), and duplicate it as the first entry
in the old section. Basically duplicating the data contents, but using the
div structure from the old section. The differences in structure as you
can see are the image file name (one using featured, and the other being
boxart), and the imgframenew and posterimage div.
If you need me to clarify let me know as this is a little abstract, and
difficult for me to describe easily in writing.
<div class="new">
<div class="content"><div class="imgframenew">
<div class="posterimage"
style="background:url(/media/images/featured/pic1.jpg);"></div></div>
<div class="title"><a rel="/media/link1/">Example 1</a></div></div>
<div class="content"><div class="imgframenew">
<div class="posterimage"
style="background:url(/media/images/featured/pic2.jpg);"></div></div>
<div class="title"><a rel="/media/link2/">Example 2</a></div></div>
<div class="content"><div class="imgframenew">
<div class="posterimage"
style="background:url(/media/images/featured/pic3.jpg);"></div></div>
<div class="title"><a rel="/media/link3/">Example 3</a></div></div>
</div><div class="old">
<!-- Duplicate 3rd div content from above, here, but using the div
structure from below -->
<div class="content"><div class="imgframe"
style="background:url(/media/images/boxart/pic1.jpg);"></div>
<div class="title"><a rel="/media/link1">Example 1</a></div></div>
<div class="content"><div class="imgframe"
style="background:url(/media/images/boxart/pic2.jpg);"></div>
<div class="title"><a rel="/media/link2">Example 2</a></div></div>
<div class="content"><div class="imgframe"
style="background:url(/media/images/boxart/pic3.jpg);"></div>
<div class="title"><a rel="/media/link3">Example 3</a></div></div>
Flash Player slows down when I move mouse
Flash Player slows down when I move mouse
Whenever I move my mouse, my flash player slows down. It happens only in
flash games, not videos (from what I've seen so far); and it seems to only
happens in Firefox, because whenever I use Chromium, I have no problem at
all. (It seems that it's not an add-on problem, because I've used FF with
all add-ons disabled in safe mode, but there's no difference).
What it could be?
Firefox 23.0+build2-0ubuntu0.13.04.1
Chromium-browser 28.0.1500.71-0ubuntu1.13.04.1
flashplugin-installer 11.2.202.297ubuntu0.13.04.1
3.8.0-27-generic #40-Ubuntu SMP Tue Jul 9 00:17:05 UTC 2013 x86_64 x86_64
x86_64 GNU/Linux
Whenever I move my mouse, my flash player slows down. It happens only in
flash games, not videos (from what I've seen so far); and it seems to only
happens in Firefox, because whenever I use Chromium, I have no problem at
all. (It seems that it's not an add-on problem, because I've used FF with
all add-ons disabled in safe mode, but there's no difference).
What it could be?
Firefox 23.0+build2-0ubuntu0.13.04.1
Chromium-browser 28.0.1500.71-0ubuntu1.13.04.1
flashplugin-installer 11.2.202.297ubuntu0.13.04.1
3.8.0-27-generic #40-Ubuntu SMP Tue Jul 9 00:17:05 UTC 2013 x86_64 x86_64
x86_64 GNU/Linux
C macro stringification
C macro stringification
I am using gcc to compile C99 code. I want to write a macro which will
return a string containing the function name and line number.
This is what I have:
#define INFO_MSG __FILE__ ":"__func__"()"
However, when I compile code which attempts to use this string, for example:
char buff[256] = {'\0'}
sprintf(buff, "Something bad happened here: %s, at line: %d", INFO_MSG,
__LINE__);
printf("INFO: %s\n", buff);
I get the following error message:
error: expected ')' before '__func__'
I have tracked the problem down to the macro. as when I remove __func__
from the macro, the code compiles correctly.
How do I fix the macro, so that I can include the predefined __func__
macro in my string?
I am using gcc to compile C99 code. I want to write a macro which will
return a string containing the function name and line number.
This is what I have:
#define INFO_MSG __FILE__ ":"__func__"()"
However, when I compile code which attempts to use this string, for example:
char buff[256] = {'\0'}
sprintf(buff, "Something bad happened here: %s, at line: %d", INFO_MSG,
__LINE__);
printf("INFO: %s\n", buff);
I get the following error message:
error: expected ')' before '__func__'
I have tracked the problem down to the macro. as when I remove __func__
from the macro, the code compiles correctly.
How do I fix the macro, so that I can include the predefined __func__
macro in my string?
post link vs pre link in Angular js directives
post link vs pre link in Angular js directives
As outlined here:
http://docs.angularjs.org/guide/directive
Angular js directives take two different types of link functions:
Pre-linking function Executed before the child elements are linked. Not
safe to do DOM transformation since the compiler linking function will
fail to locate the correct elements for linking.
Post-linking function Executed after the child elements are linked. It is
safe to do DOM transformation in the post-linking function.
Additionally, it appears that the default key of link will bind to
postLink if given an anonymous function.
When and why would I ever want to use a pre link function?
As outlined here:
http://docs.angularjs.org/guide/directive
Angular js directives take two different types of link functions:
Pre-linking function Executed before the child elements are linked. Not
safe to do DOM transformation since the compiler linking function will
fail to locate the correct elements for linking.
Post-linking function Executed after the child elements are linked. It is
safe to do DOM transformation in the post-linking function.
Additionally, it appears that the default key of link will bind to
postLink if given an anonymous function.
When and why would I ever want to use a pre link function?
Saturday, 17 August 2013
Eigenvector/value in linear transformation.
Eigenvector/value in linear transformation.
I came across this problem
For (a), I wrote $$T(3x,4y) = \lambda (3x, 4y)$$
Since $T$ is a reflection, $\lambda = 1$
That is as far as I got
(b) I simply have no idea. I only know how to find $A$ through brute force.
I came across this problem
For (a), I wrote $$T(3x,4y) = \lambda (3x, 4y)$$
Since $T$ is a reflection, $\lambda = 1$
That is as far as I got
(b) I simply have no idea. I only know how to find $A$ through brute force.
Applicative Instance for (Monad m, Monoid o) => m o?
Applicative Instance for (Monad m, Monoid o) => m o?
Sorry for the terrible title. I'm trying to make an instance of
Applicative for a Monad wrapping a type that is a Monoid.
instance (Monad m, Monoid o) => Applicative (m o) where
pure x = return mempty
xm <*> ym = do
x <- xm
y <- ym
return $ x `mappend` y
This doesn't work; GCHi complains with:
Kind mis-match
The first argument of `Applicative' should have kind `* -> *',
but `m o' has kind `*'
In the instance declaration for `Applicative (m o)'
I realise that what I've written above may make no sense. Here is the
context: I am trying to use the compos abstraction as described in the
paper A pattern for almost compositional functions. Taking this tree
(using the GADT version of compos; I've simplified it a lot):
data Tree :: * -> * where
Var :: String -> Expr
Abs :: [String] -> Expr -> Expr
App :: Expr -> [Expr] -> Expr
class Compos t where
compos :: Applicative f => (forall a. t a -> f (t a)) -> t c -> f (t c)
instance Compos Tree where
compos f t =
case t of
Abs ps e -> pure Abs <*> pure ps <*> f e
App e es -> pure App <*> f e <*> traverse f es
_ -> pure t
I'm going to write a lot of functions which descend the tree and return a
list of say errors or a set of strings whilst also requiring state as it
goes down (such as the binding environment), such as:
composFoldM :: (Compos t, Monad m, Monoid o) => (forall a. t a -> m o) ->
t c -> m o
composFoldM f = ???
checkNames :: (Tree a) -> State (Set Name) [Error]
checkNames e =
case e of
Var n -> do
env <- get
-- check that n is in the current environment
return $ if Set.member n env then [] else [NameError n]
Abs ps e' -> do
env <- get
-- add the abstractions to the current environment
put $ insertManySet ps env
checkNames e'
_ -> composFoldM checkNames e
data Error = NameError Name
insertManySet xs s = Set.union s (Set.fromList xs)
I think these should all be able to be abstracted away by making
composFoldM use compos for the (Monad m, Monoid o) => m o structure. So to
use it with the GADT Applicative version of compos found on page 575/576
of the paper. I think I need to make an Applicative instance of this
structure. How would I do this? Or am I going down completely the wrong
path?
Sorry for the terrible title. I'm trying to make an instance of
Applicative for a Monad wrapping a type that is a Monoid.
instance (Monad m, Monoid o) => Applicative (m o) where
pure x = return mempty
xm <*> ym = do
x <- xm
y <- ym
return $ x `mappend` y
This doesn't work; GCHi complains with:
Kind mis-match
The first argument of `Applicative' should have kind `* -> *',
but `m o' has kind `*'
In the instance declaration for `Applicative (m o)'
I realise that what I've written above may make no sense. Here is the
context: I am trying to use the compos abstraction as described in the
paper A pattern for almost compositional functions. Taking this tree
(using the GADT version of compos; I've simplified it a lot):
data Tree :: * -> * where
Var :: String -> Expr
Abs :: [String] -> Expr -> Expr
App :: Expr -> [Expr] -> Expr
class Compos t where
compos :: Applicative f => (forall a. t a -> f (t a)) -> t c -> f (t c)
instance Compos Tree where
compos f t =
case t of
Abs ps e -> pure Abs <*> pure ps <*> f e
App e es -> pure App <*> f e <*> traverse f es
_ -> pure t
I'm going to write a lot of functions which descend the tree and return a
list of say errors or a set of strings whilst also requiring state as it
goes down (such as the binding environment), such as:
composFoldM :: (Compos t, Monad m, Monoid o) => (forall a. t a -> m o) ->
t c -> m o
composFoldM f = ???
checkNames :: (Tree a) -> State (Set Name) [Error]
checkNames e =
case e of
Var n -> do
env <- get
-- check that n is in the current environment
return $ if Set.member n env then [] else [NameError n]
Abs ps e' -> do
env <- get
-- add the abstractions to the current environment
put $ insertManySet ps env
checkNames e'
_ -> composFoldM checkNames e
data Error = NameError Name
insertManySet xs s = Set.union s (Set.fromList xs)
I think these should all be able to be abstracted away by making
composFoldM use compos for the (Monad m, Monoid o) => m o structure. So to
use it with the GADT Applicative version of compos found on page 575/576
of the paper. I think I need to make an Applicative instance of this
structure. How would I do this? Or am I going down completely the wrong
path?
A gap in 360 degree canvas arc
A gap in 360 degree canvas arc
Why there is a gap in 360 degree arc
ctx.beginPath();
ctx.moveTo(100, 100);
ctx.arc(100, 100, 100, 90 * Math.PI / 180, 450 * Math.PI / 180);
and arc from 0 to 360 have not
ctx.beginPath();
ctx.moveTo(310, 100);
ctx.arc(310, 100, 100, 0 * Math.PI / 180, 360 * Math.PI / 180);
http://jsfiddle.net/YMtdZ/4/
It's a bug or I'm doing something wrong?
Why there is a gap in 360 degree arc
ctx.beginPath();
ctx.moveTo(100, 100);
ctx.arc(100, 100, 100, 90 * Math.PI / 180, 450 * Math.PI / 180);
and arc from 0 to 360 have not
ctx.beginPath();
ctx.moveTo(310, 100);
ctx.arc(310, 100, 100, 0 * Math.PI / 180, 360 * Math.PI / 180);
http://jsfiddle.net/YMtdZ/4/
It's a bug or I'm doing something wrong?
How to truncate a string in javascript [duplicate]
How to truncate a string in javascript [duplicate]
This question already has an answer here:
Truncate a string straight javascript 3 answers
Basically. I'm building a Tumblr theme with flipping panels based on a
site I made for a hackathon. Tumblr will only give me the contents of a
text post as a massive string. But I want it truncated to like 200
characters so the contents will all fit on one "panel".
(The URL for the theme at the moment is http://jackwantshugs.tumblr.com/
and the text post is the one on the top left.)
This question already has an answer here:
Truncate a string straight javascript 3 answers
Basically. I'm building a Tumblr theme with flipping panels based on a
site I made for a hackathon. Tumblr will only give me the contents of a
text post as a massive string. But I want it truncated to like 200
characters so the contents will all fit on one "panel".
(The URL for the theme at the moment is http://jackwantshugs.tumblr.com/
and the text post is the one on the top left.)
Forward an element of a tuple
Forward an element of a tuple
Consider the following code:
template <unsigned int Index, class Tuple, class Type = /* Something1 */>
Type forward(Tuple&& tuple)
{
return /* Something2 */;
}
I would like to find what is the correct syntax of /* Something1 */ and /*
Something2 */ in order to forward the element specified by Index of the
input tuple. I know that other conceptions/syntax would be available, but
in order to understand correctly how things work in such a context
(consider this as an academic exercice), I would like an answer that
satisfy the following conditions:
no overload for different cases: there will be only one function forward
no change except /* Something1 */ and /* Something2 */ (and maybe on the
return type if it should be Type&& instead of Type)
metaprogramming crazyness, decltype and std::declval are accepted
For example, if tuple = std::tuple<char, int, double>, forward<2>(tuple),
should forward the third element (the double).
Consider the following code:
template <unsigned int Index, class Tuple, class Type = /* Something1 */>
Type forward(Tuple&& tuple)
{
return /* Something2 */;
}
I would like to find what is the correct syntax of /* Something1 */ and /*
Something2 */ in order to forward the element specified by Index of the
input tuple. I know that other conceptions/syntax would be available, but
in order to understand correctly how things work in such a context
(consider this as an academic exercice), I would like an answer that
satisfy the following conditions:
no overload for different cases: there will be only one function forward
no change except /* Something1 */ and /* Something2 */ (and maybe on the
return type if it should be Type&& instead of Type)
metaprogramming crazyness, decltype and std::declval are accepted
For example, if tuple = std::tuple<char, int, double>, forward<2>(tuple),
should forward the third element (the double).
Laravel query not executed
Laravel query not executed
My query in my view is not executed. from the ->select('name') it just
displays like a plain text on my website.
<tbody>
@foreach($getdeaths as $getdeath)
<tr>
<? DB::table('players')->select('name')->where('id',
$getdeath->player_id)->get(); ?>
<td>{{ $getdeath->player_id }}</td>
<td>{{ $getdeath->level }}</td>
<td>{{ date("d F Y (H:i)", strtotime($getdeath->time)) }}</td>
<td>@if($getdeath->is_player == 1)
{{ '<a
href="characters/'.$getdeath->killed_by.'">'.$getdeath->killed_by.'</a>
(PVP)' }}
@else
{{ $getdeath->killed_by }}
@endif</td>
</tr>
@endforeach
</tbody>
My query in my view is not executed. from the ->select('name') it just
displays like a plain text on my website.
<tbody>
@foreach($getdeaths as $getdeath)
<tr>
<? DB::table('players')->select('name')->where('id',
$getdeath->player_id)->get(); ?>
<td>{{ $getdeath->player_id }}</td>
<td>{{ $getdeath->level }}</td>
<td>{{ date("d F Y (H:i)", strtotime($getdeath->time)) }}</td>
<td>@if($getdeath->is_player == 1)
{{ '<a
href="characters/'.$getdeath->killed_by.'">'.$getdeath->killed_by.'</a>
(PVP)' }}
@else
{{ $getdeath->killed_by }}
@endif</td>
</tr>
@endforeach
</tbody>
Cannot change color of a-tag
Cannot change color of a-tag
My demo code: http://jsfiddle.net/4w3Hy/3/
My first code adds html to an div with the id:Content:
$(".text").click(function() {
$("#Content").html($(this).next(".text1").html());
});
On the id:Content, with the new html, i try to run another jquery function:
$(".click").click(function() {
$('.click').css('color','');
$(this).css( "color", "red" );
});
But somehow this wont work!! What did i made wrong? to see html
http://jsfiddle.net/4w3Hy/3/
My demo code: http://jsfiddle.net/4w3Hy/3/
My first code adds html to an div with the id:Content:
$(".text").click(function() {
$("#Content").html($(this).next(".text1").html());
});
On the id:Content, with the new html, i try to run another jquery function:
$(".click").click(function() {
$('.click').css('color','');
$(this).css( "color", "red" );
});
But somehow this wont work!! What did i made wrong? to see html
http://jsfiddle.net/4w3Hy/3/
Friday, 16 August 2013
Paypal sandbox redirect to homepage for Safari
Paypal sandbox redirect to homepage for Safari
We are having issue with PayPal sandbox. This issue is particular for
Safari Browser, which is like below:
1) for first try on safari, when Paypal form submitted, it gets redirected
to Paypal home page rather than pay page. 2) Issue issue keeps on
occurring, after 4-5 try it gets redirected to correct page. Nothing was
changed on code when it works fine.
So is this a known issue with Paypal sandbox or I am missing something?
We are having issue with PayPal sandbox. This issue is particular for
Safari Browser, which is like below:
1) for first try on safari, when Paypal form submitted, it gets redirected
to Paypal home page rather than pay page. 2) Issue issue keeps on
occurring, after 4-5 try it gets redirected to correct page. Nothing was
changed on code when it works fine.
So is this a known issue with Paypal sandbox or I am missing something?
Saturday, 10 August 2013
using fgets and strcmp in C
using fgets and strcmp in C
I'm trying to get a string input from the user and then run different
functions depending on the input they've entered.
For example, say I asked, "What is your favorite fruit?" and I want the
program to comment depending on what they enter...I'm not sure how to do
this. Here's what I have so far:
#include <stdio.h>
#include <string.h>
char fruit[100];
main() {
printf("What is your favorite fruit?\n");
fgets (fruit, 100, stdin);
if (strcmp(fruit, "apple")) {
printf("Watch out for worms!\n");
}
else {
printf("You should have an apple instead.\n");
}
}
When I run the program, no matter what I enter, it never does the else
statement.
Thanks for your help!
I'm trying to get a string input from the user and then run different
functions depending on the input they've entered.
For example, say I asked, "What is your favorite fruit?" and I want the
program to comment depending on what they enter...I'm not sure how to do
this. Here's what I have so far:
#include <stdio.h>
#include <string.h>
char fruit[100];
main() {
printf("What is your favorite fruit?\n");
fgets (fruit, 100, stdin);
if (strcmp(fruit, "apple")) {
printf("Watch out for worms!\n");
}
else {
printf("You should have an apple instead.\n");
}
}
When I run the program, no matter what I enter, it never does the else
statement.
Thanks for your help!
apple mach-O linker error but not if one class remvode from project membership
apple mach-O linker error but not if one class remvode from project
membership
I'm getting apple mach-O linker error when building my app. But when I
remove my project as a target membership of one of my classes, it works
fine except I need to have my class in my project of course
Any help ? Thanks !!
membership
I'm getting apple mach-O linker error when building my app. But when I
remove my project as a target membership of one of my classes, it works
fine except I need to have my class in my project of course
Any help ? Thanks !!
Friday, 9 August 2013
knowledge base, and a query, write a parser
knowledge base, and a query, write a parser
Given a directed labelled graph in form of a knowledge base, and a query,
write a parser which can return the edges and/or nodes requested in the
query. (Knowledge base and queries are not case sensitive) Knowledge base
is given as input in a text file (input.txt). For example a DAG can be
represented as:
And the corresponding knowledge base for this DAG is :
(<Shelden>, <hasFriend>, <Raj>)
(<Shelden>, <hasFriend>, <Leonard>)
(<Shelden>, <worksAt>, <Caltech>)
(<Leonard>, <worksAt>, <Caltech>)
(<Raj>, <worksAt>, <Caltech>)
(<Raj>, <age>,"30")
[Here 30 is a number and no edge can go out from this node while others
like Nabraska, New_Delhi are entities, which can have further outgoing
links.]
(<Leonard>, <hasFriend>, <Penny>)
(<Penny>, <bornIn>, <Nabraska>)
(<Raj>, <bornIn>, <New_Delhi>)
A query can be written as :
Find persons who are friends?
Test case 1 : Select ?person1 ?person2 where { ?person1 <hasfriend>
?person2. }
The goal is to fill all the variable represented by ? with their values
from knowledge base and return in csv format:
The result of this query is:
Person 1 Person 2
Shelden Raj
Shelden Leonard
Leonard Penny
The similar query can be extended to have joins also:
Find persons who are friends with Sheldon and the company/colleges to
which his friends belong?
Test Case 2 : Select ?person ?university where { <Sheldon> <hasFriend>
?person . ?person <worksAt> ?university. }
Person University
Leonard Caltech
Raj Caltech
Test Case 3 : Select ?person1 ?person2 where { ?person1 <worksAt>
<Caltech> . ?person2 <bornIn < Nabraska> . ?person1 <hasFriend> ?person2
.}
Person 1 Person 2
Leonard Penny
Test Case 5 : select * where {}
Output : Parse Error
How to approach this problem?
Given a directed labelled graph in form of a knowledge base, and a query,
write a parser which can return the edges and/or nodes requested in the
query. (Knowledge base and queries are not case sensitive) Knowledge base
is given as input in a text file (input.txt). For example a DAG can be
represented as:
And the corresponding knowledge base for this DAG is :
(<Shelden>, <hasFriend>, <Raj>)
(<Shelden>, <hasFriend>, <Leonard>)
(<Shelden>, <worksAt>, <Caltech>)
(<Leonard>, <worksAt>, <Caltech>)
(<Raj>, <worksAt>, <Caltech>)
(<Raj>, <age>,"30")
[Here 30 is a number and no edge can go out from this node while others
like Nabraska, New_Delhi are entities, which can have further outgoing
links.]
(<Leonard>, <hasFriend>, <Penny>)
(<Penny>, <bornIn>, <Nabraska>)
(<Raj>, <bornIn>, <New_Delhi>)
A query can be written as :
Find persons who are friends?
Test case 1 : Select ?person1 ?person2 where { ?person1 <hasfriend>
?person2. }
The goal is to fill all the variable represented by ? with their values
from knowledge base and return in csv format:
The result of this query is:
Person 1 Person 2
Shelden Raj
Shelden Leonard
Leonard Penny
The similar query can be extended to have joins also:
Find persons who are friends with Sheldon and the company/colleges to
which his friends belong?
Test Case 2 : Select ?person ?university where { <Sheldon> <hasFriend>
?person . ?person <worksAt> ?university. }
Person University
Leonard Caltech
Raj Caltech
Test Case 3 : Select ?person1 ?person2 where { ?person1 <worksAt>
<Caltech> . ?person2 <bornIn < Nabraska> . ?person1 <hasFriend> ?person2
.}
Person 1 Person 2
Leonard Penny
Test Case 5 : select * where {}
Output : Parse Error
How to approach this problem?
Count of different values in MySQL table not adding correctly
Count of different values in MySQL table not adding correctly
I am trying to get a count of the number of different countries I have in
a table but can't get the right result when I echo it out with php.
although phpmyadmin gives the correct answer. This is my query:
$sql2 = "SELECT count(*) as country FROM tpf_parks GROUP BY country" ;
$result2 = $pdo->query($sql2);
foreach ($result2 as $row2)
and this is how I am diplaying it
echo $row2[ 'country' ]
On if I run the query on phpmyadmin I get the correct answer of 17. When
run through the above php it returns 56. What have I done wrong?
I am trying to get a count of the number of different countries I have in
a table but can't get the right result when I echo it out with php.
although phpmyadmin gives the correct answer. This is my query:
$sql2 = "SELECT count(*) as country FROM tpf_parks GROUP BY country" ;
$result2 = $pdo->query($sql2);
foreach ($result2 as $row2)
and this is how I am diplaying it
echo $row2[ 'country' ]
On if I run the query on phpmyadmin I get the correct answer of 17. When
run through the above php it returns 56. What have I done wrong?
Sublime text 2 - find file by class name in Zend Framework
Sublime text 2 - find file by class name in Zend Framework
When you press Ctrl+p Sublime will open popup when you can easily find the
file. Sublime auto detect the file location in both situation when you
press / or space between file path parts.
In Zend Framework all classes has name within follow template:
Namespace_Module_Other_Part_Of_Class_Location, how can I make Sublime
understand the _ as a path separator when I press Ctrl+p and copy past the
class name there?
So the above class should be recognized on location:
Project/Namespace/Module/Other/Part/Of/Class/Location.php
When you press Ctrl+p Sublime will open popup when you can easily find the
file. Sublime auto detect the file location in both situation when you
press / or space between file path parts.
In Zend Framework all classes has name within follow template:
Namespace_Module_Other_Part_Of_Class_Location, how can I make Sublime
understand the _ as a path separator when I press Ctrl+p and copy past the
class name there?
So the above class should be recognized on location:
Project/Namespace/Module/Other/Part/Of/Class/Location.php
How to set up divs without spacing in between?
How to set up divs without spacing in between?
I want to set up a div structure like this (where there is a div on top,
and two divs under) but I don't want to use any tables. Also there can't
be any spacing between the divs, and if possible I want the borders to be
collapsed.
_________
| |
|_________|
| | |
|____|____|
This doesn't seem to work.
<div></div>
<br/>
<div></div><div></div>
Does anyone know how to do this?
Thanks.
I want to set up a div structure like this (where there is a div on top,
and two divs under) but I don't want to use any tables. Also there can't
be any spacing between the divs, and if possible I want the borders to be
collapsed.
_________
| |
|_________|
| | |
|____|____|
This doesn't seem to work.
<div></div>
<br/>
<div></div><div></div>
Does anyone know how to do this?
Thanks.
set datepicker date on textfield
set datepicker date on textfield
I'm using core data to add an entity to a database. There is a field for
calculating your age. You use the picker to fill out your birthday and it
sets the text of the textfield according to what was selected in the
datepicker. There is another view, a detail view of the entity which you
can edit. Unfortunately, when the picker loads, it loads todays date, and
not the date in the textfield that was already set. Is there any way I can
set the picker's date using a textfield? The text is in this format:
August 11, 1997. Sorry if I explained poorly. Basically I want to set the
datepicker's date based upon the text in a textfield.
just so you have an idea of what is happening:
- (void) dateChanged:(id)sender{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateStyle = NSDateFormatterLongStyle;
birthdayTextField.text = [NSString stringWithFormat:@"%@",
[dateFormatter stringFromDate:birthdayDatePicker.date]];
[dateFormatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"];
NSString *startdate= [NSString stringWithFormat:@"%@",
[dateFormatter stringFromDate:
birthdayDatePicker.date]];
NSDate *End=[dateFormatter dateFromString:[dateFormatter
stringFromDate:[NSDate date]]];
NSCalendar *gregorianCalendar = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [gregorianCalendar
components:NSYearCalendarUnit
fromDate:[dateFormatter
dateFromString:startdate]
toDate:End
options:0];
if(components.year > 0){
ageTextField.text=[NSString stringWithFormat:@"%d",components.year];
}
}
I'm using core data to add an entity to a database. There is a field for
calculating your age. You use the picker to fill out your birthday and it
sets the text of the textfield according to what was selected in the
datepicker. There is another view, a detail view of the entity which you
can edit. Unfortunately, when the picker loads, it loads todays date, and
not the date in the textfield that was already set. Is there any way I can
set the picker's date using a textfield? The text is in this format:
August 11, 1997. Sorry if I explained poorly. Basically I want to set the
datepicker's date based upon the text in a textfield.
just so you have an idea of what is happening:
- (void) dateChanged:(id)sender{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateStyle = NSDateFormatterLongStyle;
birthdayTextField.text = [NSString stringWithFormat:@"%@",
[dateFormatter stringFromDate:birthdayDatePicker.date]];
[dateFormatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"];
NSString *startdate= [NSString stringWithFormat:@"%@",
[dateFormatter stringFromDate:
birthdayDatePicker.date]];
NSDate *End=[dateFormatter dateFromString:[dateFormatter
stringFromDate:[NSDate date]]];
NSCalendar *gregorianCalendar = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [gregorianCalendar
components:NSYearCalendarUnit
fromDate:[dateFormatter
dateFromString:startdate]
toDate:End
options:0];
if(components.year > 0){
ageTextField.text=[NSString stringWithFormat:@"%d",components.year];
}
}
Execute ant task over sons of parent folder
Execute ant task over sons of parent folder
I was trying to execute a task over a fileset defined using something like
this:
<target name="copyToTarget">
<copy todir="${target.folder}/" >
<fileset dir="../**/folder" />
</copy>
</target>
Is there anyway to achieve this?
I was trying to execute a task over a fileset defined using something like
this:
<target name="copyToTarget">
<copy todir="${target.folder}/" >
<fileset dir="../**/folder" />
</copy>
</target>
Is there anyway to achieve this?
how to return true/false from nested jquery callback functions
how to return true/false from nested jquery callback functions
I am trying to validate elements inside a javascript function which
contains two jQuery callback loops. Based on the conditions I want to
return true/false from the inner jQuery loop and that should be sent back
to the calling method of javascript. If the result of the inner loop is
true the loop should stop running.
if(validate(key)){
}
else{
}
function validate(key) {
$jquery.each(function(){
$jquery.each(function(){
if(){
return true;
}
else{
return false}
})
})
}
I am trying to validate elements inside a javascript function which
contains two jQuery callback loops. Based on the conditions I want to
return true/false from the inner jQuery loop and that should be sent back
to the calling method of javascript. If the result of the inner loop is
true the loop should stop running.
if(validate(key)){
}
else{
}
function validate(key) {
$jquery.each(function(){
$jquery.each(function(){
if(){
return true;
}
else{
return false}
})
})
}
Thursday, 8 August 2013
Python string 'in' operator implementation algorithm and time complexity
Python string 'in' operator implementation algorithm and time complexity
I am thinking of how the in operator implement, for instance
>>> s1 = 'abcdef'
>>> s2 = 'bcd'
>>> s2 in s1
True
In CPython, which algorithm is used to implement the string match, and
what is the time complexity? Is there any official document or wiki about
this?
I am thinking of how the in operator implement, for instance
>>> s1 = 'abcdef'
>>> s2 = 'bcd'
>>> s2 in s1
True
In CPython, which algorithm is used to implement the string match, and
what is the time complexity? Is there any official document or wiki about
this?
Compare array of objects with properties in java
Compare array of objects with properties in java
Basically I have two arrays of say "Meal" objects. One array is a Dinner
and the other a Breakfast
This "Meal" has a getDate() function. Now I need to run a function where I
put the Meals with common dates into a Common function.
Is there any easy Java way to do this?
Basically I have two arrays of say "Meal" objects. One array is a Dinner
and the other a Breakfast
This "Meal" has a getDate() function. Now I need to run a function where I
put the Meals with common dates into a Common function.
Is there any easy Java way to do this?
Displaying server-side errors using Kendo Validator
Displaying server-side errors using Kendo Validator
I have a web form that does client validation using Kendo Validator. Once
client validation succeeds the form values are sent to a web service that
does additional validation and either saves the data or sends back a JSON
object of error messages keyed by form field. These field names match the
data-for attributes on the validator elements. Is there a way to display
these errors using Kendo Validator?
I realize you can setup a custom rule to do server-side validation per
field. This is about validating all the fields at once and displaying
multiple errors.
I have a web form that does client validation using Kendo Validator. Once
client validation succeeds the form values are sent to a web service that
does additional validation and either saves the data or sends back a JSON
object of error messages keyed by form field. These field names match the
data-for attributes on the validator elements. Is there a way to display
these errors using Kendo Validator?
I realize you can setup a custom rule to do server-side validation per
field. This is about validating all the fields at once and displaying
multiple errors.
How to allow a imaged computer access to a file
How to allow a imaged computer access to a file
So, my question cant properly be worded so ill explain my dilemma.
I have a server, running windows server 2008 R2 My goal, is to use the
microsoft deployment toolbench to deploy a image to around 15-20 computers
each month. then use AD to update and such.
at the moment im at a standstill. i can not figure out how i can write a
batch file using xcopy. to retrieve exe's from the server and copy them to
the windows folder.
so far i have tried many things here is my info
The server name is "windows08server" the shared folder is called "scripts"
and inside i have all my programs, so my batch file should be exactly this
xcopy /s \windows08server\scripts\putty.exe c:\windows
now. putty is just an example. and i know that this batch works. but the
real issue is i can only make this work when i go into "computer" and type
\windows08server\ and provide a password first... so basicly, my question
to you is. how could i rewrite "xcopy /s
\windows08server\scripts\putty.exe c:/windows" to provide the credentials
so that i can then put another batch file saying to use this in my
deployment share, so i can deploy it to many computers without having to
manually enter the user and password for each computer.
So, my question cant properly be worded so ill explain my dilemma.
I have a server, running windows server 2008 R2 My goal, is to use the
microsoft deployment toolbench to deploy a image to around 15-20 computers
each month. then use AD to update and such.
at the moment im at a standstill. i can not figure out how i can write a
batch file using xcopy. to retrieve exe's from the server and copy them to
the windows folder.
so far i have tried many things here is my info
The server name is "windows08server" the shared folder is called "scripts"
and inside i have all my programs, so my batch file should be exactly this
xcopy /s \windows08server\scripts\putty.exe c:\windows
now. putty is just an example. and i know that this batch works. but the
real issue is i can only make this work when i go into "computer" and type
\windows08server\ and provide a password first... so basicly, my question
to you is. how could i rewrite "xcopy /s
\windows08server\scripts\putty.exe c:/windows" to provide the credentials
so that i can then put another batch file saying to use this in my
deployment share, so i can deploy it to many computers without having to
manually enter the user and password for each computer.
Subscribe to:
Comments (Atom)