Posts

Showing posts from August, 2012

objective c - Drawing a 3D Cube and rotate it -

i want draw 3d cube , rotate it. found here project ( where start opengl es create , rotate cube in iphone? ) there 4 errors: /users/zyage/library/developer/xcode/deriveddata/cubeexample- cpuqdsorzrsxfcckeaidfhlprjed/build/intermediates/cubeexample.build/debug-iphonesimulator/cubeexample.build/script-bc9587f7117f8cf400bbb1c8.sh: line 4: /developer/platforms/iphoneos.platform/developer/usr/bin/texturetool: no such file or directory /users/zyage/library/developer/xcode/deriveddata/cubeexample-cpuqdsorzrsxfcckeaidfhlprjed/build/intermediates/cubeexample.build/debug-iphonesimulator/cubeexample.build/script-bc9587f7117f8cf400bbb1c8.sh: line 5: /developer/platforms/iphoneos.platform/developer/usr/bin/texturetool: no such file or directory /users/zyage/library/developer/xcode/deriveddata/cubeexample-cpuqdsorzrsxfcckeaidfhlprjed/build/intermediates/cubeexample.build/debug-iphonesimulator/cubeexample.build/script-bc9587f7117f8cf400bbb1c8.sh: line 7: /developer/platforms

Mysql join columns from multiple tables -

i have 1 main table , 2 tables hold multiple dinamyc information first table. the first table called 'items' holds main information. there 2 tables (ratings , indexes) holds information values dinamyc count of auditories , time period. what want: when query items, want result have additional column names ratings , indexes tables. i have code this select items.*, ratings.val rating, indexes.val idx items,ratings,indexes items.date>=1349902800000 , items.date <=1349989199000 , ratings.period_start <= items.date , ratings.period_end > items.date , ratings.auditory = 'kids' , indexes.period_start <= items.date , indexes.period_end > items.date , indexes.auditory = 'kids' order indexes.added, ratings.added desc the tables this items: `id` int(11) not null auto_increment, `name` varchar(200) default null, `date` bigint(40) default null primary key (`id`) ratings: `id` bigint(50) not null auto_increment, `period_start` bigi

python - Pass Variable to Django Admin Form -

i have add form calibrationcertificates in django admin site. if link non-admin template, instrument_detail.html, possible pass context information default value add form. that is, choice in add form instrument certificate for. link associated instrument, there way pass value, such add certificate form default instrument user came from? my modeladmin follows: class certificateadmin(admin.modeladmin): exclude = ('issued_by', 'expires',) def save_model(self, request, obj, form, change): obj.issued_by = request.user obj.expires= datetime.date.today() + datetime.timedelta(days=obj.instrument.kind.duration) obj.save() not sure if understand question correctly think want: def add_view(self, request, form_url='', extra_context=none): extra_context = extra_context or {} extra_context['my_extra_content'] = self.something return super(mymodeladmin, self).add_view(request, form_url, extra_con

android image layout size -

Image
from above image,how can remove white space surrounding image imageview layout is <imageview android:id="@+id/list_image" android:layout_width="@android:dimen/app_icon_size" android:layout_height="@android:dimen/app_icon_size" android:layout_gravity="center_vertical" android:scaletype="fitcenter"/> add image android:adjustviewbounds=true if still not working, change layout size wrap_content

functional programming - Transforming functions of type `a -> b` into those of type `String -> String` in Haskell -

my intention simple. want wrap functions of type a -> b string -> string (so bunch of heterogeneous functions can put in list). write: wrap :: (read a, show b) => (a -> b) -> (string -> string) wrap f = \s -> show $ f (read s :: a) however, ghc complaints: could not deduce (read a1) arising use of `read' context (read a, show b) bound type signature wrap :: (read a, show b) => (a -> b) -> string -> string i want know why piece of code won't work , kind of hacks needed achieve goal? thanks. your code won't work because haskell doesn't re-use or scope type variables; a in wrap :: (read a, show b) => (a -> b) -> (string -> string) different a 1 in read s :: a (and they're both universally quantified). source of a1 in error message; ghc alpha-converting program to wrap :: (read a, show b) => (a -> b) -> (string -> string) wrap f = \s -> show $ f (read s :: a1)

I'm getting 403 error using passenger for rails in apache -

i've installed needed tools, , followed several tutorials trying make passenger respond. i can access static files in public folder (public/500.html or 422.hml). yesterday entered through vhost, , found passenger errors. time later hosting restarted service, , since have not been able access rails app again. link link link these of links used configure server. i've read permission issue; i've checked that, i'm not sure it's fine. first of check error log. default, placed @ /var/log/apache2/ . if have client denied server configuration issue, check site conf file @ /etc/apache2/sites-available/your-site.conf . must in compliance phusion passenger user guide . take on require granted . <directory "/home/user/folder"> require granted options followsymlinks # relaxes apache security settings. allowoverride none # multiviews must turned off. order allow,deny allow </directory>

javascript - What is the best way to disallow a click to highlight a DIV? -

Image
i have 2 "buttons" made of div utf-8 arrow character in them. when user clicks on them, highlight. what best way suppress highlighting works in browers not affect click? here's markup: <div class="arrowcontainer"><div class="arrowleft">...</div></div> .arrowcontainer .arrowleft { background-color:#e0e0e0; width:15px; padding: 1px 0 0 0; height: 19px; text-align: center; float:left; margin: 0 2px 0 0; font-size: 9pt; cursor: pointer; } seems selected (like when select text), try disabling selection option: *.notselectable{ -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; /* ie 10. */ -ms-user-select: none; user-select: none; }

pdf generation - Create PDF Document in VBA -

using vba outside of ms-office suite of applications, there way create pdf document, or light-weight document can converted pdf? i have data within classes, want pdf, how do quickly, without resorting opening ms word, ms excel, etc? this link seems might helpful solving issue. http://forums.adobe.com/thread/840511 according information there can print adobe pdf virtual printer , generate file. people on forum doing emailing file afterwards , generating file access data, looks solution work vba project.

html - Header CSS breaking -

i'm pretty terrible @ css/design i'm struggling css here. the page looks fine when loaded in full screen browser @ 1920x1080, however, minimise or load page on mobile device header content loses placing body fine. here's css elements in question: #header { background: url(assets/header_bckg.gif) repeat-x ; height:120px; } #logo { display:inline-block; float:mid-left; padding:50px 0 0 570px; } #logo { color:#ffffff; text-decoration:none; font-weight:bold; height:12px; font-size:20px; text-transform:uppercase;} #login { display:inline-block; float:mid-right; padding-left:400px; padding-bottom: 7px; vertical-align:middle;} #login{ color:#ffffff; text-decoration:none; font-weight:bold; height:12px; font-size:12px; text-transform:uppercase;} #avatar { display:inline-block; position:absolute; margin-top:28px; float:mid-right; padding-left: 505px; padding-bottom: 15px; vertical-align:middle; } #avatar_online { background: linear-gradient(to bottom, #7bafd6 5

c++ - Application boost::thread stuck on mutex lock when compiled for ARM running on BeagleBone Black -

i working on c++ app runs on pc fine , want make work on beaglebone black on have installed debian wheezy. i'm cross compiling using eldk v5.3 , qmake pc (intel celeron, debian wheezy, boost v1.49.0-3.2) beaglebone black (arm cortex a8, debian wheezy, boost v1.49.0-3.2). everything works should, every , then, app freezes (is stuck on __pthread_mutex_lock) when boost::thread created or app waiting boost::thread::join(). want understand what's going on. if have tips can me secure these calls boost::thread (try/catch, error status check ...) please share them :) thank !! here small source code freezes in similar fashion when executed on beaglebone black followed backtrace printed when app freezes (gdb) , .pro file used when executing qmake command : #include <stdio.h> #include <boost/thread.hpp> #define nb_threads 20 #define thread_life_duration 5 int g_nb_thread = 0; boost::thread * subregisterthread(boost::thread * pthread) { pr

Get data-attribute jquery vs javascript -

i have custom data-attribute set default: data-equipment="0" if change jquery using .data() $(this).data("equipment", 10) and use getattribute() this.getattribute("data-equipment") i old value (0) , not new 1 (10). if use $(this).data("equipment") new value (10). is supposed work or missing something? thanks! .data() doesn't operate on data attributes in internal jquery cache. if no cache record found, data read corresponding data- attribute if 1 exists, end of co-operation. if operated on attributes, useless purpose because attribute values must strings.

sql - How to run procedure every week till end date in oracle -

i have procedure need execute every week date of deployment in production.it should run on day of deployment , subsequent weeks till end date stored in variable. i need incorporate @ procedure level rather creating separate scheduler or dbms_job suppose start date 11/1/2013 (day of deployment) , end date 04/30/2014 need run procedure every week once between period including start date. suppose proc run on 04/28/2014 , next week falls in may, till 4/30/2014 should run each day. help appreciated. begin in (select typename ....)-- give 3 output loop if typename = 'abc' -- run update every week start date end update test set test.a = ...., test.b = .... test.c in (....) elsif typename = 'pqr'then update test1 set test.a1 = ..., test.b1 = ..., test1.c in (....)

jquery - Accessing form values using javascript in Ruby on Rails -

let's have input box, on client-side, want access value of input box , check if exists record in model. if so, want data shown. however, want done without clicking submit button/reloading page. can show me sample code? sample code frowned upon in these parts, can give outline of do. use jquery value of input box, , submit using ajax request url. map url controller action checks see if record exists in db, , return json indicates whether or not. in javascript, when data returned, can display user.

windows - Tar and --newer / --after-date parameter -

my project structure following: -sprint41 -file1 -file2 -sprint40 -file1 -file2 all files(+ sprint41) in sprint41 folder have modified date 20130807 all files(+ sprint40) in sprint40 folder have modified date 20130610 i want create archive including files(+folder) after 20130715. command following: tar -cf test.tar --after-date 20130715 * after command, test.tar contains following: -sprint41 -file1 -file2 -sprint40 it keeping sprint40 folder though modified date before 20130715 i expecting have following: -sprint41 -file1 -file2 do have clue ? many thanks yeah, problem tar still include directories if empty. it's checking --newer option on files, not directories. going have either write small script or use find -cnewer , pipe output tar (with --no-recursion on tar command). create file timestamp want with touch -t 201307150000 timefile.txt then somthing like: find . -cnewer timefile.txt -print0 | xargs -0 tar --no-recursion -

PHP/PDO/MySQL if statement in BETWEEN clause -

i'm trying return records records store within date range. however, if store opened after date, want use open date. possible this? i'm using php pdo , mysql: select store_name, daily_sales mytable date between (if(open_date > :start_date, open_date, :start_date) , :end_date so can this: select store_name, daily_sales mytable date between (select if(open_date > :start_date, open_date, :start_date)) , :end_date

Play definite frequency sound in visual c++ -

how convert sound() in turbo c++ visual c++ 2005? want play definite frequency sound through system speaker ? you might looking beep function

java - Can you record two MediaRecorder video streams at once? -

we looking @ writing android app , need create 2 copies of video record. each 1 require different settings (dimensions, etc). 1 'high quality' version (1280x720, high bitrate) , 1 'low quality' version (480x360, lower bitrate). both mp4 files. we have found using mediarecorder record higher quality version , using ffmpeg convert video afterwards lower quality version excruciatingly slow. getting speeds of 6 minutes 22 second video converted! so possible have 2 instances of mediarecorder @ once stream captured , encoded file on-the-fly, saving need encode after it's completed? alternatively there other suggestions how can achieve this, or maximise ffmpeg's performance?

directory - How to read this line in MATLAB? -

i came across following lines in matlab : m = dir(fullfile(dataset,'*.png')); m = {m(~[m.isdir]).name}; i understand first line trying obtain .png files directory. but, second line trying perform? isdir seems determine input directory. that's new part. but, line trying perform? thanks. the second line getting files not directory , getting respective names , storing them cell array m.isdir indicates if folder or not returns 1 if is, 0 if not. ~[m.isdir] indicate of values returned isdir 0. m(~[m.isdir]) grabs objects in m determined logical indexing done above m(~[m.isdir]).name gets names of of them {m(~[m.isdir]).name} stores them in cell array hopefully step step walkthrough helps. while not sure why second line necessary because fullfile(dataset,'*.png') should return paths end in .png , not folder, guess check.

Custom jQuery slider image calculation -

i using code jquery image slider found work custom post type in wordpress(pods). slider working perfectly, need limit number of times user can scroll next image based on how many images there are. <script type="text/javascript"> $(function() { $("img.enlarge").live('click', function (e) { e.preventdefault(); var src = this.src; $("#fullimage").attr("src", src); }); }); $(document).ready(function() { $('img').filter(function(index){return $(this).attr('src')==='';}).removeclass('enlarge'); $('img').filter(function(index){return $(this).attr('src')==='';}).hide(); var $item = $('img.enlarge'), //cache dom selector visible = 1, //set number of items visible index = 0, //starting index endindex = ( $item.length / visible ) ; //end index (note:: requires visible factor of $item.length... can improve rounding...) $('div#arrowr'

windows 7 - Removing bad installs from Add/Remove programs -

i've created custom boot-strapper application using wix , burn, in time took learn managed install several variants in such way won't uninstall. think created problem running engine.apply before plancomplete had been called. where information builds list in add/remove programs , best way manually remove orphaned rows? update - should have said i'm on 64 bit windows 7 enterprise, service pack 1. hkey_local_machine\software\microsoft\windows\currentversion\uninstall or hkey_local_machine\software\wow6432node\microsoft\windows\currentversion\uninst‌​all - location add remove programs gets populated. if remove entry registry take out entry. can delete key here described below , physically locate , delete files/folders. in registry editor, locate registry keys mentioned above. each key listed under uninstall in left pane of registry editor represents program displayed in installed programs list of add or remove programs tool.to determine program each key

flash - In ActionScript, is it possible to call a function on a Class that applies to all instances of that class? -

so - have bunch of instances of class , there's function want call on of them. i'm wondering if rather loop through every instance have, there way can declare function on class when called runs on each instance? example - if class looks this: public class myclass{ public var variable:string = ""; public function myclass(){} public function myfunction():void{ this.variable = "blore"; } } and have bunch of these: var class1:myclass = new myclass(); var class2:myclass = new myclass(); is there way can call myclass.myfunction() , have called on of instances? i don't know if i'm explaining well...but there is. i'd love suggestions have don't involve "put instances in array or vector , loop through them real man." here's quick example of how accomplish this: package { public class example { public static var instances:array; public function example() {

virtualenv - Distributing a python package along with module dependencies using RPM -

i've got several python applications consisting of scripts/modules should packaged , deployed rpms. the trickier bit each application should distributed along python module dependencies, , these should used in preference installed system wide. the target hosts of these rpms have limited network access, rpms should contain needed run app, rather downloading @ deploy time. i've looked @ packaging , distributing virtualenv , relocating virtualenv doesn't seem supported. i've looked @ zc.buildout , found documentation lacking. see how download dependencies during development, not how distribute them part of larger application. it's possible different apps require different versions of same module, these shouldn't installed system wide. another pain point python scripts in app need modified use different sys.path during development , after deployment, couldn't see obvious way around this. are suggestions on how best achieve this? ideal summary of

Hash and function parameters in ruby -

i'd write : class test def initialize(a,b,c) end def print() puts @a puts @b puts @c end end test.new({a=>1, b=>2, c=>3}).print() =>1 =>2 =>3 is there way instanciate object , map parameters hash table? thanks in advance. class test def initialize(options) options.each |key, value| instance_variable_set("@#{key}", value) end end def print puts @a puts @b puts @c end end test.new(:a => 1, :b => 2, :c => 3).print or use openstruct : http://www.ruby-doc.org/stdlib-1.9.3/libdoc/ostruct/rdoc/openstruct.html here's simple example: require 'ostruct' puts openstruct.new(:a => 1, :b => 2, :c => 3).inspect # outputs: "#<openstruct a=1, b=2, c=3>"

asp.net mvc - How to limit the amount of data from an OData request? -

i have users table of 76 users , usergroups table. using mvc, odata, generic repository , ef, trying optimize data retrieval when filtering based on user group: /api/users?$filter=usergroups/any(usergroup: usergroup/id eq 'group1') on client side, right number of users - 71 (as odata filtering based on result), want limit number of records being returned form actual query - ie. not want return records filter (not optimal large data sets). my api controller method follows: [queryable(allowedqueryoptions = allowedqueryoptions.all)] public iqueryable<user> get() { var unitofwork = new atms.repository.unitofwork(_dbcontext); var users = unitofwork.repository<user>() .query() .include(u => u.usergroups) .get() .orderby(order => order.username); unitofwork.save(); // includes dispose()

objective c - accessing an property inside an object for showtimes -

i have created object class called "movie" contains property called "showtimes" of type nsmutablearray. now have class called "localshowtimes" contains property called moviesarray of type nsmutablearray filled objects of type "movie" i know trying know first object of moviesarray , property "showtimes" in order it. this trying: nsmutablearray *theshowtimes =[(movie *)[[moviesarray] objectatindex:[o]] showtimes]; but compiler complaining "expected identifier" can tell me doing wrong? thanks you should either use objectatindex: or indexer: // - old syntax nsmutablearray *theshowtimes =[[moviesarray objectatindex:o] showtimes]; // or - new syntax nsmutablearray *theshowtimes =[moviesarray[o] showtimes];

c# - Time still show up in date datatype -

i have column in sql server 2008 r2 database table datatype of date not datetime . still in crystal report appears this: 8/4/2013 12:00:00am 8/2/2013 12:00:00am 8/1/2013 12:00:00am 12:00:00am must not included because datatype date not datetime right? why still shows in report? how remove that? that because few exceptions 1 , sql server date/time datatypes mapped datetime . if don't want see time component, specify appropriate format string desired display format. instance, string today = new datetime(2013,8,1).tostring("d mmm yyyy") ; will give value of 1 aug 2013 (in english language culture). 1 time data type mapped timespan , , datetimeoffset mapped to...wait it... datetimeoffset .

Changing Eclipse Exit Shortcut -

i'm using eclipse on ubuntu 12.04 , ctrl+x closes eclipse. tested ctrl+x in other applications , cuts text, want, must eclipse shortcut binding. i checked preferences>general>keys settings , couldn't find exit/quit/explode eclipse command , when search ctrl+x see 'cut' binded key combo. it has been driving me crazy appriciated, go cut , omg eclipse closing lol. i had similar problem. here's how solve it: when open eclipse, go window -> preferences -> general -> keys. search 'cut' command. binding option should show 'ctrl+x'. change when option 'in dialogs , windows' 'editing text'.

iphone - Code signing issue after adding support for private API -

Image
in ios app, want use private api need add "com.apple.springboard.launchapplications" key in entitlements.plist. after add key have started getting code signing errors. clue how tackle this? how create provisioning profile signed correct entitlements? my entitlements.plist: error:

search - hbase schema design for fast searching on many columns -

i have create table consisting of 30 columns in hbase , problem have 5 different queries running on 5 columns.the question table having indexes on multiple columns in oracle , how use in hbase. 5 queries sla bound. what can possible approaches start with. thanks.

Magento Error: SQLSTATE[42000] [1049] Unknown database 'test' -

there has been error processing request exception printing disabled default security reasons. error log record number: 445792780098 log: a:4:{i:0;s:46:"sqlstate[42000] [1049] unknown database 'test'";i:1;s:3072:"#0 /home/geschenk/domains/geschenkengenieten.nl/public_html/lib/zend/db/adapter/pdo/mysql.php(96): zend_db_adapter_pdo_abstract->_connect() #1 /home/geschenk/domains/geschenkengenieten.nl/public_html/lib/varien/db/adapter/pdo/mysql.php(313): zend_db_adapter_pdo_mysql->_connect() #2 /home/geschenk/domains/geschenkengenieten.nl/public_html/lib/zend/db/adapter/abstract.php(459): varien_db_adapter_pdo_mysql->_connect() #3 /home/geschenk/domains/geschenkengenieten.nl/public_html/lib/zend/db/adapter/pdo/abstract.php(238): zend_db_adapter_abstract->query('set names utf8', array) #4 /home/geschenk/domains/geschenkengenieten.nl/public_html/lib/varien/db/adapter/pdo/mysql.php(419): zend_db_adapter_pdo_abstract->query('set name

javascript - Object litterals vs Module pattern -

i understand difference between 2 following patterns. in fact, second 1 allows mimic public , private method, there other difference ? var mymodule = { myproperty: "somevalue", ... mymethod: function () { console.log( "anything" ); } }; mymodule.mymethod(); and : var mymodule = (function(){ var myproperty= "somevalue"; ... return { mymethod: function(){ console.log('something'); } } })(); mymodule.mymethod(); the second 1 first, except provides closure around object "private" variables can kept. specifically, if set example second such had no local variables , no parameters anonymous function, it'd not having anonymous function @ all.

c# - How to specify custom SoapAction without service interface exposed -

i wondering if possible have soap action not expose interface i define service interface this [servicecontract(namespace = "/")] public interface iservice { [operationcontract(action = "heartbeat", name = "heartbeat")] [xmlserializerformat] [webinvoke(requestformat = webmessageformat.xml, responseformat = webmessageformat.xml, uritemplate = "/heartbeat")] heartbeatresponse heartbeat(heartbeatrequest request); } implementation: [servicebehavior(addressfiltermode = addressfiltermode.any, namespace = "/")] public class service : iservice { public heartbeatresponse heartbeat(heartbeatrequest request) { ... } } web.config <behavior name="endpointbehavior"> <servicemetadata httpgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true" /> </behavior> <bindings> <wshttpbinding> <binding name="soa

c# - Populate a datagridview with sql query results -

i'm trying present query results, keep getting blank data grid. it's data not visible here code: private void employee_report_load(object sender, eventargs e) { string select = "select * tblemployee"; connection c = new connection(); sqldataadapter dataadapter = new sqldataadapter(select, c.con); //c.con connection string sqlcommandbuilder commandbuilder = new sqlcommandbuilder(dataadapter); datatable table = new datatable(); table.locale = system.globalization.cultureinfo.invariantculture; dataadapter.fill(table); bindingsource1.datasource = table; datagridview1.readonly = true; datagridview1.datasource = bindingsource1; } what's wrong code? here's code fixed up. next forget bindingsource var select = "select * tblemployee"; var c = new sqlconnection(yourconnectionstring); // connection string here var dataadapter = new sqldataadapter(select, c); var commandbui

Perl Net::SSH doesn't receive prompts -

i writing script communicate remote server. understand how send basic shell command such "ls" or "find / |grep foo". executing interactive application @ other end. if call $ssh->shell, prompt remote server know ssh receiving prompt. can't because script blocked in shell. i installed 2 handlers. if use script connect basic ssh host, , execute shell command, response delivered handlers, know ok. expected prompt application executing sent these isn't. #!/usr/bin/perl -w use strict; use net::ssh::perl; $host = 'rt.olsendata.com'; $user = 'rtdemo'; $pass = 'rtdemo'; %params = ('debug' => 1,'protocol' => 2); $ssh = net::ssh::perl->new($host, %params); $ssh->register_handler("stderr", sub{ ($ssh, $packet) = @_; receiveerrors($packet); }); $ssh->register_handler("stdout", sub{ ($ssh, $packet) = @_; receivedat

excel - select method of range class failed -

i have same problem when executing excel vba script @ line rows(target.row).select tried select range , can failed. function doone(rowindex integer) boolean dim key dim target dim success success = false if not isempty(cells(rowindex, 1).value) key = cells(rowindex, 1).value sheets("sheet1").select set target = columns(4).find(key, lookin:=xlvalues) if not target nothing rows(target.row).select [- here throws "select method of range class failed"-] selection.copy sheets("sheet2").select rows(rowindex + 1).select selection.insert shift:=xldown rows(rowindex + 2).select application.cutcopymode = false selection.insert shift:=xldown, copyorigin:=xlformatfromleftorabove cells(rowindex + 3, 1).select success = true end if end if doone = success end function where code? in worksheet module? when call cells or rows , don't put sheet in fron

python xlrd convert xlsx to csv -

i trying convert excel files csv files using xlrd library. but got error: unicodeencodeerror: 'ascii' codec can't encode character u'\u0142' in position 2: ordinal not in range(128) can because excel file large? cause works fine excel files have small number of rows. when tried convert excel file has 2000 rows, got error. [update] this code: filepath = './attachments' wb = xlrd.open_workbook(os.path.join(filepath, 'result.xls')) sheet = wb.sheet_by_index(0) fp = open(os.path.join(filepath, 'result.csv'), 'wb') wr = csv.writer(fp, quoting=csv.quote_all) rownum in xrange(sheet.nrows): wr.writerow(sheet.row_values(rownum)) fp.close() and traceback: traceback (most recent call last): file "methodtest.py", line 11, in <module> wr.writerow(sheet.row_values(rownum)) unicodeencodeerror: 'ascii' codec can't encode character u'\u0142' in position 2: ordinal not in range(128)

visual studio 2010 - C# Calculator working incorrectly -

the calculator works fine if keep using same operator(*, /, +, -) if example decide multiply total of 2 added numbers it'll give me wrong answer. i've looked solution can't seem find one. public partial class frmmain : form { public frmmain() { initializecomponent(); } bool multiply = false; bool divide = false; bool add = false; bool subtract = false; private void btnone_click(object sender, eventargs e) { txtdisplay.text = txtdisplay.text + "1"; } private void btntwo_click(object sender, eventargs e) { txtdisplay.text = txtdisplay.text + "2"; } private void btnthree_click(object sender, eventargs e) { txtdisplay.text = txtdisplay.text + "3"; } private void btnfour_click(object sender, eventargs e) { txtdisplay.text = txtdisplay.text + "4"; } private void btnfive_click(object sender, eventargs e)

playframework - Play Framework Project recommended structure -

right we're debating on 2 ways structure our project decompose project modules , each modules contain models, exception, controller needs. user module might contain user model, possible user exception cases user, , rest end point dealing user follows traditional approach have top level models, services, controllers, exceptions. in services there sub packages , in exceptions. structure 1: app/ /servicea /models foo.scala /controllers /exceptions servicea.scala /serviceb /models bar.scala /controllers /exceptions serviceb.scala structure 2: app/ /controllers /models foo.scala bar.scala /exceptions /servicea /serviceb /services /servicea /serviceb is there recommended project structure features exceptions, services, models? the recommended "play" way structure code this: app └ controllers └ models └ views

node.js - Using supertest to check didFlash after a redirect -

i'm trying test happens when user destroy callback receives error user controller. when destroy receives error, following: flash('error', 'can not destroy user'); redirect(path_to.users); this test far: it('should fail on delete /users/:id if destroy receives error', function (done) { var user = app.models.user; var user = new userstub(); user.find = sinon.spy(function (id, callback) { callback(null, user); }); user.destroy = sinon.spy(function (callback) { callback(new error()); }); request(app) .del('/users/55') .end(function (err, res) { res.header.location.should.include('/users'); app.didflash('error').should.be.true; done(); }); }); i've seen this question , res.header.. portion works expected. however, i'm still confused on how can test flash happens after redirect. i ended changing users_co

android - How can I properly send a Synced External Application Image to a RESTful WCF -

i'm newbie android, i'm trying send images android restful wcf. by i'm being able select images gallery , sending them server. the wcf expecting image stream but i'm having problems synced images stored in tablet facebook or g+ photos. (i don't know if cached or something) i'm using function path of image public static string getrealpathfromuri(context context, uri contenturi) { string path = null; if (contenturi.getscheme().tostring().compareto("content")==0) { string[] proj = { mediastore.images.media.data }; cursor cursor = context.getcontentresolver().query(contenturi, proj, null, null, null); int column_index = cursor.getcolumnindexorthrow(mediastore.images.media.data); cursor.movetofirst(); path = cursor.getstring(column_index); } else { path = contenturi.getpath(); }

JQuery Selectors: Selecting the submit button but not the close button -

javascript: <script> $('#submit').click(function () { $("p").show("slow"); }); </script> attempt two: <script> $("input[type='submit']").click(function () { $("p").show("slow"); }); </script> html: <form> username:<br> <input type="text" name="un"><br> password:<br> <input type="password" name="pw"><br> <input type="checkbox" name="pw"> remember me<br> <p><a href="recover.php">recover password</a></p> <p><input type="submit" value="submit" id="submit"></p> <p style="display: none; color:cc0000">authentication failed.</p> <p><button onclick="window.top.hidepopwin()">close</button></p> </form> am messing syntax on selectors here?

java - Execute Third-Party Jar From Command Line, Flag To Ignore SSL Issues? -

i'm executing w3c css validator jar command line, built latest-available source. exceptions raised when jar requests https urls. some https urls fine, others not. of cause exceptions raised of aware (just one), ssl cert appears fine when requesting relevant url in chrome. i call css validator follows: java -jar css-validator.jar "https://example.com/" and following error output: javax.net.ssl.sslexception: server key @ sun.security.ssl.handshaker.throwsslexception(handshaker.java:1274) @ sun.security.ssl.clienthandshaker.processmessage(clienthandshaker.java:223) @ sun.security.ssl.handshaker.processloop(handshaker.java:868) @ sun.security.ssl.handshaker.process_record(handshaker.java:804) @ sun.security.ssl.sslsocketimpl.readrecord(sslsocketimpl.java:1032) @ sun.security.ssl.sslsocketimpl.performinitialhandshake(sslsocketimpl.java:1328) @ sun.security.ssl.sslsocketimpl.starthandshake(sslsocketimpl.java:1355) @ sun.security.ssl

vbscript - Yes/no shut down -

i playing vbscript , want make msgbox asks user if want shut down computer or not. if user clicks yes should see msgbox first computer starts shutdown. i using code doesn't work. what problem? result = msgbox ("shutdown?", vbyesno, "yes/no exm") select case result case vbyes msgbox("shuting down ...") option explicit dim objshell set objshell = wscript.createobject("wscript.shell") objshell.run "c:\windows\system32\shutdown.exe -r -t 0" case vbno msgbox("ok") end select as documented option explicit must appear before other statement in script. using anywhere else in script should raise "expected statement" error pointing line option explicit statement. if don't error, have on error resume next in code didn't show. if move option explicit statement beginning of script, shutdown still doesn't occur, need check return

html - JQuery Vertical Carousel endless scrolling -

i having minor issue vertical scrolling carousel. using jquery, html , css project. idea make scroll endlessly in vertical motion, works fine, on first transition trips last child second instead of transitioning last first, works after first transition. here code , fiddle @ end: the html: <div id='carousel_container'> <div id='carousel_inner'> <ul id='carousel_ul'> <li><a href='#'><img src='http://e-home.mx/html5/img/carousel_1.png' /></a></li> <li><a href='#'><img src='http://e-home.mx/html5/img/carousel_2.png' /></a></li> <li><a href='#'><img src='http://e-home.mx/html5/img/carousel_3.png' /></a></li> <li><a href='#'><img src='http://e-home.mx/html5/img/carousel_4.png' /></a></li> <li><a href='#'><img src='h

any function in C or Java (Android) could mess up srand()? -

so have c code calculate results based on number generated srand(). if use same seed number, result same. now have android app load these c code via jni. however, results become different although same seed number being used. have double checked seed number make sure same. however, since both android program , native code pretty complicated, having hard time figure out causing problem. what sure is, did not use function in java program generate random numbers. presumably srand() not called different seed number every time. can other functions in java or c change random number generated srand()? thanks! update: guess question little confusing. clarify, results comparing same platform, different runs. c code use rand() number calculate result based on that. if seed number of srand() same, number rand() should same , hence results should same. somehow use same seed srand(), rand() give me different number... thought on that? there many different types of random number

php - Dynamic Row Only Added on First Click -

i have application seems work pretty except 1 small glitch can't seem figure out. hoping here. i have table can dynamically add rows to. there 2 ways add rows, checkbox loads pre-determined data, or image, adds blank row table. the checkbox works great, image link works first time, , not next. this image line: <img src="img/plus.png" width="25" height="25" id="btnaddrow" title="add new row" class="idfirst alternativerow" /> alternativerow generated code here: http://www.examplet.buss.hk/jquery/table.addrow.php (example #10, more complex) , line this: $(".alternativerow").btnaddrow({oddrowcss:"oddrow",evenrowcss:"evenrow"}); the "idfirst" block of jquery code this: $(document).ready(function(){ $(".idfirst").click(function(){ result = 0; id = 0; jquery.ajax({ url: 'getitemid.php?q=<?php echo $q; ?>', suc

winapi - Windows Vista/7 Kernel Hooking of Userland -

i'm looking advice on implementing driver under vista , 7 can hook , monitor arbitrary system functions userland process. goal dump arguments system functions called ntdll, kernel32, etc. coming xp, ssdt modification , similar techniques popular. on vista+ there filter drivers , notification routines. either of these meant hooking native functions? driver 32 , 64bit , has play nice patch guard. suggestions welcomed. obcallback similar ssdt hooking.

scheme - How to make pairs from a numeric list based on cardinality? -

i have list '(1 2 1 1 4 5) , want output list '((1 3)(2 1)(4 1)(5 1)) . have written small code stuck how calculate cardinality each number , put pair in list. can please @ code , give ideas? thanks. (define set2bags (lambda (randlist) (cond ((null? randlist) '()) (else (sort randlist) (makepairs randlist))))) (define makepairs (lambda (inlist) (let ((x 0)) ((newlist '())) (cond ((zero? (car inlist)) '()) (else (eq? (car inlist)(car (cdr inlist))) (+ x 1) (makepairs (cdr inlist)) (append newlist (cons (car inlist) x))))))) your current solution incorrect - doesn't compile. let's start again scratch, using named let traversing input list: (define set2bags (lambda (randlist) (cond ((null? randlist) '()) (else (makepairs (sort randlist >)))))) (define makepairs (lambda (inlist) (let loop ((lst in

android - How to call events when using the "Logout" facebook button? -

i have login button in sample hellofacebookactivity facebook. after login successfully, button switch status "logout" when click on "logout" facebook button, logged out correctly. want add event when user clicks "logout" button handle logic code... should do? thank you. edit: use sdk android native use following logout session session session = session.getactivesession(); session.closeandcleartokeninformation()

asp.net - add html list from behind code? -

i have database need turn list webpage. have data bound gridview in page_load function of behind code file. wondering how take grid data , create ul/li list it. here's function far: protected void page_load(object sender, eventargs e) { service1 myservice = new service1(); //use gridview store table data before building menu gridview sites = new gridview(); sites.datasource = myservice.getallsites(); sites.databind(); foreach (gridviewrow siterow in sites.rows) { string itemname = siterow.cells[1].text; } also, know how make list expandable? clicking 1 list item cause div or open right below it, moving list items down bit make room? what you've described sounds close asp.net treeview control http://msdn.microsoft.com/en-us/library/d4fz6xk2(v=vs.80).aspx adding tree: treeview1.nodes.add(new treenode(site.name)); a pretty easy follow example here:

html - select option while option value equals another class's value via JQuery -

i want create jquery function if 1 drop down value equals value of class, selected. <input type="hidden" class="target" value="two people"></input> <select id="source"> <option value="one person">one person</option> <option value="two people">two people</option> <option value="three people">three people</option> </select> in above case, 2 people selected. because used iterated method generate select, can not apply classes option values. doable without classes in options? cheers. try function http://jsfiddle.net/9z5n5/ $(document).ready(function(){ var target = $('input.target').eq(0).val(); $('#source option').each(function(){ var option = $(this); if( $(this).attr('value')== target ) option.attr('selected', 'selected'); }) });

ruby on rails 3 - Application redirects to "cart" page after removing "Delivery" Step in Spree 2.0.0? -

i have deleted "delivery" step spree 2.0.0 checkout process. when fill address fields , continue application redirects me "cart" displaying cart empty though have added items cart. help? thanks. i found solution known issue. check on github https://github.com/huoxito/spree/commit/505e256967f1ae79fee61e2dc2eca8ad91cdd9cf here solution. step 1: override spree checkout_controller "before_payment" method creating decorator file in app/controllers/spree/checkout_controller_decorator.rb srep 2: paste following code in it. spree::checkoutcontroller.class_eval def before_payment if @order.checkout_steps.include? "delivery" packages = @order.shipments.map { |s| s.to_package } @differentiator = spree::stock::differentiator.new(@order, packages) @differentiator.missing.each |variant, quantity| @order.contents.remove(variant, quantity) end end end end thanks spree community.