Posts

python - Data insertion error: invalid literal for int() with base 10 -

i'm using django-nonrel on google app engine. i'm trying add row database error when trying use save(): invalid literal int() base 10 here's code: views.py from django import forms django.contrib.auth.decorators import login_required django.contrib.auth.forms import usercreationform django.http import httpresponseredirect django.shortcuts import render_to_response forms import sayform models import saying, category import datetime def say_something(request): if request.method == 'post': form = sayform(request.post) if form.is_valid(): cd = form.cleaned_data content = cd['content'] category_temp = "uncategorized" category = category.objects.get(name = category_temp) added_date = datetime.datetime.now() added_user = request.user saying = saying(content, category, added_date, added_user) saying.save() return httpresponseredirect('/contribute/success...

sql - zend retriving tag list -

i have problem zend. here is. i'm going make kind of articles db, containt info. every article marked 1 or more tags (like wordpress). i have controller (let index) , action (also index). need articles , tags, associated it, when user goes site/index/index. i have 3 tables: articles(idarticles, title..) tags(idtags, title) taglist(idarticles, idtags). how can read tags, associated article? zend's mvc doesn't include model, however, quickstart guide outlines creating model . the simplest way (not best way), setup connection in application.ini , or setup adapter (see zend_db_adapter docs): $db = new zend_db_adapter_pdo_mysql(array( 'host' => '127.0.0.1', 'username' => 'webuser', 'password' => 'xxxxxxxx', 'dbname' => 'test' )); then use sql select data. //all articles $articles = $db->query('select * articles'); //a article's tags $tags = $db-...

c++ - std::wstring length -

what result of std::wstring.length() function, length in wchar_t(s) or length in symbols? , why? tchar r2[3]; r2[0] = 0xd834; // d834, dd1e - musical g clef r2[1] = 0xdd1e; // r2[2] = 0x0000; // '/0' std::wstring r = r2; std::cout << "capacity: " << r.capacity() << std::endl; std::cout << "length: " << r.length() << std::endl; std::cout << "size: " << r.size() << std::endl; std::cout << "max_size: " << r.max_size() << std::endl; output> capacity: 351 length: 2 size: 2 max_size: 2147483646 std::wstring::size() returns number of wide-char elements in string. not same number of characters (as correctly noticed). unfortunately, std::basic_string template (and instantiations, such std::string , std::wstring ) encoding-agnostic. in sense, template string of bytes , not string of characters.

WPF data binding -

consider following xaml code: <stackpanel> <listbox x:name="lbcolor"> <listboxitem content="blue"/> <listboxitem content="green"/> <listboxitem content="yellow"/> </listbox> <textblock> <textblock.text> <binding elementname="lbcolor" path="selecteditem.content"/> </textblock.text> <textblock.background> <binding elementname="lbcolor" path="selecteditem.content"/> </textblock.background> </textblock> </stackpanel> i understand how text property binding works. internally converted like: textblock.text = lbcolor.selecteditem.content; but how background bound same source? code: textblock.background = lbcolor.selecteditem.content; is incorrect. how can...

c++ - How Can I execute my code on MessageBox Ok click -

this might simple new mfc. i have messagebox: messagebox("do want save configuration changes","nds",1); which have ok , cancel option. want write code on click of ok if(messagebox("blah", "nds", 1) == idok) { // hit okay } http://msdn.microsoft.com/en-us/library/ms645505(vs.85).aspx

asp.net - Youtube video double click -

i have embedded tube video project.the problem i'm facing when double click on video opens in new tab.what want when click video should open in full screen. thanks open in full screen behavior of player when used on youtube. open new tab behavior when player embedded in anther webpage. it seems modify behavior violation of youtube terms of service 4(f) 4. general use of service—permissions , restrictions f. if use embeddable player on website, may not modify, build upon, or block portion or functionality of embeddable player, including not limited links youtube website. http://www.youtube.com/t/terms

Winforms databinding and validation, why is datasource updated when validation fails? -

the code below illustrates unexpected (for me!) behaviour when combining data binding , validation in winforms. can tell me how can prevent datasource being updated when validation fails? many thanks. using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; namespace validationbug { /// <summary> /// illustrates unexpected behaviour winforms validation , binding /// /// reproduce: run program, enter value textbox, click x close form. /// /// expected behaviour: validation of textbox fails data source not updated. /// /// observed behaviour: data source updated. /// </summary> public class form1 : form { private class data { private string _field; public string field { { return _field; } set { ...