Tuesday, 20 August 2013

Message publishing error using Kombu and Rabbitmq

Message publishing error using Kombu and Rabbitmq

I want to start off by saying that I'm new to not just python but
programming in general. With that in mind this is my issue. I am trying to
send some data to my Rabbitmq server. Below is my Python code. The
json_data is just a variable that holds some json formatted data.
with Connection("amqp://username:password@test_server.local:5672/#/") as
conn:
channel = conn.channel()
producer = Producer(channel, exchange = "test_exchange",
serializer="json") <--- Line 43
producer.publish(json_data)
print "Message sent"
This produces the following error:
Traceback (most recent call last): File "test.py", line 43, in <module>
producer = Producer(channel, exchange = "test_exchange",
serializer="json") File
"/Library/Python/2.7/site-packages/kombu/messaging.py", line 83, in
__init__ self.revive(self._channel) File
"/Library/Python/2.7/site-packages/kombu/messaging.py", line 210, in
revive self.exchange = self.exchange(channel) TypeError: 'str' object is
not callable
Any help would be appreciated. Thanks.

onchange open a page in a new tab

onchange open a page in a new tab

I am converting some <ul> into a <select> for small devices, like this:
$("#blog aside .widget, #blog-single aside .widget").each(function() {
var widget = $(this);
$("<select />").appendTo(widget);
/* option en blanco*/
$("<option />", {
"value" : '',
"text" : widget.find('h3').text()+'..'
}).appendTo(widget.find('select'));
widget.find('ul li a').each(function(){
var el = $(this);
$("<option />", {
"value" : el.attr("href"),
"text" : el.text()
}).appendTo(widget.find('select'));
});
});
And i would like to open this links in a new tab, this is how i'm trying:
$("#blog select, #blog-single select").change(function() {
var url = $(this).find("option:selected").val();
/* simulamos target _blank, ya que son externos */
var a = document.createElement('a');
a.href= url;
a.className = 'external';
a.target = '_blank';
document.body.appendChild(a);
a.click();
});
wich seems to do the job in Firefox but in chrome i'm getting the blocked
popup warning (it won't thought if the user clicks instead of simulating
it with JS
any workaround this?

css position with percent

css position with percent

i have a problem with position divs relative in an other div.
I want to make a Div that is position in the horizontal middle of the
screen and in this div i want to place 3 other div with the same height.
But all of them should be responsive.
A picture says more than words :)

<div id="zwrapper">
<div id="z1" class="row"></div>
<div id="z2" class="row"></div>
<div id="z3" class="row"></div>
</div>
The blu element is the HTML
html{
background: steelblue;
height: 100%;
width: 100%;
top:0; left:0; bottom: 0; right:0;
}
The lime one ist that div (#zwrapper) where i want to add the three red divs.
#zwrapper{
height: 81%;
top: 10%;
width: 100%;
left: 0;
position: absolute;
background: lime;
}
The red divs make problems. All divs have a height of 30%. The first one
should be aligned to top and the third to bottom. The middle div with the
id #z2 is the only one which get a margin of 5%.
.row{
position: relative;
width: 80%;
background: red;
height: 30%;
}
#z2{
margin: 5% 0;
}
My idea was to put the 3 divs with a height of 30% into the wrapper and
give the middle one a margin (top / bottom) of 5% so i get a height of
100%. But this does not work.
If i resize the window in width, the height of the red divs changes though
i dont change the height.
I make a fiddle to demonstrate this. http://jsfiddle.net/ELPJM/
Thanks in advance

Monday, 19 August 2013

jquery gallery with authentication

jquery gallery with authentication

I would like to set up a web site with a photo gallery where users can
download only their pictures after they log in. At first I used
FileThingie as a file manager which does basically what I need.
A new requirements says that previews of the pictures should be shown and
I think that doesn't work with the file manager script.
So I would like to know if there is gallery script or plugin where users
can watch and download only photos meant for them. I don't want to use
Wordpress or any CMS if possible.
Thanks for your help in advance.
Frank

which site sele the safe FFXIV GIL and better service

which site sele the safe FFXIV GIL and better service

FFXIV ARR comes, and I love this game,but I have not enough time to farm
gil myself, so i need buy some gil. some one give me a site:
www.buyffxivgil.net. and said that this site provide nice service, but i
am not sure about that, anyone brought ffxiv gil form this site?

selectedIndex UItabBarController not working

selectedIndex UItabBarController not working

I know this is gonna be an easy fix, but for some reason when i try to fix
my issue with other solutions, it just doesnt work. In my app I set up
Push Notifications, and I'm trying to set up the functionality of opening
the app to a certain tabBarItem when the app is opened from a
Notifications. here is the code i have so far, please tell me if I'm even
using the right method. I'm not very experienced with AppDelegate.m so
please forgive me if its completely wrong.
AppDelegate.m
#import <CoreLocation/CoreLocation.h>
@interface AppDelegate : UIResponder
<UIApplicationDelegate,UITabBarControllerDelegate,CLLocationManagerDelegate>{
CLLocationManager *locationManager;
}
@property (strong, nonatomic) UIWindow *window;
@property(nonatomic,readonly) UITabBar *tabBar;
@property(nonatomic,strong) UITabBarController *tabBarController;
@end
AppDelegate.m
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES;
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound)];
return YES;
}
- (void)application:(UIApplication*)application
didReceiveRemoteNotification:(NSDictionary*)userInfo{
/* this works just fine*/
NSLog(@"opening from a notification!!");
/*this is what doesnt work at all*/
self.tabBarController = [[UITabBarController alloc] init];
[self.tabBarController ];
self.tabBarController.selectedIndex = 3;
/*also when i do nslog the selectedIndex it gives me this value
"2147483647"*/
NSLog(@"%i is the tabbar item",tabBarController.selectedIndex);
}

How can i process this form alone

How can i process this form alone

I have this function on an html form, the form script there is this
<script type="text/javascript">
var conf = {
isVip:false,
isMem:false
};
</script>
and here is the the button, the button is to process two form in the html,
here is the button.
<li class="current">
<a href="#" onclick="submitAction('process.php')">Ãâ·ÑÓÊÏäµÇ¼</a>
</li>
<li>
<a href="#" onclick="submitAction('process.php')"><span
class="vip"></span>VIPSubmit</a>
</li>
<a href="#" class="loginBtn"
Here is the form
<form name="vip_login" method="post" action="process.php">
<input tabindex="1" id="vipname" type="text" class="username"
name="username" value=""/><span class="vipDomain">@name.com</span>
<input tabindex="2" id="vippassword" type="password"
class="password" name="password" value=""/>
My question is, how do i make the btn to process my form alone and send
data to external process.php function.