Posts

Showing posts from March, 2013

mongodb - Designing a database for querying by dates? -

for example, need query last 6 months earliest instance each day (and last day earliest instances in each hours, , last day minutes). thinking of using mongodb , having nested structure like year:{ month:{ day: { hour: { minute: [array of seconds] but first instance have sort array costly. there easier way? would better have date field. and query like: find(date: {$gt : 'starting_date', $lt : 'ending_date'})

javascript - Automatically translate web page -

how can automatically translate web page when entered it. this translator there connected dropdown. <script type="text/javascript"> function googletranslateelementinit() { new google.translate.translateelement({pagelanguage: 'da', includedlanguages: 'da,de,el,en,es,fi,fr,it,ja,ko,nl,no,pl,ru,sv,uk,zh-cn,zh-tw', layout: google.translate.translateelement.floatposition.top_left, gatrack: true, gaid: 'ua-32978177-1'}, 'google_translate_element'); } </script> <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googletranslateelementinit"> </script> i want translate automatically danish (da) english (en). have read function: http://www.blabla.com/#googtrans(da|en) where should implement it? you need create div called google_translate_element mentioned in first script this: <div id="google_translate_element"> here area google fetches

ruby - Why do I get "FasterCSV::MalformedCSVError: Illegal quoting error"? -

i'm driving myself slight crazy one. i trying import csv file: uploaded_io = file.read("amazon_import.csv") fastercsv.parse(uploaded_io, {:headers => true, :quote_char => '"', :col_sep => "\t"}).each |row_data| new_record = amazonsale.new( 'asin' => row[0], 'title' => row[1], 'barcode' => row[2].match(/\d+/), 'price' => row[4], 'discount' => row[5], 'cost' => row[7], 'active' => row[8], 'product_group' => row[9], 'release_date' => row[10], 'customer_ordered_units' => row[11], 'shipped_units' => row[12], 'shipped_date' => date.today - 1, 'shipped_cogs' => row[14], 'sellable_on_hand_units' => row[15], 'unsellable_on_hand_units' => row[16], 'customer_owned' => row[17], 'total_inventory_uni

backbone.js - Backbone View returns as a string: function (){ return parent.apply(this, arguments); } -

good day. have next problem. router request view returned "function (){ return parent.apply(this, arguments); }" , have no access methods. router.js: // filename: router.js define([ 'jquery', 'underscore', 'backbone', 'views/page/pageview' ], function($, _, backbone, pageview){ var approuter = backbone.router.extend({ routes: { "": "index", "page": "page" }, index: function() { //console.log(pageview); pageview; }, page: function() { alert("page");//welcomeviewinstance.render(); } }); initialize = function(){ var approuterinstance = new approuter(); backbone.history.start(); }; return { initialize: initialize }; }); view.js: define([ 'jquery', 'underscore', 'backbone&

python 3.x - How do you set up formatting in vim? -

earlier, when used open .py files in vim on ubuntu, formatted, separate colours separate segments of program. now, when using vim on ubuntu, text in .py file appears black. how can correct this? check man vim . in nutshell, find copy of vimrc file, 1 might under /usr/share/vim/ subtree. may named vimrc_example.vim . copy home directory , rename .vimrc .

python - How to use extra arguments passed with Variable file - Robot framework -

in robot framework user guide there section describes how pass variable files , possible variables if needed. example: pybot --variablefile taking_arguments.py:arg1:arg2 my question can use these possible variables arg1 , arg2 in taking_arguments.py file afterwards , if can how? right have this: pybot --variablefile taking_arguments.py:arg1:arg2 taking_arguments.py contents: ip_prefix = arg1 but results in nameerror: name 'arg1' not defined the way use variables in argument file using --variablefile filename.py:arg1:arg2 syntax have variable file implement function get_variables . function passed arguments specify on command line, , must return dictionary of variable names , values. for example, consider following variable file, named "variables.py": def get_variables(arg1, arg2): variables = {"argument 1": arg1, "argument 2": arg2, } return variables this file creates 2 r

c++ - How to Show Bangla Font(UTF-8) in QTextBrowser / QTextEdit? -

when try output bangla text, turns out in empty box without showing bangla/unicode properly. tried this, it's not showing correctly ui->textbrowser->settext("কেন কেন")); ui->textedit->settext("হয় না ক্যান???")); first, go qtcreator's properties ->text editor->behavior->file encodings , set "default encoding" "utf-8". second, write this: ui->textbrowser->settext(qstring::fromutf8("কেন কেন"))); ui->textedit->settext(qstring::fromutf8("হয় না ক্যান???"))); third, forget wrote , use qt's translation system .

java - Thread Safety - declaring a new thread inside method local block -

i curious if following code thread-safe: public static void methoda () { // given mutableobject not thread-safe (no lock/synchronization used) mutableobject mo = new mutableobject(); mo.setsomevalue(100); // set int value // mutablelist variable must final in order pass thread block final list<mutableobject> mutablelist = new arraylist<mutableobject>(); mutablelist.add(mo); thread t = new thread() { @override public void run() { (mutableobject e : mutablelist) { e.printintvalue(); // print 100 or 0? } } } t.start(); } so, here question. not sure whether contents reachable* "mutablelist" reference visible new thread though there no explicit synchronization/locking used. (visibility issue) in other words, new thread print 0 or 100? print 0 if not see value 100

c# - Skip validation with controlbox[X] of winform? -

this question has answer here: how set causesvalidation false close[x]box of windowsform? 2 answers i have validating event private void employeeidtextbox_validating(object sender, canceleventargs e) { if (employeeidtextbox.text == "") { messagebox.show("please enter employeeid.", "invalid employeeid"); } } and able skip validation cancelbutton private void cancelbutton_click(object sender, eventargs e) { autovalidate = autovalidate.disable; close(); } is possible skip validation controlbox[x] of windowsform? tried set causesvalidation of form false not working. try formclosing not working. private void form1_formclosing(object sender, formclosingeventargs e) { if (employeeidtextbox.causesvalidation) { employeeidtextbox.causesvalidation = false; close(); } } i gave answer in

vb.net - error deleting from database -

Image
i have sql server compact database created through vs 2010 (local database file option). on form load ( categoryform ) load values database datagridview1 . add buttoncolumn programmatically use delete part. problem this: on initial form load, first time press delete on row, works. if press again not work. the second time click button, printed text on msgbox , text of button! (delete) (screenshot included) p.s mentionted below, when comment-out stuff, correct values returned. what tried: commented out sql-related, left part rowindex , value @ specific cell @ index. print them both on msgbox . values correct. example, 0 index , value test first row text test . below progress screenshots: cellcontentclick method: private sub datagridview1_cellcontectclick(byval sender object, byval e system.windows.forms.datagridviewcelleventargs) handles datagridview1.cellcontentclick dim string 'if e.columnindex = 1 'if e.rowindex >= 0 , e.rowindex &l

jquery - Accessing various child elements of a table -

i trying access elements on same <tr> level seen below <tr> <td ><input type='text' value='{$result['name']}' name='itemname' /></td> <td><input type='text' value='{$result['quantity']}' name='itemquantity' /></td> <td><input type='text' value='{$result['cost']}' name='itemprice' /></td> <td><input type='submit' name='submit' value='submit'/></td> </tr> i want click on submit button , each value 3 input fields sent on post connection, far tried accessing these values doing $(this).parent("tr").children("td input").val(); which results in undefined result. parent selects parentnode element of selected element( if matches specified selector ), can use closest method: $('tr input[type=submit]').click(function(event) {

android - wait a little before finish my activity -

what's best way wait before activity finished? in fact launch new activity named masternumber mainactivity "startactivityforresult". masternumber send sms , shows toast "sms sent", masternumber activity closed toast showed in mainactivity. here content of mainactivity: //lorsqu'on clique sur le bouton "send" button button1 = (button) findviewbyid(r.id.masterbutton1); button1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { try { smsmanager smsmanager = smsmanager.getdefault(); smsmanager.sendtextmessage(automatikrn, null, "#00#", null, null); toast.maketext(getapplicationcontext(), "sms sent!", toast.length_long).show(); } catch (exception e) { toast.maketext(getapplicationcontext(), "sms failed, please try again later!", toast.length_long).show();

java - RoboJDE PingSensor Following Hand -

here code, cannot follow hand example. import com.ridgesoft.intellibrain.intellibrain; import com.ridgesoft.io.display; import com.ridgesoft.intellibrain.intellibraindigitalio; public class pingsensor { public static void main(string args[]) { try { display display = intellibrain.getlcddisplay(); display.print(0, "ping test"); intellibraindigitalio pingport = intellibrain.getdigitalio(3); pingport.enablepulsemeasurement(true); while (true) { pingport.pulse(20); thread.sleep(50); display.print(1, "time: " + pingport.readpulseduration()); thread.sleep(450); } } catch(throwable t) { t.printstacktrace(); } } } the code compiles, when try run it, not move. need make code this. i need 2 parameters, measure max distance , min distance, if @ max distance should move forward, while @ min distance, should move backwards

visual studio 2008 - How to build an Excel file with login connexion -

i looking way build kind of excel application based on single excel file, used different kind of users different level of authorization. in ideal world, user open excel file , username , password asked. then, when user connected, sees information in file corresponding level of authorization. i know can protect excel file password, or protect file reading need connexion login. i don't know how cross login connexion , excel file, possible ? have ideas me begin ? fyi : can work visual studio 2008, excel 2010 , sharepoint 2010. regards, jay you add userform workbook which, when called workbook_open() event, asks user login credentials. use data show/hide relevant data in workbook.

c# - Adding values from 2 byte arrays -

i want add signals 2 wav files , have been converting each byte short , dividing 2 avoid overflow, add 2 short values , reconvert byte before writing output file. the wav files in question human speech files - not pure sinusoidal waves. i making sure bytes same channel added together. bytes in 0th position 1 file mixed bytes numbered position second file , odd positioned elements added odd pistioned elements other file. my difficulty when use 1 wav silence (0 sound), process works perfectly, , output sound audible when both wav files have sound, resultant becomes loud hisss. questions: why amplitude of signal increase though averaging out ? why signal sampled @ same rate input stay audible when mixed 0 values totally messed when mixed other audible signal.? i want entirely in c# , not want use naudio/ nyquist/ or other libraries can ? code int idx=0; int overlappct=20; byte[] arrfile = {}; byte[] arrfilenext = {}; byte[] arrfileout = {}; string tmpoutfile = a

WinJS OData JSON -

try send data database web service error: primitive values of type 'edm.decimal' , 'edm.int64' must quoted in payload. make sure value quoted here code: var newentry = { datum: entrydate, monat: parsefloat(entrymonth), taetigkeit: document.getelementbyid("addwork").value, total: parsefloat(document.getelementbyid("addtotal").value), totalv: parsefloat(document.getelementbyid("addtotalv").value), in_auswertung: 0, teil_projekt_id: parsefloat(document.getelementbyid("addsubproject").value), projekt_id: parsefloat(document.getelementbyid("addproject").value), timestamp: entrydate, sauftraggeber: document.getelementbyid("addcontractor").value, iidbenutzer: parsefloat(298),//sessionstorage.getitem("userid"), akt_id: parsefloat(document.getelementbyid("addactivity").value) }; winjs.xh

Best way to implement Timer in Android? -

i doing math game, , have 25 question user answer. so, want mesaure how time user needed solving that? so need timer, stopwatch ability pause time when user click on button. i saw few implementations chronometer, task? if looking figure out how long user took don't need use special object honestly. just make long variable , store starttime system.getcurrenttimeinmillis(); long starttime = system.currenttimemillis(); //do problems here long endtime = system.currenttimemillis(); long totaltime = endtime - starttime; log.i("tag", "it took "+ totaltime / 1000 + " seconds complete problems"); to pausing you'll need long tracks how long paused , subtract totaltime.

android - Stop or release MediaPlayer while it is still preparing -

is bug or not possible release, stop or kill mediaplayer while it's preparing? i have instance of mediaplayer running in service , stops fine if stop, release, set null, while mediaplayer in prepared state . doesn't if stop, release, set null if it's in preparing state . onprepared() called after stop, release, setting null. workaround this? i think it's common use case when user wants stop mediaplayer before has finished preparing. by looking @ mediaplayer documentation , you're not allowed call stop() on uninitialized object; makes sense because can't stop not running/ready yet. on other hand, release() seems trick after looking @ the source code of mediaplayer . but doesn't harm add boolean flag indicate there no need mediaplayer object anymore , use flag release object if onprepared() gets called. a pseudocode this: public void cancel(){ mcancel = true; } public void onprepared(mediaplayer player){ if(mcancel){

java - Take values from ArrayList<HashMap<String, String>> -

i have problem getting value arraylist<hashmap<string, string>> . my code is: arraylist<hashmap<string, string>> myarraylist; and then: hashmap<string, string> map = new hashmap<string, string>(); map.put(tag_id, id); map.put(tag_name, name); myarraylist.add(map); if want name, example, tried follow obtain runtime error (the application crashes): system.out.println(myarraylist.get(1).get(tag_name)); how can solve it? thank much! system.out.println(myarraylist.get(1).get(tag_name)); arraylist 0-based. get(0) instead.

Ruby on Rails. Understanding loops -

i'm getting somewhere ror. want clarify things regarding loops. i've created 'inputs' controller contains methods let user create, read, update , delete database entries. i have 'inputs' view renders html frontend. in view following loop: <table> <% @inputs.each |input| %> <tr> <td><%= input.title %></td> <td><%= input.content %></td> <td><%= link_to 'show', input %></td> <td><%= link_to 'edit', edit_input_path(input) %></td> <td><%= link_to 'destroy', input, method: :delete, data: { confirm: 'are sure?' } %> </td> </tr> <% end %> </table> i understand how loops work conceptually, i'm bit lost on this. i think @inputs 'points code' (better way of expressing that, please?) towards inputs controller the methods used loop live. inside inputs controller there in

c++ - Socket doesn't receive complete data on HPUX -

i don't understand going wrong here, hope may spot missed. i'm writing user daemon accepting client develop in java. client connects , sends username password. developed code under cygwin , there works. daemon sends introduction, client sends username , password , daemon responds either disconnecting client or sending ok (not yet done). when test using cygwin works on localhost. ported code hpux , client can connect , receives introduction daemon. when client sends it's username , password doesn't work anymore. daemon receives 1 byte , when tries read again -1 result eagain , nothing else. client doesn't show error , on daemon side there none. when step through code gdb messages revceived completely. :( the code use this, if more info needed can add it: int tcpsocket::receive(socketmessage &omessage, int nbytes) { int max = getsendbuffersize(); if(nbytes != -1 && nbytes < max) max = nbytes; socketmessage sb(max);

asp.net - Tablet + web app with USB-connected devices, or a pipe dream? -

i have .net winforms app wherein laptop connected both scale , gps antenna via usb. crazy think have instead web app , on tablet? we're looking make things thinner , smaller (this goes in truck.. driver doesn't need bulk of keyboard either). obviously tablet have have usb port (some do, don't). "stickiness" usb devices, i'd have have, what, silverlight control on asp.net page? more trouble worth? thanks thoughts/advice. you write activex control or browser plugin use usb port (silverlight might not able need). unfortunately these controls have installed on machine manually (unless want lower security settings browser). might better off using clickonce winforms application simplify deployment of new versions , keep using existing codebase. if need read gps data, should use html5 geolocation api: demo , specification

django - why there are two process when i run python manage.py runserver -

wenzhixue 80384 0.4 1.1 2464788 22584 s001 s+ 10:37am 0:01.06 /usr/bin/python manage.py runserver 0.0.0.0:8000 wenzhixue 80383 0.0 0.8 2451208 17300 s001 s+ 10:37am 0:00.62 python manage.py runserver 0.0.0.0:8000 every time when run python manage.py runserver, brings 2 process. why? maybe because of autoreload option try run --noreload django-admin.py runserver --noreload

javascript - Ajax Inside For Loop -

in chrome extension writing need validate objects have stored in localstorage against server . created loop sends data each localstorage element , needs response . code this: (var key in localstorage) { if (! condition ) continue; var httprequest = new xmlhttprequest(); httprequest.onreadystatechange = function() { if (httprequest.readystate === 4 && httprequest.response == 200) { 'key' loop } } }; var url = base_path ; httprequest.open("post", url); httprequest.send(some data); } however while debugging seems in ajax response , 'key' loop isn't key need : expecting same key loop matches each ajax call , got same key ajax calls . doing wrong or expecting isn't possible ? thought since ajax inside closure function , values kept in memory or of sort . extract actual ajax call separa

vb.net - Check for a specific datatype in a datagridview -

is possible check if datagridview cell contains specific datatype. can’t find right syntax this. want. if datagridview1.columns("name").valuetype = string end if first loop through rows in datagridview, loop through cells in row. when looping through cells, check if cell.value string, integer, decimal , on. here how: each row datagridviewrow in datagridview1.rows each cell datagridviewcell in row.cells if typeof (cell.value) string msgbox("this cell string!") end if next next alternatively can loop through rows , immediatly check cells setting index... row.cells(0).value take first cell's value: each row datagridviewrow in datagridview1.rows if typeof (row.cells(0).value) string msgbox("string again!") end if next

IntelliJ: how to access files in bin-directory? -

i'm working on project in java1.6 need read out .txt-file. the line of code looks this: l = new lexer("bin/test.txt"); the file test.txt located in directory "bin" "src" is, too. on partner's eclipse runs correctly not on intellij12ce. seems file can't found. i'm using macbookpro osx10.8 many in advance, rbn when eclipse builds project - compiles *.java files exist under "source" directory , puts resulting *.class files output directory, , copies else in "source" directory isn't .java file output directory. when idea builds project - same kind of thing *.java files, copies restricted set of other kinds of files source directory output directory. you can find definition of kind of files idea copy under: "/settings/project settings/compiler/resource patterns". in there, see set of filename patterns "? .properties;? .xml;? .gif;? .png;? .jpeg;? .jpg;? .html;? .dtd". no

multithreading - Visual C# BackgroundWorker Object is currently in use elsewhere -

hello , reading thread! seek advice code because after lot of searching couldn't find solve particular problem. i've googled , searched on stackoverflow , solutions somehow didn't work (or didn't know how implement them). here code: 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; using aforge.video; using aforge.video.directshow; using system.threading ; namespace motion_detection { public partial class form1 : form { private filterinfocollection videocapturedevices; private videocapturedevice finalvideo; private void finalvideo_newframe(object sender, newframeeventargs eventargs) { bitmap video = (bitmap)eventargs.frame.clone(); picturebox1.image = video; } public form1() { initializecomponent();

.net - Globalization in WPF without using LocBaml -

i need implement globalization feature in wpf application.i referred many forums suggesting use locbaml in msdn.i don't want use locbaml.we have own localization tool create satellite assemblies. now have satellite assembly.how works in wpf framework.if take asp.net web application,we recommended deploy satellite assembly @ bin folder.if culture set,worker process loads localized string satellite assembly @ run time whereas in wpf application not happening.i have deployed satellite assembly @ exe location. resourcecheck.exe myapplication.resources.dll - default culture de-ch\myapplication.resources.dll - german culture i not seeing localized strings.i displaying string resource assembly in code. <window x:class="resourcecheck.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:resources="clr-namespace:resourcecheck.resour

how do i get div childs from jquery/javascript in this example? -

i'm trying access div's child using jquery's .eq() function, looks something's wrong, despite fact not throwing error, looks when .innerhtml desired child div element, nothing happens. this html: <div id="status_container"> <div class="status_item_wrapper"> <div class="status_item_title"> <span>title 1</span> </div> <div class="status_item_content"> <table id="box-table"></table> </div> </div> <div class="status_item_wrapper"> <div class="status_item_title"> <span>title 2</span> </div> <div class="status_item_content"> <table id="box-table"></table> </div> </div> </div> and javascript: function dosomething(message)

web services - How to get and order rows from different tables with a limit and offset? -

i'm creating web services return list of chats , notifications. user can send input page number , number of items display per page, 2 types of objects can returned (from newest latest) , must displayed in same list. i have 2 tables chat , notification create table chat ( idchat serial not null, idinterest integer not null, idowner integer not null, iduser integer not null, creationdate, editdate, constraint pk_chat primary key (idchat) ) create table notification ( idnotification serial not null, message character varying(255) not null, creationdate date not null, datefinvalidite date not null, idcompte integer not null, idtypenotification integer not null, sender integer not null default 0, constraint pk_notification primary key (idnotification) ) i create view groups chats , notifications, composed of id ( idchat or idnotification ), date ( creationdate ), , boolean ischat but don't know if right solution. problematic if have re

ruby on rails - How do I match all "and" using ActiveRecord? -

i need activerecord query match items in params[] array. my current method gives results based on finding of tags, not "match all" class product < activerecord::base has_many :tags def self.filter_by_params(params) scoped = self.scoped scoped = scoped.includes(:tags).where(:tags => {:id => params[:t]}) if params[:t] scoped end end i attempting write below, gives me no results. can can set me in right direction? there way " , " ? def self.filter_by_params(params) scoped = self.scoped.includes(:tags) params[:t].each |t| scoped = scoped.where(:tags => {:id => t}) end scoped end if understand right params[:t] array of ids. if that's case can do: def self.filter_by_params(params) scoped = self.scoped scoped = scoped.tags.find_all_by_id(params[:t]) scoped end or just: def self.filter_by_params(params) tags.find_all_by_id(params[:t]) end

refactoring - Java Data-Entity model: Constructing general types -

i have had trouble using general type in static method. all comments on source code welcome, ones improve code. not planning on using external framework, apart jdbc, keep still simple, please not put emphasis on that. my view on not using external frameworks supported fact operations using on database minimal: inserting data updating data retrieving all fields. (and putting in different sql query select fields retrieve i not plan on making full framework, know not supporting everything. speed of retrieving fields neither real issue, pretty done on server bootup, , if used @ other time done in background task not care when finished. entity.java: abstract public class entity<keytype, datatype> { protected keytype key; protected list<object> data; public entity() { data = new arraylist<>(); } //abstract public static map<keytype, datatype> getall(); protected list<object> createdata(final dataaction data

java - NAO Robotics student compile error: Can't load IA 32-bit .dll on a AMD 64-bit platform -

i teacher working students on nao robot in java. using eclipse. error pops anytime student attempts compile program: exception in thread "main" java.lang.unsatisfiedlinkerror: c:\users\username\desktop\jnaoqi-1.14-win32-vs2010\lib\jnaoqi.dll: can't load ia 32-bit .dll on amd 64-bit platform all of reference library paths correct. kicker can log same exact system, map same exact libraries , compile without issues. seems there permissions in students can't access need. does has insight might me track down root of issue? thank in advance. it default java in eclipse setup 32-bit, while students getting 64-bit version of java. suggest check preferences in eclipse , ensure using same architecture (i.e. 32-bit).

strtok on a local variable in C -

i encountered interesting problem in c, when calling external method main tries strtok local (main) string passed reference. if strtok string in main, works expected, if call external method, fails segfault. valgrind's output on accessing first element of strtok result: address 0xfffffffffeffebc0 not stack'd, malloc'd or (recently) free'd --- test.c --- extern void tt(char* x); main(argc, argv) int argc; char *argv[]; { char line[5000]; // if uncomment following 2 lines , comment above works expected // char * line; // line = malloc(5000); strcpy(line, "hello world"); printf("%d\n", sizeof(line)); tt(line); } --- test2.c --- void tt(char* l) { char* x = strtok(l, " \t"); printf("%p\n", x); printf("%c\n", x[0]); } compile by gcc -c test2.c -o test2.o gcc test.c test2.o imho should print out like: ./a.out 0x..... h but instead segfault on printing &q

sql - How to merge a select statement with a new dynamic values as columns? -

in sql server code, have select statement select distinct a.hirelastname, a.hirefirstname, a.hireid, a.position_id, a.barnumber, a.archived, a.datearchived, b.position_name newhire join position b on a.position_id = b.position_id join workperiod c on a.hireid = c.hireid a.archived = 0 , c.inquiryid not null order a.hireid desc, a.hirelastname, a.hirefirstname and want add new column it. column not column table, used store float calculation make existing columns. the number calculated this: @acc a.hireid above select statement. cast((select count(*) hire_response hireid = @acc , (hireresponse = 0 or hireresponse = 1)) float) / cast((select count(*) hire_response hireid = @acc) float) how can this? thanks. this should it select distinct a.hirelastname, a.hirefirstname, a.hireid, a.position_id, a.barnumber, a.archived, a.datearchived, b.position_name, cast((select count(*) h

c# - Is a 'method' which is not valid in the given context error -

this example form "head first csharp - page 113" i'm getting following error error 1 'guys.form1.joescashlabel(object, system.eventargs)' 'method', not valid in given context c:\temp\guys\guys\form1.cs 20 12 guys and same other 2 labels this code: 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 guys { public partial class form1 : form { guy joe; guy bob; int bank = 100; public void updateform() { joescashlabel.text = joe.name + "$" + joe.money; bobscashlabel.text = bob.name + "$" + bob.money; bankcashlabel.text = "bank has" + bank; } public form1() { initializecomponent(); guy bob = new guy(); bob.name = "bob&qu

javascript - Input data cannot be processed in the non-chronological order - Error being thrown from WinRT -

i using below code detecting gestures var inputmanager = (function () { var = {}; var gr; var canvas; var manipulating = false; that.manipulationhandler = function (evt) { if (evt.delta) { // } }; that.ismanipulating = function () { return manipulating; }; that.processdown = function (evt) { gr.processdownevent(evt.currentpoint); }; that.processmove = function (evt) { gr.processmoveevents(evt.intermediatepoints); }; that.processup = function (evt) { gr.processupevent(evt.currentpoint); }; that.processmouse = function (evt) { gr.processmousewheelevent(evt.currentpoint, evt.shiftkey, evt.ctrlkey); }; // following functions registered handle gesturerecognizer gesture events that.manipulationstartedhandler = function (evt) { manipulating = true; that.manipulationhandler(evt); }; that.manipulationdeltahandler = fun

rest - Ruby -> RestClient::Resource -> post -> arguments -

i constructed restclient wrapper require 'json' require 'rest_client' $url_common_part = 'http://host:port/cgi-bin/cgi_script' class grabber def initialize @site = restclient::resource.new($url_common_part) end def post ( path, params ) site_and_path = @site["#{path}"] payload = params.to_json puts "\n", payload response = site_and_path.post ( payload, headers = { 'my-header' => 'my-value', 'content_type' => 'json', 'accept' => 'json' } ) return response end end and works well, post gives error syntax error, unexpected ',', expecting ')' (syntaxerror) may suggest doing wrong? the problem in call post: response = site_and_path.post ( payload, headers = { &#

c# - Workaround to add a default parameterless constructor to a struct -

let me describe problem - have struct wraps unmanaged handle (let's call mem). need handle call particular method (say "retain" or alternatively, maintain reference count) whenever copied. in other words, need struct maintains reference count internally (i have mechanism externally well, need way invoke mechanism). unfortunately, c# doesn't let me in way. i cannot make mem class because pass array of these structs unmanaged code , not want convert them 1 one before passing them in (just pin , pass). does know of workaround (il weaving, etc) can applied add behavior in? believe il doesn't prevent me doing this, c#, correct? i happy answer questions framework , restrictions have, not looking - "please change design" or "don't use c# this" answers, much. edit: hosted work answer on github: nopencl library . based on comment, determined following appropriate long-term course of action problems being discussed here. ap