Edit: Debugging has got me further. Question clarified.
We have installed Ruby, RubyGems and Rails and have forked the shopify_app project. We have created a new rails applications and added three items to the Gemfile: execjs, therubyracer and shopify_app.
Running rails s in order to start our rails application returns this trace:
root@ubuntu:/usr/local/pete-shopify/cart# rails s
Faraday: you may want to install system_timer for reliable timeouts
/var/lib/gems/1.8/gems/shopify_app-4.1.0/lib/shopify_app.rb:15:in `require': /var/lib /gems/1.8/gems/shopify_app-4.1.0/lib/shopify_app/login_protection.rb:5: syntax error, unexpected ':', expecting kEND (SyntaxError)
...rce::UnauthorizedAccess, with: :close_session
^
from /var/lib/gems/1.8/gems/shopify_app-4.1.0/lib/shopify_app.rb:15
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
from /usr/local/pete-shopify/cart/config/application.rb:7
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/commands.rb:53
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/commands.rb:50
from script/rails:6:in `require'
from script/rails:6
I haven't modified any files since forking from Github. Lines 1 - 6 of login_protection.rb are as follows:
module ShopifyApp::LoginProtection
extend ActiveSupport::Concern
included do
rescue from ActiveResource::UnauthorizedAccess, with: :close_session
end
I've looked into this and it seems that the error is caused by a new-style hash syntax between Ruby 1.8 and 1.9; key : value instead of key => value.
Running ruby -v from the command line returns ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]. This would seem to be OK... but I did some debugging, and inside the file /var/lib/gems/1.8/gems/shopify_app-4.1.0/lib/shopify_app.rb (at the top) by putting this:
puts RUBY_VERSION
exit
It printed 1.8.7. **Why are ruby -v and RUBY_VERSION giving me different results? And am I correct in assuming this is the cause of my problems?
Note: To upgrade Ruby I installed the later version with apt-get and then switched to it by using update-alternatives --config ruby and selecting option 2 like this:
root@ubuntu:/usr/local/pete-shopify/cart# update-alternatives --config ruby
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/ruby1.8 50 auto mode
1 /usr/bin/ruby1.8 50 manual mode
* 2 /usr/bin/ruby1.9.1 10 manual mode
Also note: We're PHP/Python developers so this is all new to us!
Summary:
1 - Am I right in determining the cause of the syntax error?
2 - Why does RUBY_VERSION and ruby -v give me different results?
I've got an Xml document that both defines and references some namespaces. I load it into an XmlDocument object and to the best of my knowledge I create a XmlNamespaceManager object with which to query Xpath against. Problem is I'm getting XPath exceptions that the namespace "my" is not defined. How do I get the namespace manager to see that the namespaces I am referencing are already defined. Or rather how do I get the namespace definitions from the document to the namespace manager.
Furthermore tt strikes me as strange that you have to provide a namespace manager to the document which you create from the documents nametable in the first place. Even if you need to hardcode manual namespaces why can't you add them directly to the document. Why do you always have to pass this namespace manager with every single query? What can't XmlDocument just know?
The Code:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(programFiles + @"Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\HfscBookingWorkflow\template.xml");
XmlNamespaceManager ns = new XmlNamespaceManager(xmlDoc.NameTable);
XmlNode referenceNode = xmlDoc.SelectSingleNode("/my:myFields/my:ReferenceNumber", ns);
referenceNode.InnerXml = this.bookingData.ReferenceNumber;
XmlNode titleNode = xmlDoc.SelectSingleNode("/my:myFields/my:Title", ns);
titleNode.InnerXml = this.bookingData.FamilyName;
...
The Xml:
<?xml version="1.0" encoding="UTF-8" ?>
<?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:Inspection:-myXSD-2010-01-15T18-21-55" solutionVersion="1.0.0.104" productVersion="12.0.0" PIVersion="1.0.0.0" ?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>
- <my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-01-15T18:21:55" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003">
<my:DateRequested xsi:nil="true" />
<my:DateVisited xsi:nil="true" />
<my:ReferenceNumber />
<my:FireCall>false</my:FireCall>
...
I have a date column where the date is displayed in the format 2009-11-18 10:55:28.370.
I just want to get the date (not time) out of that value. How do I do that?
hey guys , im writing a class and im wondering how i can write a condition statement in this way :
$this->referer= (!empty($_SERVER['HTTP_REFERER'])) ? htmlspecialchars((string) $_SERVER['HTTP_REFERER']) : '';
i need to find my user_id and this is the usual condtion :
if(is_user($user)){
$cookie=cookiedecode($user);
$user_id=intval($cookie[0]);
}
and i think it should be something like this :
$this->user_id = (is_user($user)) ? (cookiedecode($user)) : $cookie[0];
but it didnt work
I need to execute my code after finalization of SysUtils unit.
I've placed my code in separate unit and included it first in uses clause of dpr-file, like this:
project Project1;
uses
MyUnit, // <- my separate unit
SysUtils,
Classes,
SomeOtherUnits;
procedure Test;
begin
//
end;
begin
SetProc(Test);
end.
MyUnit looks like this:
unit MyUnit;
interface
procedure SetProc(AProc: TProcedure);
implementation
var
Test: TProcedure;
procedure SetProc(AProc: TProcedure);
begin
Test := AProc;
end;
initialization
finalization
Test;
end.
Note that MyUnit doesn't have any uses.
This is usual Windows exe, no console, without forms and compiled with default run-time packages. MyUnit is not part of any package (but I've tried to use it from package too).
I expect that finalization section of MyUnit will be executed after finalization section of SysUtils. This is what Delphi's help tells me.
However, this is not always the case.
I have 2 test apps, which differs a bit by code in Test routine/dpr-file and units, listed in uses. MyUnit, however, is listed first in all cases.
One application is run as expected: Halt0 - FinalizeUnits - ...other units... - SysUtils's finalization - MyUnit's finalization - ...other units...
But the second is not. MyUnit's finalization is invoked before SysUtils's finalization. The actual call chain looks like this: Halt0 - FinalizeUnits - ...other units... - SysUtils's finalization (skipped) - MyUnit's finalization - ...other units... - SysUtils's finalization (executed)
Both projects have very similar settings. I tried a lot to remove/minimize their differences, but I still do not see a reason for this behaviour.
I've tried to debug this and found out that: it seems that every unit have some kind of reference counting. And it seems that InitTable contains multiply references to the same unit. When SysUtils's finalization section is called first time - it change reference counter and do nothing. Then MyUnit's finalization is executed. And then SysUtils is called again, but this time ref-count reaches zero and finalization section is executed:
Finalization: // SysUtils' finalization
5003B3F0 55 push ebp // here and below is some form of stub
5003B3F1 8BEC mov ebp,esp
5003B3F3 33C0 xor eax,eax
5003B3F5 55 push ebp
5003B3F6 688EB50350 push $5003b58e
5003B3FB 64FF30 push dword ptr fs:[eax]
5003B3FE 648920 mov fs:[eax],esp
5003B401 FF05DCAD1150 inc dword ptr [$5011addc] // here: some sort of reference counter
5003B407 0F8573010000 jnz $5003b580 // <- this jump skips execution of finalization for first call
5003B40D B8CC4D0350 mov eax,$50034dcc // here and below is actual SysUtils' finalization section
...
Can anyone can shred light on this issue? Am I missing something?
How to dynamically generate LINQ query:
int[] IDArray = {55, 36};
public IQueryable<ContactListView> FindAllContacts(int loggedUserID, int[] IDArray)
{
var result = (
from contact in db.Contacts
//Start of dynamic part...
where
contact.UserID == loggedUserID
foreach (var id in IDArray)
{
where contact.UserID == id
}
// End of dynamic part
orderby contact.ContactID descending
select new ContactListView
{
ContactID = contact.ContactID,
FirstName = contact.FirstName,
LastName = contact.LastName
});
return result;
}
Thanks,
Ile
Can someone tell me where I can find the executeable "java_swt"?
I see multiple sites that say it is embedded in eclipse, and other sites say it is shipped with Mac swt drops. I have the zip file for a mac called "swt-3.5M6-carbon-macosx.zip" and i have the eclipse IDE installed on my test mac machine and windows machine. But i cannot find this executeable which i need to run an swt app smoothly on mac os x.
Any help would be appreciated. Thanks.
Hi,
I have been writing Common Lisp macros, so Scheme's R5Rs macros are a bit unnatural to me. I think I got the idea, except that I don't understand how one would use vector patterns in syntax-rules:
(define-syntax mac
(syntax-rules ()
((mac #(a b c d))
(let ()
(display a)
(newline)
(display d)
(newline)))))
(expand '(mac #(1 2 3 4))) ;; Chicken's expand-full extension shows macroexpansion
=> (let746 () (display747 1) (newline748) (display747 4) (newline748))
I don't see how I'd use a macro that requires its arguments to be written as a vector:
(mac #(1 2 3 4))
=>
1
4
Is there some kind of technique that uses those patterns?
Thank you!
Consider a table or CTE structured like this:
Name Num
---- ----
Abc 12
Abc 12
XYZ 70
XYZ 80
Bar 50
Bar 55
Foo 44
Foo 44
Baz 88
The requirement is to determine the Name where multiple different Nums exist.
The desired resultset is
Name
----
XYZ
Bar
What TSQL statement would you use to derive this resultset?
Assign the following 25 scores to a one dimensional int array called "temp"
34,24,78,65,45,100,90,97,56,89,78,98,74,90,98,24,45,76,89,54,12,20,22,55,66
Move the scores to a 2 dimensional int array called "scores" row wise
-- meaning the first 5 scores go into row 0 etc
hey guys
i need to add a special text to all rows in my mysql table ,
how to add some text to the end of all rows' content in a table just for one field
i used this code :
UPDATE `blogs` SET `title`= `title` + 'mytext';
but didnt work for me
I have a bunch of data that looks a little like this:
<item>
<colour>Red</colour>
<date_created>2009-10-10 12:01:55</date_created>
<date_sold>2009-10-20 22:32:12</date_sold>
</item>
<item>
<colour>Blue</colour>
<date_created>2009-11-01 13:21:00</date_created>
<date_sold>2009-11-21 12:32:12</date_sold>
</item>
<item>
<colour>Blue</colour>
<date_created>2009-10-29 21:23:02</date_created>
<date_sold>2009-10-20 02:02:22</date_sold>
</item>
<item>
<colour>Red</colour>
<date_created>2009-11-02 09:11:51</date_created>
<date_sold>2009-11-20 09:15:53</date_sold>
</item>
<item>
<colour>Red</colour>
<date_created>2009-10-18 11:00:55</date_created>
<date_sold>2009-10-20 11:12:22</date_sold>
</item>
Now what I would like to be able to do is to run that through an XSLT stylesheet such that I get ouput looking like this:
Colour | In stock 1 week | In stock 2 weeks | In stock 3 weeks
Red | 1 | 3 | 2
Blue | 0 | 2 | 1
Currently I have a stylesheet that uses basic muenchian grouping to show that 30% of stock was Red and 70% blue, but I can't see a way to find the number of nodes withing a given date range.
Is there a way to use keys to select a range? Do I need to create some kind of intermediate data node? Is there a different route that shows I'm barking up the wrong tree with both those suggestions? Is this even possible with XSLT or do I need to find a way to change the data source?
This question maybe a better fit on The Business of Software forum but despite my post on there, I'm still unable to determine the following: Can I use the Google API to build commercial software? If not how can the people behind Byline charge for their app?
Update: I'm specifically interested in Google's Picasa & Reader APIs
Hi All,
I am using below code to Add SummaryLinkWebPart to a Page and also adding few links to that wehbpart. I can see the webpart now on the page but it doesn't have any links inside it. Does anyone know what is wrong with the code?
SPLimitedWebPartManager wpm = web.GetLimitedWebPartManager("Pages/default.aspx",PersonalizationScope.Shared);
SummaryLinkWebPart slwp = new SummaryLinkWebPart();
for (int counter = 0; counter < list.ItemCount; counter++)
{
urlField = list.Items[counter]["URL"].ToString().Split(',');
SummaryLink link = new SummaryLink(urlField[1].Trim());
slwp.SummaryLinkValue.SummaryLinks.Add(link);
slwp.SummaryLinkValue.SummaryLinks[counter].OpenInNewWindow = true;
slwp.SummaryLinkValue.SummaryLinks[counter].LinkUrl = urlField[0].Trim();
slwp.SummaryLinkValue.SummaryLinks[counter].Description = urlField[1];
slwp.Style = "Image on left";
Console.WriteLine(link.LinkUrl + link.Title);
}
wpm.AddWebPart(slwp, lvwp.ZoneID, slwp.ZoneIndex + 1);
hey guys
i made a slug link for my stories
but i really want to know which one has more impact on my google rank or seo rank
article/name/
or
article-name.html
hey guys
its been 4 years im developing a php project with my friends as a team .
but in our history we did not use any opensource project management tool
actualy im the leader of this project but never learnt how to manage a project with svn tools
everytime i went for svn and management tools , i confused more and more
where should i begin
and what steps should i take to be a pro leader and manage a opensource project perfectly
hey guys
i installed phpbb3 on a subdomain forums.mywebsite.com
everything is fine unless in subdomain session that set before in my portal cant be identified
but if i go to forums with this url :
mywebsite.com/forums
problem will be solved
is there any solution to solve this problem and user can be identified when subdomain is used ?
How can I flatten the 2 dimensions array int originalArray[][] to 1 dimension array?
int a [] = {1,2,6,7,2};
int b [] = {2,44,55,2};
int c [] = {2,44,511,33};
int originalArray [][] = new array[][]{a,b,c};
On our campus, we have about 60 Macs joined to our Active Directory domain. Most users have no problems logging into Macs, as long as their accounts are configured correctly.
However, we have one particular user who is unable to log in to just some of the Macs. He has no problem with most of them, but there is one group of them (all built from the same image) that he can't log in to. The machine in question is running OS X 10.6.2. The relevant entries from secure.log are below, with the hostname and username redacted.
Aug 16 10:32:43 hostname SecurityAgent[4411]: Could not get the user record for username from DirectoryServices.
Aug 16 10:32:43 hostname SecurityAgent[4411]: Will sleep 1 seconds and try again (retryCount = 4)
Aug 16 10:32:44 hostname SecurityAgent[4411]: Could not get the user record for username from DirectoryServices.
Aug 16 10:32:44 hostname SecurityAgent[4411]: Will sleep 2 seconds and try again (retryCount = 3)
Aug 16 10:32:46 hostname SecurityAgent[4411]: Could not get the user record for username from DirectoryServices.
Aug 16 10:32:46 hostname SecurityAgent[4411]: Will sleep 4 seconds and try again (retryCount = 2)
Aug 16 10:33:10 hostname SecurityAgent[4411]: Could not get the user record for username from DirectoryServices.
Aug 16 10:33:10 hostname SecurityAgent[4411]: Will sleep 8 seconds and try again (retryCount = 1)
Aug 16 10:33:18 hostname SecurityAgent[4411]: User info context values set for username
Aug 16 10:33:18 hostname SecurityAgent[4411]: unknown-user (username) login attempt PASSED for auditing
Everything I've found online suggests that our use of Mobile Accounts is causing the issue. I turned that feature off, but I still can't log in as that user.
id returns a record for his account, and nothing looks out of the ordinary.
Has anyone here run into this before?
For the following truss output, we can see the process post to 11 processes whose semnum is 49,32, ..etc, is there anyway to find out which process hold semnum 49, and which process holds setnum32, etc?
/1: semop(67108928, 0xFFFFFFFF7FFF9F4C, 11) = 0
/1: semnum=49 semop=1 semflg=0
/1: semnum=32 semop=1 semflg=0
/1: semnum=52 semop=1 semflg=0
/1: semnum=41 semop=1 semflg=0
/1: semnum=40 semop=1 semflg=0
/1: semnum=55 semop=1 semflg=0
/1: semnum=46 semop=1 semflg=0
/1: semnum=35 semop=1 semflg=0
/1: semnum=37 semop=1 semflg=0
/1: semnum=48 semop=1 semflg=0
/1: semnum=39 semop=1 semflg=0