Saturday, 31 August 2013

PHP using foreach to insert multiple rows not working

PHP using foreach to insert multiple rows not working

I'm trying to check if a row exists for a specific transaction and when a
new one is submitted it inserts, however, it's only inserting the first
one and not the next 5 that are there too.
Code:
foreach($transactions as $transaction) {
$check_if_transaction_exists =
$db->query("SELECT * FROM
`transactions`")->fetchColumn();
if($check_if_transaction_exists == 0) {
$insert_transaction =
$db->prepare("INSERT INTO
`transactions`
(`deposit_address`,
`amount`,
`timereceived`,
`txid`,
`category`)
VALUES
(:deposit_address,
:amount,
:timereceived,
:txid,
:category)");
$insert_transaction->execute(array(
':deposit_address' =>
$_SESSION['deposit_address'],
':amount' =>
$transaction['amount'],
':timereceived' =>
$transaction['timereceived'],
':txid' =>
$transaction['txid'],
':category' =>
$transaction['category']
));
}
echo '<br />';
echo '<br />' . $transaction['address'];
echo '<br />' . $transaction['amount'];
echo '<br />' . $transaction['confirmations'];
date_default_timezone_set('America/Los_Angeles');
echo '<br />'; echo date("F j, Y, h:i A,",
$transaction['timereceived']);
}
The bottom bit of code returns 6 of the designated elements (address,
amount, confs, etc. ) but only inserts the very first one into the
database. How can I make it insert all of them?

toISOString() return wrong date

toISOString() return wrong date

Hy this piece of code return the tomorrow date ?
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_toisostring
<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to display the date and time as a string,
using the ISO standard.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var d = new Date();
var x = document.getElementById("demo");
x.innerHTML=d.toISOString();
}
</script>
</body>
</html>

Eclipse Color Theme is not working

Eclipse Color Theme is not working

I am Ubuntu 13.04, Eclipse 4.2.1(ADT v22) user.
I encounted error when I might add plugin which is Eclipse Color Theme for
eclipse.
And in Preferences-General-Appearance, when I click Color Theme output
error log...
(Eclipse Color Theme get on Help-install new software
http://eclipse-color-theme.github.com/update
errTitle: Unhandled event loop exception
org.eclipse.swt.SWTException: Failed to execute runnable
(org.eclipse.swt.SWTError: No more handles [Unknown Mozilla path
(MOZILLA_FIVE_HOME not set)])
at org.eclipse.swt.SWT.error(SWT.java:4361)
at org.eclipse.swt.SWT.error(SWT.java:4276)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3537)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3189)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at
org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.open(WorkbenchPreferenceDialog.java:215)
at
org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:65)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
..
..
..
at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:433)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
... 35 more
and close Preference, more error happened.
errTitle: java.lang.ArrayIndexOutOfBoundsException: 0
java.lang.ArrayIndexOutOfBoundsException: 0
at
com.github.eclipsecolortheme.preferences.ColorThemePreferencePage.performOk(ColorThemePreferencePage.java:207)
at
org.eclipse.jface.preference.PreferenceDialog$13.run(PreferenceDialog.java:965)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at
org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:945)
at
org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:448)
at
org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.okPressed(WorkbenchPreferenceDialog.java:171)
at
org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:233)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3562)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3186)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at
org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.open(WorkbenchPreferenceDialog.java:215)
at
org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:65)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3562)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3186)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at
org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
How do I fix it for Eclipse Color Theme working?

Azure Caching - Failure after upgrading to SDK 2.1 and caching 2.1

Azure Caching - Failure after upgrading to SDK 2.1 and caching 2.1

It looks like there are a number of questions already open on this topic,
but I believe mine might be different. My setup:
1 Azure Cache Worker Role
1 Web Role
Up until about a week ago, they existed in harmony, until I tried to
upgrade to Azure caching 2.1. Once I did that, I was afflicted with the
"No such host is known" problem that seems to have affected many
developers out there. I found many questions and sites that directed me to
upgrade my Azure SDK installation to the new 2.1 version. I have done all
of these things:
Install newest Azure SDK 2.1
Uninstall Azure SDK 2.0
Uninstall and Reinstall Azure Caching 2.1
Triple check configuration of all my caching settings
Triple check that all references are pointing to the newest versions and
not the old ones
Upgrade my Azure Project to 2.1 by right-click, going to Properties, and
clicking Upgrade
and I am still getting the following (My Error):
Exception type: SocketException
Exception message: No such host is known
at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
This is different than the more typical error that most other questions
and sites are showing, which is (More commonly reported error, not mine):
No such host is known
Exception message: No such host is known
at Microsoft.ApplicationServer.Caching.AsyncResultNoResult.EndInvoke()
I am about 30 hours into troubleshooting this, and could really use some
help. Maybe I am just missing some step about the upgrade of the SDK?
Somehow maybe sneakily it is still using an old version of a DLL? Is there
some foolproof way to check this besides looking at the path of every
reference in the project (which I have already done, and they all match
up)?

Char pointer in c works unexpectedly

Char pointer in c works unexpectedly

main() { char *p = "ayqm"; char c; c = ++*p++; printf("%c",c); } I thought
it should print c but it prints b.Please explain.
Thanks.

In NetBeans, how do I remove this red line?

In NetBeans, how do I remove this red line?

I've added the following comment to the start of a java program:
** * * George Tomlinson (I'm not the author). I took this from the
internet and made one correction. * This program converts the string
entered by the user from hexadecimal to ASCII.
*/
The word 'internet' (italicised above but not in the actual program) is
being underlined in red by NetBeans. The error it displays is 'misspelled
word', but it's not misspelled. In Word I would just add it to the
dictionary, but I can't find any such option. Does anyone know how to sort
this out?
You can see a screenshot here:
https://www.facebook.com/photo.php?fbid=10201433173246824&set=a.10201433153846339.1073741827.1099868090&type=3&theater

Date to epoch and vice versa - JavaScript

Date to epoch and vice versa - JavaScript

I need to convert date to Java epoch and then read it and convert back.
Not sure what I'm doing wrong here?
var date = new Date('1/3/2013');
var timeStamp = date.getTime();
console.log(timeStamp);
var revertDate = new Date(timeStamp);
console.log(revertDate.getDate()+'/'+revertDate.getMonth()+'/'+revertDate.getFullYear());
The out put is 3/0/2013 instad 1/3/2013?
fiddle link

Friday, 30 August 2013

Would you advise using SharePoint Foundation for Production environment?

Would you advise using SharePoint Foundation for Production environment?

i would like to know more on the critical aspects that need to be thought
of before deciding on using SharePoint Foundation for production

Thursday, 29 August 2013

Jtable single cell having multiple images

Jtable single cell having multiple images

I want to display multiple images in a single cell of a jtable.I know how
to display a single image in a cell but how to do the same in case of
multiple images?

CROSS APPLY to slow for running total - TSQL

CROSS APPLY to slow for running total - TSQL

Please see my code below as it is running to slowly with the CROSS APPLY.
How can I remove the CROSS APPLY and add something else that will run
faster? Please note I am using SQL Server 2008 R2.
;WITH MyCTE
AS
(
SELECT
R.NetWinCURRENCYValue AS NetWin
,dD.[Date] AS TheDay
FROM dimPlayer AS P
JOIN dbo.factRevenue AS R ON P.playerKey = R.playerKey
JOIN dbo.vw_Date AS dD ON Dd.dateKey = R.dateKey
WHERE P.CustomerID = 12345
)
SELECT
A.TheDay AS [Date]
,ISNULL(A.NetWin, 0) AS NetWin
,rt.runningTotal AS CumulativeNetWin
FROM MyCTE AS A
CROSS APPLY (SELECT SUM(NetWin) AS runningTotal
FROM MyCTE WHERE TheDay <= A.TheDay) AS rt
ORDER BY A.TheDay

ServiceStack [IgnoreDataMember] conditionally on per request basis

ServiceStack [IgnoreDataMember] conditionally on per request basis

I am aware of 3 ways to do it statically:
1. [DataContract]+[DataMember]
or
2. [IgnoreDataMember]
or
3. JsConfig<Poco>.ExcludePropertyNames
However, they are fixed. Meaning they are NOT dynamic, I can't make a
decision on run-time to ignore or not ignore that property.
I am thinking of hacking the [IgnoreDataMember] attribute and change it to
something like
[IgnoreDataMemberIf(objConditionSet)]
or
[IgnoreDataMemberIfNotAuthorized(UserAuth)]
Could you please suggest me if this is a good approach? Were there
something like that in SS already built-in that I am not aware of?
Please suggest.

Wednesday, 28 August 2013

javascript for...in loops please explain

javascript for...in loops please explain

My first question on here and need help understanding the for in loop in
JavaScript.
When I run the following code I get "undefined" from the alert function:
var o = {
a: "property 1",
b: "property 2",
c: "property 3",
d: "property 4"
}
for (p in o) {
alert(o.p);
}
but if I were to change . to [ ] (ie. alert(o[p])) the alert would return
the property value as expected.
Why can't I use . to access the object property?

json_decode returning blank

json_decode returning blank

I am working on facebook app. I have stored some values in database in
json format.
When I am fetching the value on the target page and trying to display the
value as follow :
$sql = mysql_query("select * from `beforepublish` where `tabid` =
'$page_id'") or die(mysql_error());
$sql = mysql_fetch_assoc($sql);
$contest_id = $sql['contestid'];
$temp_id = $sql["tempid"];
$value = $sql["values"];
$returnValue = json_decode($value);
echo "<pre>";
print_r($returnValue);
echo "</pre>";
Here the value of
$value = {"image":"upload_1182341221.jpg","conttxt":"Get a chance to win
Samsung Galaxy Tab "}
and I am getting $returnValue as blank.
but When I try :
$returnValue =
json_decode('{"image":"upload_1182341221.jpg","conttxt":"Get a chance to
win Samsung Galaxy Tab "}');
echo "<pre>";
print_r($returnValue);
echo "</pre>";
then $returnValue is returning :
stdClass Object
(
[image] => upload_1182341221.jpg
[conttxt] => Get a chance to win Samsung Galaxy Tab
)
So guys, please help me, Why I am getting a blank value in the previous
case ?
Edit
vardump($value) is returning :
string '{"image":"upload_1182341221.jpg","conttxt":"Get a chance to win
Samsung Galaxy Tab
"}' (length=86)

Catch a PL/SQL procedure's RETURN value in command prompt?

Catch a PL/SQL procedure's RETURN value in command prompt?

Currently im using %testvar%=sqlplus usr/password@schema @test.sql echo
%testvar%
where test.sql calls the procedure using BEGIN END block , and saves the
returned value in a string variable named x , now how do i return this to
command prompt ?

Tuesday, 27 August 2013

Does ADFS work with SSL offloading?

Does ADFS work with SSL offloading?

Does ADFS work with SSL offloading? Ive only seen ADFS with SSL
certificates on the web servers, and we know it requires SSL. But does
this requirement mean it must be all the way through to the servers?

Chheckbox form submission

Chheckbox form submission

I'm struggling to send multiple checkbox entries through a form.
I'm using kirby CMS and the contact form plugin.
This is my code if anyone can shed any light on this.
<fieldset name="check">
<h2>Project Needs</h2>
<ul>
<li><input id="strategy" type="checkbox" name="needs" value="<?php
echo $form->htmlValue('needs') ?> Strategy" checked><label
for="strategy">Strategy</label></li>
<li><input id="ux" type="checkbox" name="needs" value="<?php echo
$form->htmlValue('needs') ?> UX"><label for="ux">UX</label></li>
<li><input id="redesign" type="checkbox" name="needs" value="<?php
echo $form->htmlValue('needs') ?> Re-Design"><label
for="redesign">Re-Design</label></li>
<li><input id="responsive" type="checkbox" name="needs"
value="<?php echo $form->htmlValue('needs') ?> Responsive
Design"><label for="responsive">Responsive Design</label></li>
<li><input id="cms" type="checkbox" name="needs" value="<?php echo
$form->htmlValue('needs') ?> CMS Implementation"><label
for="cms">CMS Implementation</label></li>
<li><input id="unsure" type="checkbox" name="needs" value="<?php
echo $form->htmlValue('needs') ?> Unsure"><label
for="unsure">Unsure</label></li>
</ul>
</fieldset>
I believe the code above is correct and might be something to do with the
submission files.
<?php
if(!class_exists('Submission')) require_once('lib/submission.php');
if(!class_exists('Email')) require_once('lib/email.php');
class ContactForm extends Submission {
public function __construct($params = array()) {
$this->defaults();
// set required and wanted fields
$this->defaults('required', array('name', 'email', 'phone', 'project',
'description', 'budget', 'needs', 'date'));
$this->defaults('keep', array('name', 'email', 'phone', 'project',
'description', 'budget', 'needs', 'date'));
// set the default subject
$this->defaults('subject', 'Oi, Gaylord.');
// take the current URL as the default goto URL
$this->defaults('goto', $_SERVER['REQUEST_URI']);
// set a custom validation event
$this->defaults('validate', function($self) {
// validate the email address
if(!filter_var($self->value('email'), FILTER_VALIDATE_EMAIL))
$self->addInvalid('email');
});
// try to send the email
$this->defaults('submit', function($self) {
$to = $self->option('to');
$from = $self->option('from');
if(!$from) $self->option('from', $to);
// set the email body
$self->option('body', $self->body());
// send the email form, pass all options
$send = email($self->options);
if(error($send)) {
$self->addInvalid('send');
return $self->trigger('error');
}
$self->trigger('success');
});
// redirect to the "goto" url on success
$this->defaults('success', function($self) {
// redirect to callback url
go($self->option('goto'));
});
// merge the defaults with the given options
$this->options($params);
// trigger the request
$this->trigger('request');
}
function body() {
$body = $this->option('body');
if(empty($body)) {
$body = snippet('contact.mail', array(), true);
if(empty($body)) {
$body = 'Name: {name}' . PHP_EOL;
$body .= '----' . PHP_EOL;
$body .= 'Email: {email}' . PHP_EOL;
$body .= '----' . PHP_EOL;
$body .= 'phone: {phone}' . PHP_EOL;
$body .= '----' . PHP_EOL;
$body .= 'project: {project}' . PHP_EOL;
$body .= '----' . PHP_EOL;
$body .= 'description: {description}' . PHP_EOL;
$body .= '----' . PHP_EOL;
$body .= 'budget: {budget}' . PHP_EOL;
$body .= '----' . PHP_EOL;
$body .= 'needs: {needs{}' . PHP_EOL;
$body .= '----' . PHP_EOL;
$body .= 'date: {date}' . PHP_EOL;
}
}
foreach($this->data() as $key => $value) {
$body = str_replace('{' . $key . '}', $value, $body);
}
return trim($body);
}
function htmlBody() {
return nl2br(html($this->body()));
}
}

Simulate cmd+w on windows

Simulate cmd+w on windows

Using autohotkey, I want to simulate hitting cmd+w on a mac. That is, to
close the window.
There's a difference between closing a window (cmd+w) and closing a
program (cmd+q). I have mapped #q to !F4. using
#q::send !{F4}



I tried
#w::WinClose
and
#w::WinKill
without success.

Calculate week of the month a file was last written to PowerShell

Calculate week of the month a file was last written to PowerShell

Is there any way to calculate in what week a file was last written to?
The situation is as follows: I have a lot of Full SQL backup files (.BAK
files), written only on sundays, but... I only need to keep the files
written to in the 4th(or last) week of the month (not only the current
month, but the month in which the file was last written to).
So the search would be something like; check if files are written to in
the last week of the month and delete everything that is not equal to the
last week of the month.
Is there any way I can do this with PowerShell?

Get list of all custom tanonomy id

Get list of all custom tanonomy id

I created a custom taxonomy called Location then added New Jersey, New
York, etc. Is there a Wordpress function that will get the list of all ids
under the Location similar to what get_all_category_ids() does?

Monday, 26 August 2013

A typedef function as a parameter of another function

A typedef function as a parameter of another function

typedef int (xxx)(int yyy); means define a function which named xxx with
an integer parameter. you can see this SO post for details.
I have tried this in different ways, that is my code:
#include<stdio.h>
#include<stdlib.h>
typedef int (xxx)(int yyy);
void f1(xxx a)
{
printf("f1:%d\n",a);
}
void f2(xxx *a)
{
printf("f2:%d\n",a);
}
int test(int y)
{
}
int main()
{
xxx *a;
f1(test);
f1(a);
f2(test);
f2(a);
xxx b;
printf("xxx's size:%d\n", sizeof(b));
}
output:
f1:4199274
f1:2
f2:4199274
f2:2
xxx's size:1
My question:
f(xxx a) is the same as f(xxx *a)?
sizeof(someFunction) is defined or not?

Script to check Flash version isn't really checking version

Script to check Flash version isn't really checking version

I need some help making the following work. It's worked before (with other
software), but in the case of Flash, it isn't. What I'm trying to
accomplish is checking the installed version of Flash. If the installed
version of Flash isn't what I want, I want the script to uninstall the
current version and install my desired version.
:: Check Flash version and install if not matching.
:: Set version to check for.
SET latestVersion=11.5.502.135
SET
key="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe
Flash Player Plugin"
for /f "tokens=3 delims= " %%G in ('reg query %key% /v DisplayVersion
^| findstr /i current') do (
echo %%G
if %%G EQU %latestVersion% goto END
if %%G NEQ %latestVersion% goto Install
)
:INSTALL
:: Kill IE & FF
taskkill /f /im iexplore.exe /im firefox.exe
::Uninstall Flash
\\path-to-server\Flash-FF-11.8.800.94.exe -uninstall
:: Install Flash for Firefox
\\path-to-server\Flash-FF-11.5.502.135.exe -install
:: Install Flash for IE
\\path-to-server\Flash-IE-11.5.502.135.exe -install
:: Kill Flash updating
COPY /y \\path-to-server\mms.cfg C:\WINDOWS\System32\Macromed\Flash\mms.cfg
:END
The problem is that it's not reading the version that's installed. Instead
of echoing something like 11.5.502.135, it's echoing "%G". And since %G
does not equal my desired version (11.5.502.135) it's installing every
time.
So narrowing it down, the following is my problem:
for /f "tokens=3 delims= " %%G in ('reg query %key% /v DisplayVersion
^| findstr /i current') do (
echo %%G
if %%G EQU %latestVersion% goto END
if %%G NEQ %latestVersion% goto Install
)
When typing it out manually, as long as I stop at "DisplayVersion" I get
the info I'm looking for. But once I proceed to the last part of what's
inside the (), that's when I get the errors.
Any help sorting this out would be greatly appreciated.

IE 6 just stops responding

IE 6 just stops responding

our website is working fine in all browsers except in IE 6 when it just
stops responding immediately upon login. Since this version does not have
debugger tool, it is difficult to debug this problem
Here are some pointers
1) did a view source and checked that the code was approximately of 8000
lines
2) we are using jquery v 1.7.1 and there are many references to the use of
.live() method in the javascript code.
If I change .live() to .on() as it is deprecated in v1.7, would that make
any difference or any other thing in mind which would help me analyze the
issue

How to change the default routes in rails scaffolding?

How to change the default routes in rails scaffolding?

When I create the Scaffold in rails, by default it assigns the routes.What
is the steps involved to change the routes.?

Squid proxy MySQL authentication config

Squid proxy MySQL authentication config

I'm wondering to know how to configure squid server with MySQL
authentication. I've found a config example following:
auth_param basic program /usr/local/squid/libexec/squid_db_auth --user
dbusername --password dbuserpassword --plaintext --persist
auth_param basic children 5
auth_param basic realm Web-Proxy
auth_param basic credentialsttl 1 minute
auth_param basic casesensitive off
http://linuxpoison.blogspot.com/2010/08/configuring-squid-server-to.html
And tested on localhost. This worked well. But in my case, MySQL server is
located on another server. So, I need to specify "Hostname" and "Port" of
MySQL server.
Can you help ?
Thanks in advance.

Spreadsheet gear Chart's x axis date is appearing as whole number

Spreadsheet gear Chart's x axis date is appearing as whole number

I am generating an output using spreadsheet gear which contains chart as
output and its XAxis has date and y axis has numbers to plot the chart. At
the end, application will copies the source workbook sheets to new
workbook's spreadsheet. While doing this, the date values in the chart's
XAxis is not appearing as date (MM/dd/yy) in the sheet which i have copied
(i.e. in new workbook's sheet), instead, i am getting it as some number
(such as 39174, 39175, 39176. Could this be a julian date?). Even though i
am formatting the Date column to a Date format (MM/dd/yy), but still it is
not referred as date in the graph. I have cross checked this by right
clicking on a cell (in Date column) and choosing 'format cells' option. It
is showing that it has used custom formatting (as mm/dd/yy) for it. Also,
i have coded to update the links while copying it to a new sheet, but
still it is not working.
Please advise to resolve this issue.
Thanks

Sunday, 25 August 2013

Scrapy: MySQL Pipeline -- Unexpected Errors Encountered

Scrapy: MySQL Pipeline -- Unexpected Errors Encountered

I'm getting a number of errors, depending upon what is being
inserted/updated.
Here is the code for processing the item:
def process_item(self, item, spider):
try:
if 'producer' in item:
self.cursor.execute("""INSERT INTO Producers (title, producer)
VALUES (%s, %s)""", (item['title'], item['producer']))
elif 'actor' in item:
self.cursor.execute("""INSERT INTO Actors (title, actor)
VALUES (%s, %s)""", (item['title'], item['actor']))
elif 'director' in item:
self.cursor.execute("""INSERT INTO Directors (title, director)
VALUES (%s, %s)""", (item['title'], item['director']))
else:
self.cursor.execute("""UPDATE example_movie SET
distributor=%S, rating=%s, genre=%s, budget=%s WHERE
title=%s""", (item['distributor'], item['rating'],
item['genre'], item['budget'], item['title']))
self.conn.commit()
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
return item
Here is an example of the items returned from the scraper:
[{'budget': [u'N/A'], 'distributor': [u'Lorimar'], 'genre': [u'Action'],
'rating': [u'R'],'title': [u'Action Jackson']}, {'actor': u'Craig T.
Nelson', 'title': [u'Action Jackson']}, {'actor': u'Sharon Stone',
'title': [u'Action Jackson']}, {'actor': u'Carl Weathers', 'title':
[u'Action Jackson']}, {'producer': u'Joel Silver', 'title': [u'Action
Jackson']}, {'director': u'Craig R. Baxley', 'title': [u'Action
Jackson']}]
Here are the errors returned:
2013-08-25 23:04:57-0500 [ActorSpider] ERROR: Error processing
{'budget': [u'N/A'],
'distributor': [u'Lorimar'],
'genre': [u'Action'],
'rating': [u'R'],
'title': [u'Action Jackson']}
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/scrapy/middleware.py", line 62,
in _process_chain
return process_chain(self.methods[methodname], obj, *args)
File "/Library/Python/2.7/site-packages/scrapy/utils/defer.py", line 65,
in process_chain
d.callback(input)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/defer.py",
line 361, in callback
self._startRunCallbacks(result)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/defer.py",
line 455, in _startRunCallbacks
self._runCallbacks()
--- <exception caught here> ---
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/defer.py",
line 542, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File
"/Users/fortylashes/Documents/Management_Work/BoxOfficeMojo/BoxOfficeMojo/pipelines.py",
line 53, in process_item
self.cursor.execute("""UPDATE example_movie SET distributor=%S,
rating=%s, genre=%s, budget=%s WHERE title=%s""",
(item['distributor'], item['rating'], item['genre'], item['budget'],
item['title']))
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQLdb/cursors.py",
line 159, in execute
query = query % db.literal(args)
exceptions.ValueError: unsupported format character 'S' (0x53) at index 38
Error 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '), 'Craig T. Nelson')' at line 1
2013-08-25 23:04:57-0500 [ActorSpider] DEBUG: Scraped from <200
http://www.boxofficemojo.com/movies/?id=actionjackson.htm>
{'actor': u'Craig T. Nelson', 'title': [u'Action Jackson']}
Error 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '), 'Sharon Stone')' at line 1
2013-08-25 23:04:57-0500 [ActorSpider] DEBUG: Scraped from <200
http://www.boxofficemojo.com/movies/?id=actionjackson.htm>
{'actor': u'Sharon Stone', 'title': [u'Action Jackson']}
Error 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '), 'Carl Weathers')' at line 1
2013-08-25 23:04:57-0500 [ActorSpider] DEBUG: Scraped from <200
http://www.boxofficemojo.com/movies/?id=actionjackson.htm>
{'actor': u'Carl Weathers', 'title': [u'Action Jackson']}
Error 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '), 'Joel Silver')' at line 1
2013-08-25 23:04:57-0500 [ActorSpider] DEBUG: Scraped from <200
http://www.boxofficemojo.com/movies/?id=actionjackson.htm>
{'producer': u'Joel Silver', 'title': [u'Action Jackson']}
Error 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '), 'Craig R. Baxley')' at line 1
2013-08-25 23:04:57-0500 [ActorSpider] DEBUG: Scraped from <200
http://www.boxofficemojo.com/movies/?id=actionjackson.htm>
{'director': u'Craig R. Baxley', 'title': [u'Action Jackson']}
Apparently there are a lot issues. Thank you for reading! Any and all
suggestions or ideas are greatly appreciated!
::::UPDATE/MORE INFO::::
There appear to be three movies, of the test set of 52 total, which are
being inserted into the the Actors, Producers and Directors tables. Note:
The UPDATE statement isn't working at all.
These movies are: Abraham Lincoln: Vampire Hunter, Ace Ventura: Pet
Detective and Ace Ventura: When Nature Calls
Interestingly, these are all of the movies that have : in the title- I'm
not sure what this means, but if anyone has an idea please share it!

[ Languages ] Open Question : I'm looking for a good language tools/program's to learn Norwegian, can anybody help?

[ Languages ] Open Question : I'm looking for a good language
tools/program's to learn Norwegian, can anybody help?

I know there is questions similar to this one on the site but they are
more than a few years old and some links within the answers don't work
anymore. And I'm struggling to find any useful information.

How do I check if one of two radio buttons is checked with PHP?

How do I check if one of two radio buttons is checked with PHP?

How do I check if one of two radio buttons is checked with PHP?
HTML
<form action="" method="post">
<b>Yes or No?</b><br>
Yes <input type="radio" name="template" value="Yes">
NO <input type="radio" name="template" value="No"><br><br>
<input type="submit" name="send" value="Skicka internlogg">
</form>
I don't want one of this two radio buttons to be checked from the
beginning. I want an if-statement that continue with the code if one of
them are checked by the user. And if not I want to print an error code
like "Please fill the whole form" or something. How?

Calculate the number of times an angle must be repeated for it to complete a full rotation and for it to close

Calculate the number of times an angle must be repeated for it to complete
a full rotation and for it to close

I'm trying to calculate the number of times an angle must be repeated to
make a full rotation and become closed.
Example: The internal angle of a pentagon is 108 degrees and it must
repeat 5 times to complete a rotation and it closes at 540 degrees. It
closes a 540 degrees because that's when all the sides meet and close.
http://www.mathsisfun.com/geometry/interior-angles-polygons.html
How can I calculate these numbers for arbitrary angles like 72 degrees or
117 degrees, etc..
Does anyone know of a way to calculate this
Ps: I'm using matlab/octave thanks

proc_open(): pty pseudo terminal not supported on this system Cent OS6

proc_open(): pty pseudo terminal not supported on this system Cent OS6

I tried to use pty terminal type with PHP proc_open() function but could
not success and got following message:
PHP Warning: proc_open(): pty pseudo terminal not supported on this system
in xxxx.php on line xx
I saw PHP forums and it was raised somewhere in 2006 with Bug #39224 but
not sure why it was not fixed.
If you can give any clue why it was not fixed? Any security or any other
issue? I can see this code is still available in proc_open.c. I'm using
PHP 5.3.3 on CentOS 6.
Any help will be highly appreciated.

Saturday, 24 August 2013

Writing SQL Query for Menu System

Writing SQL Query for Menu System

I am creating a menu system for an application and I am a little stuck on
how to go about creating a database query.
Here is what my Table looks like:

The green rows are "Parent Menus" and the others are children.
I need help writing a TSQL query that sorts the data shown to have the
parent shown and then its children (if any).
Sorting order will be:
Parent then by Children of Parent, then by Order (numerical value).
Here is what my database looks like:

Schema Change Script : Validation and test cases

Schema Change Script : Validation and test cases

I have written a schema change script to remove a certain column C from
Table A to Table B. This is my logic/algorithm,
If Column C does not exist already in Table B, add it.
If column C exists in Table B, update the newly added Column values(which
would initially be null) to the corresponding matching values from Table A
on a condition A.columnZ(Primary_Key) = B.ColumnZ(Foreign_key).
Drop Column C from Table A.
I have written the script for the same( a simple one, though). Now, since
Database changes are highly critical because its going to be run on
Production database and the column contains some values related to Users'
billing information, I want to test them completely before going for
deployment.
I would like to get suggestions for Test-cases to validate the
script.Since, this is the first time we're going to making this scripts,
any other advice on potential problems while making change scripts, would
be appreciated as well.

Java - scan string into array

Java - scan string into array

I'm trying make a Facebook user that can add friends into the array that
already has 5 existing friends, so the new added friends will continue
after the 5, and the size of the array is set to 200. I'm having trouble
with putting scanned information into array, as I can only preset the
information other than scanning in.
private void initializeFriends() {
//initialize the size of array:
friends = new Friend[200];
//initialize the first 5 objects(Friends):
friends[0] = new Friend("Rodney Jessep", "rj2013", "Brisbane", "hi!");
friends[1] = new Friend("Jaime Smiths", "abcd5432", "Sydney",
"how's going");
friends[2] = new Friend("William Arnold", "william1994",
"Brisbane", "boom");
friends[3] = new Friend("James Keating", "qwerty52", "Newcastle",
"Hey");
friends[4] = new Friend("Amy Richington", "IAmRichAmy", "Perth",
"Yo"); }
so after the procedure above I'm going to add a method called
addFriends(), that's where the scanner come in to put in data, but how do
I write the code after
Scanner in = new Scanner(System.in);
Especially with all the different elements stored in a friend (String
name, String username, String city, String message)?

Allowing user to reorder lined up images on HTML page

Allowing user to reorder lined up images on HTML page

I would like to allow a user to reorder lined up images on an HTML page
like this one:
http://www.blakearchive.org/exist/blake/archive/comparison.xq?selection=compare&copies=all&bentleynum=B1&copyid=urizen.f&java=bb136.B1
Basically, I want to make it so that you can click and drag one image next
to another. Can anyone suggest any ways to do this or any image gallery
scripts that already do this?
Thanks.

Handle collisions in separate class

Handle collisions in separate class

I am currently coding for the Ludum Dare I need to be able to handle
collisions from a top-down perspective. I know how to handle them
normally, but I am going to be including a lot of things that can be run
into, so I would like to handle collisions from a bool return in a
separate class. The way I would do it is give the function the input
rectangle for the player collision box and then store all of the
collisions in the function. However if I do it that way then I will have
to check every single time I move if I run into something. Is there a
better way to do this?

SQL conditional inserts, and other multiple queries done in a atomic/all or nothing/non interleaved way

SQL conditional inserts, and other multiple queries done in a atomic/all
or nothing/non interleaved way

Let's say i have an application relying on a SQL 'users' table and want to
avoid multiple users with the same name:
When I insert a new user in my table, I must make sure that there is no
similar rows already. So that is 2 queries, the second one only happening
if the first one returned nothing:
-query1: select * from users where username='Marie-Antoinette'
-query2: insert into users ('','Marie-Antoinette','37')
Multiple applications instances access the shared database simultaneously,
how do I make sure that no query is inserted between query1 and query2?
That it is done as an atomic operation in the DB with nothing in between?



There may be a way, a syntax to do conditional inserts but my question is
more about "how to make sure i can make N queries with the guarantee that
no queries from other clients will be interleaved in my batch"?
Let's say I have, in my application, an operation that requires 4 queries:
my operation consists of:
-query1: insert stuff in table 1
-query2: select stuff from table 2
-query3: insert stuff in table 3
-query4: update stuff in table 4
Those should be considered as an atomic operation, it's all or nothing,
but not only that, during that sequence, there must be the guarantee that
there won't be anything interleaved (since between those queries the
database has no integrity, and that those 4 tables must be frozen while
this operation happens) and that multiple clients can trigger that
operation and that the multiple calls will be somehow queued rather than
failing.
over time, that would be:
-client #1 query 1
-client #1 query 2
-client #1 query 3
-client #1 query 4
-client #2 query 1
-client #2 query 2
-client #2 query 3
-client #2 query 4
-client #1 query 1
-client #1 query 2
-client #1 query 3
-client #1 query 4
What is the recommended approach to achieve that?

Multisite domain mapping on wordpress not create sub domain ?

Multisite domain mapping on wordpress not create sub domain ?

We create MultiSite with the help of WordPress MU Domain Mapping plugin in
wordpress.
We setup my localhost as virtual host like example.com then create network
admin Dashboard and install WordPress MU Domain Mapping and setup the
Domain Mapping Configuration assign the server IP Address for localhost
127.0.0.1 and server CNAME domain as Blank.In Domain Mapping: setup
provide Site ID which i create in site name test and Domain name like
test.example.com then save it. After logout with admin and login with test
user and when go on test user Dashboard go on my site option there show
test.example.com and click on dashboard url open test.example.com but show
like its Sorry, the website test.example.com cannot be found.
So please can any one help mi out i stock at that problem from last 3 days
. I want create this setup on localhost.
Thanks Advance !

Friday, 23 August 2013

show streetview in infowindow

show streetview in infowindow

I'm trying to get a streetview to show in an infowindow. I had this
working in the v2 API but that method (setTimeout) did not work for me in
v3, so I am trying to use the addListener method to show the panorama. The
error I am getting is a null reference when I try to pass the div I wish
to show the streetview in. I found a couple of questions on here that
seemed on point but I don't see what they were doing differntly - both
examples used the infowindow domready event which is what I am using also.
Here is my code.
var map;
function initialize()
{
var lat = document.getElementById("Lat").value;
var lon = document.getElementById("Lon").value;
var latlon = new google.maps.LatLng(parseFloat(lat), parseFloat(lon));
var mapOptions = {
center: latlon,
zoom: 15,
streetViewControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
var sv = new google.maps.StreetViewService();
sv.getPanoramaByLocation(latlon, 50, showShopInfo);
}
function showShopInfo(panoData, status)
{
var streetview;
var dirName = document.getElementById("Directory").value;
var zipSearch = document.getElementById("ZipCodeSearch").value;
var valID = document.getElementById("ShopValID").value;
var shopInfo;
if(status == google.maps.StreetViewStatus.OK)
{
// Got street view!
streetview = true;
shopInfo = "<div id='shopInfo'><table border='0'><tr><td
height='200'>";
shopInfo = shopInfo + "<div id='svMini' style='height: 200px;
width: 200px;'></div></td></tr>";
shopInfo = shopInfo + "<tr><td><br /><b><a
href='ShopProfileBU.asp?ValidationID=" + valID + "&DirectoryName="
+ dirName + "&ZipCodeSearch=" + zipSearch + "' title='Shop
Profile'>";
shopInfo = shopInfo + document.getElementById("ShopName").value +
"</b><br /></a>";
shopInfo = shopInfo + document.getElementById("Address").value +
"<br />";
shopInfo = shopInfo + document.getElementById("City").value + ", ";
shopInfo = shopInfo + document.getElementById("State").value + " ";
shopInfo = shopInfo + document.getElementById("ZipCode").value +
"<br /><br />";
shopInfo = shopInfo + "<b>" +
document.getElementById("Phone").value +
"</b></td></tr></table></div>";
}
else
{
// No street view available
streetview = false;
shopInfo = "<br /><b><a href='ShopProfileBU.asp?ValidationID=" +
valID + "&DirectoryName=" + dirName + "&ZipCodeSearch=" +
zipSearch + "' title='Shop Profile'>";
shopInfo = shopInfo + document.getElementById("ShopName").value +
"</b><br /></a>";
shopInfo = shopInfo + document.getElementById("Address").value +
"<br />";
shopInfo = shopInfo + document.getElementById("City").value + ", ";
shopInfo = shopInfo + document.getElementById("State").value + " ";
shopInfo = shopInfo + document.getElementById("ZipCode").value +
"<br /><br />";
shopInfo = shopInfo + "<b>" +
document.getElementById("Phone").value + "</b>";
}
var infowindow = new google.maps.InfoWindow({
content: shopInfo,
position: map.getCenter()
});
infowindow.open(map);
if(streetview)
google.maps.event.addListener(infowindow, 'domready',
showPanoMini(panoData.location.latLng.lat(),
panoData.location.latLng.lng()));
}
function showPanoMini(pLat, pLon)
{
var panoLat = parseFloat(document.getElementById("PanoLat").value);
var panoLon = parseFloat(document.getElementById("PanoLon").value);
var panoYaw = parseFloat(document.getElementById("PanoYaw").value);
var panoPitch = parseFloat(document.getElementById("PanoPitch").value);
var panoZoom = parseFloat(document.getElementById("PanoZoom").value);
var panoLatLon;
if(panoLat==0 && panoLon==0)
panoLatLon = new google.maps.LatLng(pLat, pLon);
else
panoLatLon = new google.maps.LatLng(parseFloat(panoLat),
parseFloat(panoLon));
var panoPOV = {
heading: parseFloat(panoYaw),
pitch: parseFloat(panoPitch)
};
var panoOptions = {
position: panoLatLon,
pov: panoPOV,
addressControl: false,
linksControl: false,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL
},
visible: true
};
var panorama = new
google.maps.StreetViewPanorama(document.getElementById("svMini"),
panoOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
This is the function I was using in v2 to display the streetview.
setTimeout(showPanoMini(pLat, pLon), 1000);

Treat MOD files as MPG files on MAC

Treat MOD files as MPG files on MAC

When I try to open a MOD file on Mac it says
The document "MOV041.MOD" could not be opened.
QuickTime Player cannot open files of this type.
So then I rename it to MPG and it opens fine. Is there any way to change
the Mac so that the rename is not necessary?

configuration system failed to initialize app.config .NET 3.5

configuration system failed to initialize app.config .NET 3.5

I have a WPF application that uses app.config. I set the app.config file
as described in Read/Write App.Config File with .NET 2.0 so it looks like
this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
<file value="BDViewerLog.txt"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="5"/>
<maximumFileSize value="10MB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger -
%message%newline"/>
</layout>
</appender>
<startup><supportedRuntime version="v2.0.50727"
sku="Client"/></startup><system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Service1Soap" closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
<binding name="Service1Soap1" closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:9139/Service.asmx"
binding="basicHttpBinding"
bindingConfiguration="Service1Soap"
contract="ServiceReferenceBDV.Service1Soap"
name="Service1Soap" />
<endpoint address="http://localhost:9139/Service1.asmx"
binding="basicHttpBinding"
bindingConfiguration="Service1Soap1"
contract="ServiceReference1.Service1Soap"
name="Service1Soap1" />
</client>
</system.serviceModel>
<appSettings>
<add key="Path1" value="C:\files\Accounts.txt"/>
<add key="PathMD5" value="C:\files\md5Accounts.txt"/>
<add key ="LogUserActions" value="C:\files\Log.txt"/>
</appSettings>
</configuration>
in c# code: string path = ConfigurationManager.AppSettings["PathAccounts"];
I need to read the paths to files in node but I keep getting the error
Configuration system failed to initialize. I looked for a solution in
similar topics but none applied to my case. I checked the file multiple
times, couldn't find an error. I also tried deleting all filed from
\Debug, \Obj and cleaning and rebuilding the solution but nothing worked.
I don't know what more to do.

Populating Bash array fails

Populating Bash array fails

Here is a simple command I am running in bash, but the array won;t get
populated for some reason.
array=() && sudo iwlist wlan0 scan | grep 'Address'| while read line; do
array[${#array[@]}]=$line; done
I have also tried to populate the array this way:
array=()
sudo iwlist wlan0 scan | grep 'Address'| while read line; do
array+=($line); done
but it gives me the same result. I know it works because when i do this:
sudo iwlist wlan0 scan | grep 'Address'| while read line; do "echo $line";
done
it will print every line that is piped from grep to the while loop.
When I check the size of the array " echo ${#array[@] " it will show 0 and
if I print the array it obviously prints nothing. Do you see any errors in
the line?

How to efficiently retrieve data via WMI

How to efficiently retrieve data via WMI

I'm working on application which connects to remote hosts and retrieve the
metrics like CPU utilization, RAM usage, Disk load, ... In order to
connect remotely and retrieve such metrics I use Windows Management
Instrumentation (WMI). I create WQL query for each metric. For example, to
access 4 types metrics I use 4 different WQL queries and this lead to some
delays in whole monitoring process. My question is that, is there any way
to use only one WQL (i.e. use only 1 remote connection attempt) and then
retrieve the necessary data (metrics) from the result of that WQL query?
I'm looking forward to your replies. Thanks.

SQL executing stored procedure in INSERT statement

SQL executing stored procedure in INSERT statement

I'm strugling with this task: I need a stored procedure that takes a table
parameter of type DeviceKeywordType and two DATETIME parameters and
returns table of type DeviceKeywordCountType.
DeviceKeywordType declaration:
CREATE TYPE DeviceKeywordType
AS TABLE
(
DeviceID INT,
KeywordID INT
)
DeviceKeywordCountType declaration:
CREATE TYPE DeviceKeywordCountType
AS TABLE
(
DeviceID INT,
KeywordID INT,
[Count] INT
)
The stored procedure so far:
CREATE PROCEDURE GetKeywordsDevicesTable @Input DeviceKeywordType
READONLY, @Start DATETIME = '1900-01-01', @End DATETIME = '9000-12-30'
AS
BEGIN
SET NOCOUNT ON
DECLARE @Ret DeviceKeywordCountType
INSERT INTO @Ret (DeviceID, KeywordID, [Count])
SELECT DeviceID, KeywordID, (EXEC Keyword_GetCountForDeviceByID
DeviceID, KeywordID, @Start, @End)
FROM @Input
SELECT * FROM @Ret
END
The point is that I need to take all the pairs from the input table and
calculate something with the Keyword_GetCountForDeviceByID procedure and
save it to the output table. I konw that the SELECT statement is
syntactically wrong but I don't know what is the correct way. Can this be
done like that or is my approach wrong?

Thursday, 22 August 2013

how to extract the key from the log in python

how to extract the key from the log in python

i write the python code ,in order to extract key from the log.And using
the same log,it worked well in one machine.But when i run it in hadoop,it
failed.I guess there are some bugs when using regex.Who can give me some
comments?Is regex can't support hadoop?
This python code is aim to extract qry and rc ,and count the value of rc
,and then print it as qry query_count rc_count .When run it in hadoop,it
report
java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess
failed with code 1.
I search google,there may some bug in your mapper code.So how can i fix it?
log formats like that,
NOTICE: 01-03 23:57:23: [a.cpp][b][222] show_ver=11 sid=ae1d esid=6WVj
uid=D1 a=20 qry=cars qid0=293 loc_src=4 phn=0 mid=0 wvar=c op=0 qry_src=0
op_type=1 src=110|120|111 at=60942 rc=3|1|1 discount=20 indv_type=0
rep_query=
And my python code is that
import sys
import re
for line in sys.stdin:
count_result = 0
line = line.strip()
match=re.search('.*qry=(.*?)qid0.*rc=(.*?)discount',line).groups()
if (len(match)<2):
continue
counts_tmp = match[1].strip()
counts=counts_tmp.split('|')
for count in counts:
if count.isdigit():
count_result += int(count)
key_tmp = match[0].strip()
if key_tmp.strip():
key = key_tmp.split('\t')
key = ' '.join(key)
print '%s\t%s\t%s' %(key,1,count_result)

Verification that a vector space (specified below) is a direct sum of two subspaces (This is a question from Axler's "Linear Algebra Done...

Verification that a vector space (specified below) is a direct sum of two
subspaces (This is a question from Axler's "Linear Algebra Done...

I'm working through Axler's "Linear Algebra Done Right". On page 15, it
gives this example:
Consider the vector space $P(F)$ of all polynomials with coefficients in
$F$ (ie., coefficients taken from the real numbers or complex numbers).
Let $U_e$ denote the subspace of $P(F)$ consisting of all polynomials $p$
of the form: $$p(z) = a_0 + (a_2)z^2 + ... (a_2m)z^{2m}$$ and let $U_0$
denote the subspace of all polynomials $p$ of the form: $$p(z) = (a_1)z +
(a_3)z^3 + ... + (a_{2m+1})z^{2m+1};$$ $m$ is a nonnegative integer and
the coefficients are from the reals (to keep things simple).
Next, it says I should verify that $P(F)$ is a direct sum of $U_e \oplus
U_0$.
Well, to do this I wanted to use a theorem that occurs a few pages later,
namely:
if $U_1 ... U_n$ are subspaces of $V$. Then $V$ is a direct sum of $U_1
... U_n$ iff:
a. $V = U_1 + ... U_n$
b. the only way to write $0$ as a sum $u_1 + ... + u_n$, where each $u_j$
is in $U_j$, is by taking all the $u_j$ in $U_j$, is by taking all the
$u_j$'s equal to $0$.
I wanted to use this theorem to show $P(F)$ is a direct sum of $U_e \oplus
U_0$. (a) -- from the above theorem -- is clearly satisfied. What has me
stumped in part (b). It seems to me that that are multiple ways to write
the $0$ for the sum of $u_e + u_0$, $u_e \in U_e$, $u_0 \in U_0$. One way
to get $0$ is make each coefficient $0$. Or you could make sure that each
entry from $U_e$ is paired off with the corresponding entry from $U_0$,
and that together they add up to $0$. When $U_e$ and $U_0$ are added
together, this would give a $0$ too.
But this can't be right b/c then $P(F)$ would not be a direct sum of $U_e$
and $U_0$.
Any help?

How to suppress Warning--empty author Message?

How to suppress Warning--empty author Message?

I am citing the IEEE-754 standard and it doesn't have an author. However,
when I generate my PDF, the tool I am using (texnixcenter) provides a
warning that there is no author. I would like to know how to get rid of
this warning?
Here is the IEEE-754 standard bibtex entry that I have:
@ARTICLE{ieee754std,
journal={IEEE Std 754-2008},
title={{IEEE Standard for Floating-Point Arithmetic}},
year={2008},
pages={1-70},
keywords={IEEE standards;floating point arithmetic;programming;IEEE
standard;arithmetic formats;computer programming;decimal floating-point
arithmetic;754-2008;NaN;arithmetic;binary;computer;decimal;exponent;floating-point;format;interchange;number;rounding;significand;subnormal},
doi={10.1109/IEEESTD.2008.4610935},}

Small angular displacements with a quaternion representation

Small angular displacements with a quaternion representation

I have the orientation of a 3D spatial object represented by a unit
quaternion:
$$ q = a_1 + a_2 i + a_3 j + a_4 k $$ $$ \|q\| = (a_1^2 + a_2^2 + a_3^2 +
a_4^2)^{1/2} = 1 $$
I'd like to perturb this orientation slightly. If this displacment is
small, I think I can get away with
$$ q'_2 = q + \Delta (u_1 + u_2 i + u_3 j + u_4 k) $$
where $\Delta << 1$ and the $u$ are uniform random numbers in the range of
$[-1,1]$. $q'_2$ is obviously not a unit quaternion anymore so I would
normalize it by
$$ q_2 = \frac{q'_2}{\|q'_2\|} $$
As $\Delta$ gets larger, I feel that this will become an increasingly
worse approximation. Is there a better way to get a random orientational
displacement?

Maintain item maintenance for a items in a class created by developer using subclass per item

Maintain item maintenance for a items in a class created by developer
using subclass per item

If anyone has an idea, I couldn't think of a better way to phase the
question.
I'll try to not make this to complicated an explination.
I'm writing a "quotes" class that is the main class. This class has
"overall" functions that preform calculations based on "items" stored in
its array. Suffice it to say, the end-developer will call it as $q = new
apiQuote/quote().
Then, before it's of any use, the first item must be added and it's
properties set so it can do it's "own" calculations. Something like
$q->createItem(). Once the item is created with this call, an "item" of
the class "item" is added to an array in "quotes" named "items".
The currently editable item, $q->item is always the last one added to the
array via the createItem method. Which looks like:
public function createNewItem() {
$this->items[] = new item();
$this->item = $this->items[count($this->items)-1];
}
I was looking to add an editItem method, whereby the parameter would be an
integer representing item index in the array and would set $q->item to the
latest item. Thus far, while I'll test it in a minute, as far as I can
think, this should work, however, I'd like a better way.
What I'm curious about, is if anyone has any suggestions on a better way
to go about this. I tried looking for a "cards/deck" php example, but all
I could find was array shuffles, which is kinda useless here. I know how
to do such associations in .NET and thought this would be just as easy,
but I don't have the same property abilities in PHP that I have in a .NET
language, thus negating what I'm used to in created this kind of
"class/subclass[items]" type structure.
Really I would just like to know if anyone has done anything similar and
if I'm doing things to the "best of ability" or if there might be a better
way, via PHP, to allow an "end-developer" to call on one main class and
create a list "items" based on a subclass that can later be used for
methods of the main class?
I really hope this sums it all up well and I havn't gone outside the
guidelines of "question asking" here, but I can't think of a better place,
other than maybe Code Review to pose such a question and get great
developer feed back. If y'all feel I need move it to Code Review, let me
know. My main reason for choosing this over CR is this site tends to get
faster responses.

VB.net Getting the InnerText of href using HtmlAgilityPack

VB.net Getting the InnerText of href using HtmlAgilityPack

I have written a code in VB.net.
The expected output of my program would be a list of extracted links that
are inside the
In my program i want to display all links that contains the word "test".
For example:
www.drivetest.ca/
www.drivetest.ca/EN/bookatest/Pages/Road-Test-Booking.aspx
www.drivetest.ca/EN/drivereducation/Pages/Driver-Testing.aspx
www.cic.gc.ca/english/citizenship/cit-test.asp
But my program is not displaying anything at all. Where did i go wrong?
Here is my code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Dim webClient As New System.Net.WebClient
Dim WebSource As String =
webClient.DownloadString("http://www.google.com.ph/search?hl=en&as_q=test&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=countryCA&as_qdr=all&as_sitesearch=&as_occt=any&safe=images&tbs=ctr%3AcountryCA&as_filetype=&as_rights=#as_qdr=all&cr=countryCA&fp=1e63a873f2e9c884&hl=en&lr=&q=test&start=20&tbs=ctr:countryCA")
RichTextBox1.Text = WebSource
Dim links As New List(Of String)()
Dim htmlDoc As New HtmlAgilityPack.HtmlDocument()
htmlDoc.LoadHtml(WebSource)
For Each link As HtmlNode In
htmlDoc.DocumentNode.SelectNodes("//a[@href]")
If link.InnerText.Contains("test") Then
ListBox1.Items.Add(link.InnerText)
End If
Next
End Sub
I am currently new to this HtmlAgilityPack, I am still learning please
bear with me.

Wednesday, 21 August 2013

How do I use values_at in a before_save method?

How do I use values_at in a before_save method?

I'm trying to pass the year, month, and date from :date to :start_time but
I'm getting the following error: undefined method `values_at'. I think I
don't have the syntax quite right in my method:
def set_start_time_date
self.start_time = date.values_at( :year, :month, :day )
return true
end
before_save :set_start_time_date
What's the correct way to do this?

How to open PIL Image in Tkinter on Canvas

How to open PIL Image in Tkinter on Canvas

I can't seem to get my PIL Image to work on canvas. Code:
from Tkinter import*
import Image, ImageTk
root = Tk()
root.geometry('1000x1000')
canvas = Canvas(root,width=999,height=999)
canvas.pack()
image = ImageTk.PhotoImage("ball.gif")
imagesprite = canvas.create_image(400,400,image=image)
root.mainloop()
Error:
Traceback (most recent call last):
File "C:/Users/Mark Malkin/Desktop/3d Graphics Testing/afdds.py", line
7, in <module>
image = ImageTk.PhotoImage("ball.gif")
File "C:\Python27\lib\site-packages\PIL\ImageTk.py", line 109, in __init__
mode = Image.getmodebase(mode)
File "C:\Python27\lib\site-packages\PIL\Image.py", line 245, in getmodebase
return ImageMode.getmode(mode).basemode
File "C:\Python27\lib\site-packages\PIL\ImageMode.py", line 50, in getmode
return _modes[mode]
KeyError: 'ball.gif'
I need to use PIL images not PhotoImages because I want to resize my
images. Please don't suggest switching to pygame because I want to use
Tkinter.

Why does default-initialization of reference type member result in compiler warning?

Why does default-initialization of reference type member result in
compiler warning?

I have the following code:
class A {
public:
A() { }
};
class B {
private:
const A &a;
public:
B() : a() { }
B(const A &ina) : a(ina) { }
};
Compiling results in the following:
ab.cpp: In constructor 'B::B()':
ab.cpp:11: warning: default-initialization of 'const A& B::a', which has
reference type
Why does this result in a warning and how do I fix it?

Show div when link is clicked below

Show div when link is clicked below

I need a way to create a dropdown. That shows a table above when a link is
clicked below.
My HTML
<div id="container">
<table id="supposeToBeHidden">
some content
</table>
<a href="#" id="btnToClickToShowTable">Click me</a>
</div>
It would be cool if the solution was in pure css, but not a must.

Can I leave some sections unparsed using NSXMLParser?

Can I leave some sections unparsed using NSXMLParser?

I have an XML document which I want to parse using NSXMLParser. One of the
tags it can contain is <html>, and in my parsed representation I want the
contents of that tag, verbatim. However, when I parse the document, my
delegate methods are called for the start, end and contents of each tag
inside the html tag.
I can't get the provider of the document to add CDATA tags; nor can I use
something other than NSXMLParser to parse the document.
Is there a way for me to tell the parser to treat the contents of HTML
tags as text and to leave them unparsed, even if they contain other tags?

Titanium iPhone store variable value in shared preference

Titanium iPhone store variable value in shared preference

I am new on titanium and iPhone development, i want to know how to store
value of variable in share preference and get that value on another js?

Tuesday, 20 August 2013

Handling dynamic column numbler in xsl fo

Handling dynamic column numbler in xsl fo

How do I create table with dynamic number of columns with xsl fo. The
number of columns varies with each input file but fixed for a single input
file.
Here is a sample xml
<root>
<ColNo>3</ColNo>
<Objects>
<object id= 1>
<prop1 old=5 new=7>
<prop2 old=2 new=1>
<prop3 old=3 new=6>
</object>
</Objects>
</root>
I want a table with like below
Obj1
------------------------------------------
prop1 | prop2 | prop3
-------------------------------------------
old | new | old | new | old | new
-------------------------------------------
5 | 7 | 2 | 1 | 3 | 6
I came across to number-columns-repeated properties.. But unable to
understand how to use it..
Also let me if there is any better approach.
Thanks.

Convert string[] to int

Convert string[] to int

I have an array of integers in string form.
string [] TriangleSideLengths
In this array there is going to be 3 int values which represent side
length of a triangle. Is there a way from which I can extract individual
all 3 values from my array TriangleSideLengths into three int objects like
int intSideLengthOne,intSideLengthTwo and intSideLengthThree.
I want to be able to test if these three values actually form a valid
triangle?
For instance, entering lengths 10, 10, 100000 wouldn't make it a valid
isosceles triangle.
I wanna be able to do this check with the three values stored in my array
TriangleSideLengths.
a + b > c
a + c > b
b + c > a
Any help is greatly appreciated. Thanks a lot!! :)

Progressbar on file-upload to Amazon S3 for iOS?

Progressbar on file-upload to Amazon S3 for iOS?

I was using the services from Parse a while back, and they had implemented
an amazing feature for uploading data, with a method something like this:
PFFile *objectToSave...; //An image or whatever, wrapped in a Parse-file
[objectToSave saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
//Do stuff after upload is complete
} progressBlock:^(int percentDone) {
[someLabel setText:[NSString stringWithFormat:@"%i%@",
percentDone, @"%"]];
}];
Which let me keep track of the file-upload. Since Parse only let me upload
max 10mb files, I chose to move to the cloud-area to explore a bit. I've
been testing with Amazon's S3-service now, but the only way I can find how
to upload data is by calling [s3 putObject:request];. This will occupy the
main thread until it's done, unless I run it on another thread. Either
way, I have no idea of letting my users know how far the upload has come.
Is there seriously no way of doing this? I read that some
browser-API-version of S3's service had to use Flash, or set all uploads
to go through another server, and keep track on that server, but I won't
do either of those. Anyone? Thanks.
My users are supposed to be uploading video with sizes up to 15mb, do I
have to let them stare at a spinning wheel for an unknown amount of time?
With a bad connection, they might have to wait for 15 minutes, but they
would stare at the screen in hope the entire time.

SQL Query Into Delimited String In Stored Procedure

SQL Query Into Delimited String In Stored Procedure

I have the table:
CREATE TABLE [address_tabletype] (
[CONTROL_NUMBER] [varchar](12) NULL,
[ADDRESS1] [varchar](50) NULL,
[ADDRESS2] [varchar](50) NULL,
[CITY] [varchar](50) NULL,
[STATE] [varchar](2) NULL,
[ZIP] [varchar](10) NULL
)
GO
and, say I have the following rows:
2506387 1 2 3 4 5
2506394 1 2 3 4 5
2506403 1 2 3 4 5
I would like to to look like:
2506387|1|2|3|4|5~2506394|1|2|3|4|5~2506403|1|2|3|4|5
I haven't tried anything because I honestly have no idea where to start.
I am using SQL Server 2008 R2, and will be using a temp table to build
this string.
Thank you.

Confusion with possessives

Confusion with possessives

We have a choir in the town of Ako called Ako International Students
Choir. The choir is directed in English and is indeed international, but
by no means limited to International Students.
I am confused to where the possessive should lay in the name. Should it be:
Ako's International Students Choir
Or
Ako International Students' Choir
I want the emphasis to be Ako International Students Choir, more than Ako
International Students Choir or even Ako International Students Choir.

Catching Microsoft Access ODBC connection errors to SQL Server linked tables

Catching Microsoft Access ODBC connection errors to SQL Server linked tables

I have a little Access application with linked tables to SQL Server that I
use at a couple different sites so the SQL server names and sometimes the
SQL database and odbc connection names are different from site to site.
However they use the Access Runtime to use it so don't have the ability to
relink tables without the full version. I'm struggling to find a way to
catch any ODBC connection errors and then offering them the option to
relink the tables by typing in the ODBC connection name etc. and then
relinking through VBA code which I believe is possible.
(http://www.access-programmers.co.uk/forums/showthread.php?t=143180 for
example)
The database loads immediately on a form with a record source on a linked
table so it needs to catch the error on that form if possible. I guess I
can add a main menu with a button to relink tables there but would prefer
avoiding introducing a menu form which requires an extra click for users.
Have found these articles but I'm unable to catch the initial odbc failure
to connect in the form's On Error event and have tried the Activate event
as well. Any suggestions would be highly appreciated!
http://support.microsoft.com/kb/209855
http://www.access-programmers.co.uk/forums/showthread.php?t=198039

google SQL Parser edit item before Creation

google SQL Parser edit item before Creation

I am using the sql query parser from google to retrieve a query which i
want to inspect for the tablename. After inspecting, i want to edit the
tablename and use the query parser' function to create the query with the
new tablename.
$parser = new PHPSQLParser();
$creator = new PHPSQLCreator();
$parsed = $parser->parse("SELECT * FROM _originalTableName WHERE ID = 15");
$parsed['FROM'][0]['table'] = '_newTableName';
echo $creator->create($parser->parsed);
But my newly created query is always identical with the original. What am
i doing wrong?
Output always:
SELECT * FROM _originalTableName WHERE ID = 15

Monday, 19 August 2013

tallpdf.net background color

tallpdf.net background color

I cant seem to figure out how to add a background color to a cell for my
pdf document. I am using an xsl template to transform my xml.
If I cant do this directly, has anybody got any ideas on how to do it?
e.g. adding a thick black border etc.
I am trying to replicate this functionality, it is very basic for a pdf
document.
<html>
<body>
<table >
<thead>
<tr>
<th bgcolor="black"><font color="white">Header 1</font></th>
<th bgcolor="black"><font color="white">Header 2</font></th>
<th bgcolor="black"><font color="white">Header 3</font></th>
</tr>
</thead>
</table>
</body>
I am trying to get the fragment with the text "Job Work Order" to have a
black background with white text.
<paragraph type="table" preferredwidth="180mm">
<row >
<cell preferredwidth="70mm" fixed="true">
<paragraph type="textparagraph" spacingbefore="24"
leftindentation="5" rightindentation="2"
horizontalalignment="left">
<fragment fontsize="16">Job Work Order</fragment>
</paragraph>
</cell>
</row>
Thank you.

Palindrome in String C++

Palindrome in String C++

It's my code to find palindrome in string ,But it ain't a good piece.How
can I optimize this code or is there any efficient algorithm for this type
of problems.(Palindrome in Strings)..And I think for some cases it is also
not giving me correct output.Thanks for the help

Part of my MVC appplication is not working when deployed live

Part of my MVC appplication is not working when deployed live

This is the first time I am deploying MVC web application in Amazon S3
server. And website is been loaded in browser but when I click on register
button it is throwing error. I can see only difference is My application
is named as reporting.e-tale.co.uk and Domain is set up as
dashboard.e-tale.co.uk, so I made a folder in live as
dashboard.e-tale.co.uk and copied my files. It is working fine in local
dont know the reason why it is throwing error.
Please correct me If I am doing any thing wrong. I am not sure what
details to provide. I will provide you more details if it is difficult to
suggest solution. Thanks
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.] reporting.e_tale.co.uk.Controllers.AccountController.Register()
+255 lambda_method(Closure , ControllerBase , Object[] ) +78
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary2 parameters) +263
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary2
parameters) +38 System.Web.Mvc.<>c_DisplayClass15.b_12() +128
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter, ActionExecutingContext preContext, Func1 continuation) +826106
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter, ActionExecutingContext preContext, Func1 continuation) +826106
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter, ActionExecutingContext preContext, Func1 continuation) +826106
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext
controllerContext, IList1 filters, ActionDescriptor actionDescriptor,
IDictionary`2 parameters) +314
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext
controllerContext, String actionName) +825328
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.<>c_DisplayClassb.b_5() +62
System.Web.Mvc.Async.<>c_DisplayClass1.b_0() +20
System.Web.Mvc.<>c_DisplayClasse.b_d() +54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+469 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +375
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.0.30319.1008
Account controller (Register)
/// <summary>
/// GET: /Account/Register
/// Action account Register.
/// </summary>
/// <returns></returns>
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Register()
{
var myViewData = new RegisterForm
{
Person = new Person
{
CreatedAt = DateTime.Now,
AppellationId =
_appellationRepository.GetAppellationByDescription(
"Mr").Id,
CountryId =
_countryRepository.GetCountryByName(
"United Kingdom").Id,
CorporationId = _corporationRepository.GetCorporationByName(
"Samsung").Id
//ManufacturerId =
_manufacturerRepository.GetManufacturerByName(
//"Samsung").Id
},
User =
new User
{
CreatedAt = DateTime.Now,
Guid = Guid.NewGuid().ToString("N")
}
};
myViewData.Appellations = new
SelectList(_appellationRepository.GetAllAppellations().ToList(),
"Id",
"Description",
myViewData.Person.AppellationId);
myViewData.Countries = new
SelectList(_countryRepository.GetAllCountries().ToList(), "Id",
"Name",
myViewData.Person.CountryId);
myViewData.Corporations = new
SelectList(_corporationRepository.GetAllcorporations().ToList(),
"Id",
"Description",
myViewData.Person.CorporationId);
//myViewData.Manufacturers = new
SelectList(_manufacturerRepository.GetAllManufacturers().ToList(),"Id",
// "Description",myViewData.Person.ManufacturerId);
myViewData.PasswordLength = MembershipService.MinPasswordLength;
return View(myViewData);
}
New error:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: CS1973: 'System.Web.Mvc.HtmlHelper' has no
applicable method named 'DropDownList' but appears to have an extension
method by that name. Extension methods cannot be dynamically dispatched.
Consider casting the dynamic arguments or calling the extension method
without the extension method syntax.
Source Error:
Line 36:
Line 37: Organisation: Line 38: <%=
Html.DropDownList("CorporationId",Model.Corporations ,"Select a
Organisation", new { style = "width:300px;" }) %> Line 39: <%=
Html.ValidationMessage("CorporationId","") %> Line 40:
Source File:
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx
Line: 38
Show Detailed Compiler Output:
c:\windows\system32\inetsrv>
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe" /t:library
/utf8output
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Entity\v4.0_4.0.0.0__b77a5c561934e089\System.Web.Entity.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\9bffa507\ecfa05ff_7f84ce01\Ninject.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Routing\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Routing.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Extensions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Extensions.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Web.Infrastructure\v4.0_1.0.0.0__31bf3856ad364e35\Microsoft.Web.Infrastructure.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\fa1c4541\691e1dc2_2c9dce01\reporting.e-tale.co.uk.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\b1cf1017\20c887dd_168ace01\LINQtoCSV.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\App_global.asax.hi7xmese.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Deployment\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Deployment.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\App_Web_wihtg4s5.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Entity\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Entity.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Abstractions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Abstractions.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\2cff320f\d88520b4_9d83ce01\System.Web.Providers.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Helpers\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.Helpers.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\2ac68fe3\1344fffe_7f84ce01\EPPlus.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Razor\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.Razor.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\6d6213bd\1007e7b2_2c9dce01\EmsAdmin.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\235bf7dd\70de8fdd_168ace01\Memcached.ClientLibrary.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Mvc\v4.0_3.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\b3a40b38\891005ff_7f84ce01\Newtonsoft.Json.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\fdcdf28b\938c1f66_8084ce01\log4net.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activation\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activation.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\bd72f076\723e1f66_8084ce01\ICSharpCode.SharpZipLib.dll"
/R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\assembly\dl3\a969e044\e376a565_e4b8cd01\EntityFramework.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll"
/out:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\App_Web_4evss3jw.dll" /debug- /optimize+ /w:4
/nowarn:1659;1699;1701 /warnaserror-
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\App_Web_4evss3jw.0.cs"
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\App_Web_4evss3jw.1.cs"
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\App_Web_4evss3jw.2.cs"
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\App_Web_4evss3jw.3.cs"
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\App_Web_4evss3jw.4.cs"
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\root\961689a1\98e5467e\App_Web_4evss3jw.5.cs"
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1 Copyright (C)
Microsoft Corporation. All rights reserved.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(38,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'DropDownList' but appears to have an extension method by that name.
Extension methods cannot be dynamically dispatched. Consider casting the
dynamic arguments or calling the extension method without the extension
method syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(49,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'TextBox' but appears to have an extension method by that name. Extension
methods cannot be dynamically dispatched. Consider casting the dynamic
arguments or calling the extension method without the extension method
syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(55,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'DropDownList' but appears to have an extension method by that name.
Extension methods cannot be dynamically dispatched. Consider casting the
dynamic arguments or calling the extension method without the extension
method syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(61,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'TextBox' but appears to have an extension method by that name. Extension
methods cannot be dynamically dispatched. Consider casting the dynamic
arguments or calling the extension method without the extension method
syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(67,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'TextBox' but appears to have an extension method by that name. Extension
methods cannot be dynamically dispatched. Consider casting the dynamic
arguments or calling the extension method without the extension method
syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(73,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'TextBox' but appears to have an extension method by that name. Extension
methods cannot be dynamically dispatched. Consider casting the dynamic
arguments or calling the extension method without the extension method
syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(79,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'TextBox' but appears to have an extension method by that name. Extension
methods cannot be dynamically dispatched. Consider casting the dynamic
arguments or calling the extension method without the extension method
syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(85,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'TextBox' but appears to have an extension method by that name. Extension
methods cannot be dynamically dispatched. Consider casting the dynamic
arguments or calling the extension method without the extension method
syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(91,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'TextBox' but appears to have an extension method by that name. Extension
methods cannot be dynamically dispatched. Consider casting the dynamic
arguments or calling the extension method without the extension method
syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(97,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'DropDownList' but appears to have an extension method by that name.
Extension methods cannot be dynamically dispatched. Consider casting the
dynamic arguments or calling the extension method without the extension
method syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(103,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'TextBox' but appears to have an extension method by that name. Extension
methods cannot be dynamically dispatched. Consider casting the dynamic
arguments or calling the extension method without the extension method
syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(109,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'TextBox' but appears to have an extension method by that name. Extension
methods cannot be dynamically dispatched. Consider casting the dynamic
arguments or calling the extension method without the extension method
syntax.
c:\inetpub\wwwroot\dashboard.e-tale.co.uk\Views\Account\Register.aspx(115,17):
error CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named
'TextBox' but appears to have an extension method by that name. Extension
met