Posts

Showing posts from March, 2012

vb.net - Parameter name is missing, While executing Function via code -

am trying execute following code dim transaction pgsqltransaction dim command new pgsqlcommand dim paramlastno pgsqlparameter = command.parameters.add("funcupdategtab03", pgsqltype.int) command.connection = myconnstr myconnstr.open() command.transaction = transaction transaction = command.connection.begintransaction() try command.commandtext = _ "select funcupdategtab03(" & sord & "," & gintacyrid & "," & gintbranchid & ");" command.executescalar() updategtab03 = paramlastno.value transaction.commit() return updategtab03 catch ex exception transaction.rollback() msgbox(ex.message, msgboxstyle.information, "rstari9 - updategtab03") catch ex exception transaction.rollback() msgbox(ex.message, msgboxstyle.information, "rstari9 - updategtab03") myconnstr.close()

c# - Updating DataSource of DataGridView - old rows not removed -

i have application datagridview. use sqlite database , set table datasource datagridview: i'm getting dataset using sqlitedataadapter , setting datasource: grid.autogeneratecolumns = false; grid.datasource = ds.tables[0].defaultview; grid.columns["criteriaid"].datapropertyname = "rowid"; grid.columns["criterianame"].datapropertyname = "name"; grid.columns["criteriadesc"].datapropertyname = "description"; grid.columns["criteriadirection"].datapropertyname = "direction"; so far seems working want. want update datasource, replacing rows other data dataset got source. wrote: var originalds = grid.datasource dataview; var originaltable = originalds.table; originaltable.rows.clear(); foreach (datarow row in ds.tables[0].rows) { var newrow = originaltable.rows.add(); foreach (datacolumn column in ds.tables[0].columns) { object item = row[column]; var columnname = co

oracle - PLS-00103: Encountered the symbol " " in a trigger -

this trigger , dont know whats wrong since gives me error create or replace trigger dk_enrolments_insert after insert on dk_enrolments each row declare cursor enrolment_cur(e_id dk_enrolments.enrol_id%type) select o.offer_id, a.assmnt_id dk_assessments a, dk_offerings o a.offer_id=o.offer_id , e_id=:new.enrol_id; enrolment_rec enrolment_cur%rowtype; begin open enrolment_cur(:new.enrol_id); loop fetch enrolment_cur enrolment_rec; exit when enrolment_cur%notfound; insert dk_deliverables values(deliv_seq.nextval, enrolment_rec.assmnt_id,:new.enrol_id); end loop; close enrolment_cur; end;​ my guess is cursor enrolment_cur(e_id dk_enrolments.enrol_id%type) this part: dk_enrolments.enrol_id%type may not resolve parser understands - dk_enrolments.enrol_id where defined? if not own object or there no public synonym need include schema. guessing externally defined column table.

swing - Select single cell JTable with mouse (eclipse) -

i know how can select single cell jtable mouse , after keep value of cell in variable. thank you can use mouselistener . read section swing tutorial on how write mouselistener more information , examples. when click on cell need mouse point mouseevent , convert cell in table. can data table. basic code be: int row = table.rowatpoint(...); int column = table.columnatpoint(...); object cellvalue = table.getvalueat(row, column);

sql server - Display Duplicate Records (TSQL) -

i struggling sql query return duplicate rows, example: employee_id store_no region 2531047 1671 e05 2544970 1254 w09 2566618 1625 e01 2566618 1635 e01 2566618 1835 e01 should like: employee_id store_no region 2566618 1625 e01 2566618 1635 e01 2566618 1835 e01 the above acheived following: select e.employee_id, e.store_no, s.region [usicoal].[dbo].[employee_str_asgn] e right join [usicoal].[dbo].[store] s on e.store_no = s.store_no order employee_id, region i have tried various options can find way remove these duplicates, not display them only... can advise if above possible? thanks in advance, charley. select * stuff st exists ( select 1 stuff xx xx.employee_id = st.employee_id group xx.employee_id having count(*) > 1 ) ;

How to restrict user to enter digits or special charater or blank or space in JTextField in Java Swing? -

i working on project in java swing. there text field user name. want validate text field user can't enter digits or special character or blank or space . in short want restriction such user can't enter other alphabets. database ms access , table name "test" , there 1 column named "sname". beginner, simpler techniques appreciated.thanks in advance. import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.sql.*; public class ex_test extends jframe implements actionlistener { public static void main(string[] args) { ex_test ob=new ex_test(); } jtextfield tf1; jbutton b1; int num1; public ex_test() { super("test"); setlayout(new flowlayout()); tf1=new jtextfield(20); add(tf1); b1=new jbutton("ok"); add(b1); setsize(500,500); setvisible(true); b1.addactionlistener(this); } public void actionperformed(actionevent ae) {

javascript - Change the embedded YouTube player which is affected by custom buttons -

in document, have 2 separate embedded youtube players. first has id player1 , second has id player2 . <div id="1" class="track"> <iframe width="560" height="315" src="//www.youtube.com/embed/1g4isv_fylg?enablejsapi=1" frameborder="0" allowfullscreen id="player1"></iframe> </div> <div id="2" class="track"> <iframe width="560" height="315" src="//www.youtube.com/embed/fxsovfzyx28?enablejsapi=1" frameborder="0" allowfullscreen id="player2"></iframe> </div> i have 3 buttons: "play", "pause" , "skip". <div id="play-button">play</div> <div id="pause-button">pause</div> <div id="skip-button">skip</div> i want skip button change video affected play , pause buttons. at moment have this:

c# - Empty database table -

Image
i want insert values in "navn" row , "varenr" row in db table, when i'm clicking on button. have following code: private void button2_click(object sender, eventargs e) { using (sqlconnection cn = new sqlconnection(@"data source=(localdb)\v11.0;attachdbfilename=|datadirectory|\produkt.mdf;integrated security=true")) { try { sqlcommand cm = new sqlcommand(); cm.connection = cn; string col1 = textbox2.text; string col2 = textbox3.text; //generate sql statement cm.commandtext = "insert produkttable (navn,varenr) values (@col1,@col2)"; //add sqlparameters sqlparameter sp_add_col1 = new sqlparameter(); sp_add_col1.parametername = "@col1"; //data type in sqlserver sp_add_col1.sqldbtype = sqldbtype.nvarchar; //if data type not number,this propert

Upgrading to PHP 5.5 MAMP PRO -

Image
i'm not programming expert trying more dynamic website design using php. there's hashing library on new php version 5.5 want use on project right i'm running php 5.4. use mamp pro v 2.1.4 , after looking online , on site couldn't find step-by-step instructions on how update current php version i'm using. able download v5.5 folder site compatible version of mamp own. here's i've tried far... ok looked @ php info page. it looks need add new php version folder mamp/bin/php folder , did that. still doesn't show selection on mamp pro. so read somewhere mamp pro v 2.x gives 2 options php , should rename other folders in php file. i feel i'm missing important step. advice great! if have questions please ask. can figure out , post future non-program savvy web designers too. probably esasiest way copy php files somewhere else , use appdelete or similar, , delete mamp folder in applications folder , re-install. had after yosemite

pointers - Pass double by reference C++ -

given double skewangle; how pass variable function , have modified without returning value? my current function declaration looks this: mat findcard(mat& baseimage, double *angle) when try findcard(baseimage, *skewangle); i deceleration not found, can show me how can this? you're passing variable pointer, not reference, need pass address of variable function, such as: findcard(baseimage, &skewangle); if want pass reference, need change function declaration to: mat findcard(mat& baseimage, double& angle) and can pass variable directly function, such as: findcard(baseimage, skewangle);

libcurl - Minimal cURL cross compile for windows -

i want compile curl source use in windows dll project. this, installed virtual machine ubuntu, downloaded curl source http://curl.haxx.se/download/curl-7.37.0.tar.bz2 , unpacked , configured this: ./configure --prefix=$home/devel/curl3 --disable-ftp --disable-file\ --disable-ldap --disable-dict --disable-telnet --disable-tftp\ --disable-rtsp --disable-pop3 --disable-imap --disable-smtp\ --disable-gopher --disable-ares --disable-debug --without-ssl\ --without-zlib --without-libidn --build=i586-pc-linux-gnu\ --host=i386-pc-mingw32 --disable-shared so have output: configure: configured build curl/libcurl: curl version: 7.37.0 host setup: i386-pc-mingw32 install prefix: /home/victor/devel/curl3 compiler: gcc ssl support: no (--with-{ssl,gnutls,nss,polarssl,cyassl,axtls,winssl,darwinssl} ) ssh support: no (--with-libssh2) zlib support: no (--with-zlib) gss-api support: no (--with-gssapi) spnego supp

awk - Discrepancy in minimum value method -

linux novice here , first post. please forgive lack of clarity. i've got think simple minimum value problem discrepancy between 2 different methods: awking file file , awking using wildcards. i have 20,000 files (and growing) i'd find overall minimum value in second column. files have same prefix , in directories 1 level below executing script, using wildcards task quickly. example: awk 'min=="" || $2 < min {min=$2} end{print min}' */myfile.10* it takes 14 seconds execute, isn't finding true minimum. alternatively, stepped through each file of each directory , seem find correct minimum: min=1000000000.0 dir in `ls -d *run*/`; minlocal=1000000000.0 file in `ls -1 ${dir}myfile.*`; val in `awk 'nr==1 {print $2}' $genfile`; compare_result=`echo $minlocal" > "$val | bc` if [ $compare_result -eq 1 ]; minlocal=$val fileminlocal=$file compare_r

Ruby: Calling variable from array? -

how call variable array? trying make this: hello_world = "hey" array = [ '#{hello_world} ho' ] array.each |a| puts end say ["hey ho"] instead of ["\#{hello_world} ho"] . do below - hello_world = "hey" array = [ "#{hello_world} ho" ] array # => ["hey ho"] array.each |a| p end # >> "hey ho" single-quoted strings disabling interpolation, double-quote strings allow interpolation. remember - interpolation may disabled escaping “#” character or using single-quote strings : '#{1 + 1}' #=> "\#{1 + 1}"

node.js - Mongo Aggregation Framework with Mongoose raising Document Limit exception on simple Projection -

i have collection links (schema below) 500k entries. { url, title, owner, stars: { users: [{ name }]}, createdat } and not understand why simple aggregation projection var projection = { $project: { _id: 1, url: 1, title: 1, createdat: 1 } } link.aggregate([projection]).exec(resultcallback); raises mongoerror: exception: aggregation result exceeds maximum document size (16mb) could explain me ? i'm using mongoose (3.8.8) , mongodb (2.6.0) not sure if options available mongodb 2.6 , on-wards available in .aggregate() method implementation in mongoose. there should options "hash/object" available after pipeline argument. basically: var pipeline = [{ $project: { _id: 1, url: 1, title: 1, createdat: 1 } }]; link.aggregate(pipeline,{ cursor: true}, function(err,cursor) { }); or if mongoose doesn't reason raw node driver collection: var pipeline = [{ $project: { _id: 1, url: 1, title: 1, createdat: 1 } }]; link.collection

http - c# HttpClient does not store some cookies -

i'm using httpclient (system.net.http.httpcient) send requests , i'm using cookiecontainer hande cookies. webpages works fine, on other pages no cookies stored, although browser saves cookies when visit webpage. can here explain what's problem. ceddy maybe these pages redirect other url? cookies stored per url , hence it's possible "loose" cookie. to verify behavior may set request.allowautoredirect = false; and @ response object what's going on. if issue in case, can copy cookies 1 url other via cookiecontainer.

php - laravel 4: order object in template -

i'm trying order tests each user in descending order of created_at. tried in template didn't succeed. these tables: | users | | courses | | tests | | ---------- | |------------| |------------| | id | | id | | id | | name | | name | | name | | created_at | | created_at | | created_at | | user_id | | course_id | a user has many courses , course has many tests. i'll order tests in descending order of created_at. i tried in template: @foreach(user::find($user->id)->courses $course) @foreach(course::find($course->id)->tests $test) <p>name: {{$test->name}}</p> <p>date: {{$test->created_at}}</p> @endforeach @endforeach edit: there models user.php public function courses() { return $this->hasmany('course'); } course.php public function user()

scroll - loading the web page after scrolling -

i have huge web page (text) , takes lot of time load in browser. want loaded in steps , not @ time. should load x lines or whatever space available on screen. when start scrolling should load next x lines. huge web page, while loading page, browse hangs while, want avoid condition. please help. thanks, snk.

html - CSS animation help. Code explanation required -

Image
this question has answer here: how select classes spaces 5 answers i have been trying figure out piece of css animation . not able understand how did creator manage elongate toggle smoothly , without keyframe animation or transform property ? on html side, <b> tags doing ? if notice b tags have classes assigned them as <b class="b switch"></b> but same class selected css .switch{ } how work without "b" ? in advance. the animation css transition small delay. @ transition , transition-property , transition-delay calls in codepen example like: .check:checked ~ .switch { right: 2px; left: 22px; transition: .35s cubic-bezier(0.785, 0.135, 0.150, 0.860); transition-property: left, right; transition-delay: .05s, 0s; } and there's cubic-brezier transition

Clearcase and java process : changing view does not apply -

i have simple application, receives input user cc stream name, , suppose return content of specific file stream repository. i have tried doing using simple shell script: user enters stream name, java receives stream name, runs process runs script "myccscript.sh" contains "myinput=$1; cleartool setview $myinput" (or that). then try reading file , printing it's content in java side. but, after process finished - view not view user input - environment valid process ive created. how change clearcase view main java process? thanks! don't use cleartool setview . spawns sub-shell make other command not working (since executed in parent shell) always use full path of dynamic view: /view/aview/vobs/avob/.... you find same issue (and same advice "don't use setview") in: " dynamic views of clearcase not integrating in jenkins " " using ssh run cleartool command agruments on remote linux machine " " sc

multithreading - C# Delegate confusion and lack of knowledge -

i'm confused delegates, mind going eat itself. i want connect 2 different threads stuff one-another. obviously, "cross-thread calls unsafe" exceptions on place, demanding provide delegates instead. have read countless tutorials, documentations, examples, , die little more inside each example, because try it, does not work . here's set-up in simplified, code-free way: i have 2 threads . thread1 has class display_with_richtextbox that class has rich_text_box editing. that class has method int write_to_textbox_and_return_feedback(string text) . thread2 has class some_control_panel that class has text_box_of_doom text in it that class has button_of_magic call method other class add textbox's text richtextbox. upon execution of method, method return me int new total size of rich text box's text. . my problem is, can't figure out how make structure neatest. do explicitly manipulate controls via delegate or something, making

c# - iterate .net dictionary as object -

i have interesting problem. need write general (i'd use word "generic" conflict i'm after) routine can hand instance of dictionary object instance , iterate on content of said object dictionary , return content literal values. difficulty lies in method parameter of type "object", not dictionary. what need , can't figure out how do, way of iterating on dictionary<k, v> of arbitrary keys , values. easy if know types going in, say, origin of dictionary object object.gettype().getinterfaces() has typeof(idictionary) in results. won't know (and shouldn't need know) dictionary key type or value type. my current need process dictionary<string, someclass> ;. once list of keys can use foreach on each instance, figure out it's string , proceed there. values it'll instance of class (the class change again, can pass off set of methods extract class, extract properties of class , extract values). the main point of request obtain

android - Custom ListView does not show up -

i trying use custom listview inside fragment using custom cursoradapter , far unable display listview . what doing wrong? my fragment import android.app.fragment; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.listview; public class mylistfragment extends fragment { private customcursoradapter mcustomcursoradapter; private listview mlistview; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.fragment_mylist, container, false); //cursoradapter mcustomcursoradapter = new customcursoradapter(view.getcontext(), null, 0); //listview mlistview = (listview) view.findviewbyid(r.id.itemslist); mlistview.setadapter(mcustomcursoradapter); return view; }

c - My code for solving a maze goes into an infinite loop -

currently, have maze solving algorithm, , goes inifinite loop reason, have been on hours, can't seem figure out. doing wrong. going post of other necessary functions "could" poential problem along maze solving code. main.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include "mazegen.h" #define maxsize 100 int main(int argc, char**argv) { char*readfile; char maze[maxsize][maxsize]; int rows=0; int cols=0; int x; int y; file*fp; int counter; int length=0; counter = 0; fp = fopen(argv[1], "r"); if(fp == null) { printf("cannot open file\n"); exit(0); } readfile = malloc(sizeof(char)*maxsize); while(fgets(readfile,maxsize,fp) != null) { for(cols=0; cols <maxsize; cols++) { maze[rows][cols] = readfile[cols]; } rows++; counter++; } fclose(fp); len

python - Buildbot (from buildbot.net) : iCloud email not working as Status Target -

i setting buildbot use icloud email address status target : m = mail.mailnotifier(fromaddr="some_icloud_user@me.com", sendtointerestedusers=false, extrarecipients=["some_other_icloud_users@me.com"], usetls=true, relayhost="smtp.mail.me.com", smtpport=587, smtpuser="some_icloud_user@me.com", smtppassword="some_icloud_password") (the icloud email setup instructions here ). seems there's wrong tls/ssl handshake (from master/twistd.log) : 2014-06-09 00:43:34-0700 [esmtpsender,client] smtp client retrying server. retry: 1 2014-06-09 00:43:34-0700 [esmtpsender,client] unhandled error traceback (most recent call last): file "/users/ionut/work/buildbot/sandbox/lib/python2.7/site-packages/twisted-14.0.0-py2.7-macosx-10.9-intel.egg/twisted/internet/tcp.py", line 214, in doread return self._datareceived(data) file "/users/

python - Beautiful Soup .find Chinese Characters -

a_string = soup.find(text='围') soup.find_all('title', limit=1) # [<title>the dormouse's story</title>] soup.find('title') # <title>the dormouse's story</title> is there anyway can handle find chinese characters while using beautifulsoup? tried awhile , can't seem detect character. english character works fine source of website i'm working with <!doctype html> <html lang="zh-cn"> <head> <meta charset="gbk" /> when use find(text='something') search text nodes containing text 'something' , nothing else. if want find text contains particular letter, or match other regular expression must use regular expression pattern instead (like @yannis said): soup.find(text=re.compile(u'定')) note the re.u flag not required not changing behavior of special characters \s or \w. if case, might need provide it. see more on regular expre

.net - TFS 2013 Build - Adding log in Activity Log -

we using tfs build in 2013 automate build & deploy process. have added powershell scripts perform tasks copying of binaries central location etc. to add logs during process use "write-host" method. logs message in detailed log add them in activity logs can shown in ide during build process. how can achieve this? there parameter on activity @ verbosity shows. if change default of "high" "normal" should show in main log without having change build verbosity...

Manipulate HTML table data with multiple form field submission in PHP -

i've got table of data user can filter using variety of options. i can manipulate data form submission fine form accepts both $_post variables , in cases want user use one. mp | conservative | year elected for example: case #1 - user searches 'conservative` party doesn't care year elected. case #2 - user searches '2005' year of election doesn't care political party. case #3 - user searches 'conversative' party , in '2005'. and here's code: global variables if(empty($_post['year_elec'])) { $year = "show_all"; } else { $year = $_post['year_elec']; } if(empty($_post['party'])) { $party = "show_all"; } else { $party = $_post['party']; } the main table generation: if($year == "show_all" && $party == "show_all") { $query = "select * mps"; } else

jquery - Hiding all li items except one -

this question has answer here: jquery: hide children, show nth child? 1 answer hide $(this) via :not in jquery selector 4 answers how hide li items except one?? hide element s of li excepting particular li item will work?? $(".divmenu").find('li').css("display", "none"); $(".divmenu").find('li nth-child(4)').css("color", "red"); or this?? $(".divmenu").find('li:not(nth-child(4))').css("display", "none"); this 1 seems simple not working ..might wrong syntax?? please provide simple , efficient techniques $(".divmenu").not(":nth-child(4)").css("display", "none");

ruby on rails 4 - Change path to store image while using wysihtml5 and dragonfly -

i using wysihtml5 gem ( https://github.com/stefanoverna/activeadmin-wysihtml5 ). uses activeadmin-dragonfly gem. currently, stores images under public folder. using rails 4. need know way change path. in advanve:)

java me - j2me - How to create a master-details UI -

Image
i'm stuck in middle of j2me project because have no idea how done in other platforms, doesn't seem have direct solution in java me/j2me. what need (it doesn't matter if netbeans midp components, lwuit or plain lcdui) i have display list of customers (read web service) in sort of table, , when user navigates or down rows, "details" command must shown user can see details specific customer. image: i know can use list, problem lists allow single "cell" per item, not visually attractive table. as appreciated. thank in advance. as see have 2 options (i use lwuit) either allow user click cell thah chose in list , move screen details shown. same in project. add "details" command did here, , when user click left button command in actionperformed method check cell chosen , switch details screen i think second option less intuitive user, let him click , choose right row

php - MySQL query with boolean involved -

i wanna db, have table includes row called online, 0 , 1 "atributes". now, want update users ranks when online. tried update users set rank = "2" 'online' = true didn't work. tried update users set rank = "2" 'online' = 1 didn't work either. any answers?

oracle - how to apply NULLS LAST sorting in Grails/GORM -

i'm using grails detachedcriteria query, , need null values ordered last when sorting descending. against oracle database. based on research i've done far, there no direct support in hibernate, , hence not in grails: grails/hibernate: how order isnull(property) nulls last? and https://hibernate.atlassian.net/browse/hhh-2381 based on these, seems best option extend order class hibernate , add nulls last support myself. following path, can give me example of how exposed through grails? have little experience straight hibernate, examples given rather difficult follow. alternatively: there way in oracle specify nulls last sorting within table definition, via property on column or like? following example in grails criteria sort nulls @ last overriding hibernate addorder method def usercriteria = user.createcriteria() list results = usercriteria.list(max:limit, offset:offset) { eq("isactive", true) ilike("firstname",text+"

mysql - SQL query to get id of all elements in a tree -

can 1 suggest me how id of children of particular tree. table structure : table 1 : customer table 2 : hierarchy cid hid hid cid 1 1 1 null 2 2 2 null 3 3 3 2 4 4 4 3 5 5 5 2 6 6 6 5 7 7 7 7 table (customer) main element , table hierarchy maintain hierarchy of customer. i have give cid 2 root customer(parent). have cid child of cid 2 (given). expected result of above scenario 2,3,4,5,6 (2 given , these id set customer ids). actual answer query should return. i looked recursive query, procedure , join unable result. applicable my

sql - How do I execute a sequence of DB2 queries with a loop in the middle of them? -

i have been rolling around issue couple of days now. converting unix script uses sybase run in db2 instead , there loop in middle of it. the script contains several temp tables , update statements reliant came before it... followed loop , few more temp tables, update statements, etc... before query @ end populates end result , exports spreadsheet. the issue have can declare, insert, update, , select query blocks run @ same time. however, when try run @ once loop in middle, following error: " sql0104n unexpected token "end-of-statement" found following "ssion.min_assessment". expected tokens may include: "join ". line number=1. sqlstate=42601". the blocks run fine when ran individually... need of blocks run can place them in unix script scheduled. the structure looks this: declare temp_table_a; insert temp_table_a (select ... <table> ...); declare temp_table_b; insert temp_table_b (select ... temp_table_a, <table> .

In Microsoft SQL Server 2008, how can I generate specific XML tags? -

i not familiar generating xml code sql. after doing research, think need use statement like: for xml explicit , for xml raw or for xml auto , when run on auto , output row this: <student externalstudentid1="100003" lastname="smith" externalsiteid="place"/> that close need, has have specific opening , closing tags like: <student externalstudentid1="100003" externalsiteid="place"></student> when tried using elements , raw , or path ended opening , closing tags of elements. explicit threw errors , require rewriting entire select statement. can help? here code: select [externalstudentid1] studid, ( select [externalstudentid1],[externalstudentid2],[socialsecuritynumber],sbl.fn_tosbldate ( [birthdate]) [birthdate],[lastname],[firstname],[middlename],[informalname],[nametitle] ,[namesuffix],[externalcampusid],[externalsiteid] sbl.[student] student student.externalstudentid1=stud.externalstudent

c++ - What is the meaning of :: when nothing is prefixed to it? -

this question has answer here: why :: (scope) used empty left-hand operand? 6 answers i working on project involving sockets , qt. want use socket functions within sys/socket.h , not ones come qt. (this because following tutorial type stuff). the following code: if (connect(sock, (const struct sockaddr *) &servaddr, (socklen_t) sizeof(servaddr)) < 0){ //connect server caused following error: error: no matching function call 'mainwindow::connect(int&, const sockaddr*, socklen_t)' i fixed adding :: in front of connect() so: if (::connect(sock, (const struct sockaddr *) &servaddr, (socklen_t) sizeof(servaddr)) < 0){ //connect server as understand can use :: prefixed namespace mean in current use? found out how fix error forum post did not explain underlying thought behind it. other tricks using :: . it means t

visual c++ - Constructor and Destructor in C++ -

can tell why don't add "getch()" or "system("pause")", result right in first code else in second code display lack code in part destructor #include "iostream.h" class chucmung1 { public : chucmung1() { cout <<"chuc mung ban nam moi khang thinh vuong\n"; } ~chucmung1() { cout <<"nam tan ty\n"; } }; // first code int main() { chucmung1 object; system("pause > null"); } // second code int main() { chucmung1 object; } in first code, result "chuc mung ban nam moi khang thinh vuong" in second code, result "chuc mung ban nam moi khang thinh vuong nam tan ty" in case when console don't pause after display result. can tell why don't add "getch()" or "system(&

node.js - Array Manipulation with Mongoose -

i have schema employee , team. when update employee can change team. want happen update employee team id , remove employee every other team in database. employee can in 1 team business rule enforcing. these abridged schemas working with. employee schema var employeeschema = new schema({ id: { type: string, required: true, unique: true }, team: { type: schema.types.objectid, ref: 'team' } }); team schema var teamschema = new schema({ name: { type: string, required: true }, members: [{ type: schema.types.objectid, ref: 'employee' }] }); what want happen when change employees team, want remove employee every teams list of members, update employee's team reference, , update new team's array of members. current code var empmongoid = req.params.id; team.update({ $pull: { members: { _id:empmongoid } } }, { multi: true }, function (err, numberaffected, raw) { console.log(err,

access color data array from leptonica::PIX (c++) -

i'm loading image file memory using leptonica library, tried print color bytes: int main() { pix* pix = pixread("e:/white.png"); // empty image testing // print pixel color for(int row=0; row<pix->h; row++) { for(int col=0; col<pix->w; col++) { cout << pix->data[row*pix->w+col] << " "; // causes crash } } } why crash? or what's correct way of fetching color bytes? thanks.

android - When i change my api level my http request doesn't work -

when api level set 8, fine. when try set minsdkversion 11, http request xml doesn't work. got exception on if. here code: url url; string ciao=""; try { url = new url("myurl"); urlconnection connection = url.openconnection(); httpurlconnection httpconnection = (httpurlconnection)connection; int responsecode = httpconnection.getresponsecode(); if (responsecode == httpurlconnection.http_ok) { inputstream in = httpconnection.getinputstream(); documentbuilderfactory dbf = documentbuilderfactory.newinstance(); documentbuilder db = dbf.newdocumentbuilder(); document dom = db.parse(in); domsource domsource = new domsource(dom); stringwriter writer = new stringwriter(); streamresult result = new streamresult(writer); transformerfactory tf = transformerfactory.newinstance(); transformer transformer = tf.newtransformer(); transformer.transfor

javascript - disable preselected checkbox -

i have these lines of code select checkbox based on preselected flag if (objx.preselected) { string js = "if(document.getelementbyid('" + checkboxid + "').checked==false) document.getelementbyid('" + checkboxid + "').click();"; if (!page.clientscript.isstartupscriptregistered(checkboxid)) page.clientscript.registerstartupscript(this.gettype(), checkboxid, js, true); } after done need disable preselected checkbox. tried below did not work string js = "if(document.getelementbyid('" + checkboxid + "').checked==false) {document.getelementbyid('" + checkboxid + "').click();document.getelementbyid('" + checkboxid + "').disabled ='disabled';}"; update - disable checkbox problem it's not sent server. new asp.net programming, please suggest.any appreciated. do need javascript? otherwise like: if (objx.preselected) { checkbox.checke

How to change color of a listview's item and keep it unchaged until another item clicked from that listview android? -

how change color of list-view , keep unchanged until item clicked list-view? mainactivity.java public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.dialog); list<hashmap<string,string>> alist = new arraylist<hashmap<string,string>>(); for(int i=0;i<3;i++){ hashmap<string, string> hm = new hashmap<string,string>(); hm.put("iconimg", integer.tostring(drwbl_imgs[i]) ); hm.put("title",str_tit[i]); alist.add(hm); } // keys used in hashmap string[] = { "iconimg","title"}; // ids of views in listview_layout int[] = { r.id.img_listicon,r.id.txtvw_slidebar_listview}; // instantiating adapter store each items // r.layout.listview_lay

cordova - form file upload phonegap -

please upload basic working version of file upload script written in javascript phonegap friendly i've trawled internet trying figure out of stuff out there either out of date or newer stuff seems presume know inner workings of phonegap i grasp how transfer file cannot figure out how explore/access phones/tablets file system desired file upload in perfect world phonegap recognise form file upload button , convert works same if in web browser seems disable it. i'm using php sever side. i've spend days trying understand how it... massively appreciated! try following. file first , pass file path , type parameters. function gotfile(file) { uploadfile(file.fullpath,file.type); } function uploadfile(imageuri,type) { var options = new fileuploadoptions(); options.filekey = "file"; options.filename = imageuri; options.mimetype = type; var params = {}; //params.filepath = "files/"; options.params = params; var

ios - Collection Reuseable View not showing UILabel and UITextField -

Image
i have problem uicollectionview. i added header of 50 collection view add uilabel , uitextfield @ top. problem doesn't show when run code: my storyboard: what happens in ios simulator: thanks can help! try sequence of create collection view

mysql - SELECT 3 records per user group by on two columns -

i've been stuck in complex mysql query. here table: +--------------------------------------+ | id | user_id | category_id | post_id | +--------------------------------------+ | 1 | 23 | 5 | 213 | | 2 | 23 | 5 | 214 | | 3 | 23 | 5 | 215 | | 4 | 23 | 5 | 216 | | 5 | 23 | 6 | 217 | | 6 | 23 | 6 | 218 | | 7 | 23 | 6 | 219 | | 8 | 23 | 6 | 220 | | 9 | 55 | 13 | 221 | | 10 | 55 | 13 | 222 | | 11 | 55 | 16 | 223 | | 12 | 55 | 16 | 234 | | 13 | 55 | 22 | 235 | | 14 | 55 | 22 | 256 | | 15 | 55 | 22 | 261 | | 16 | 62 | 13 | 272 | | 17 | 62 | 13 | 273 | | 18 | 62 | 24 | 277 | | 19 | 62 | 24 | 278 | | 20 | 62 | 24 | 288

vb.net - Multidimensional array to grid style textbox with input box, including a sum of array and retrieve a specific day -

Image
so, can't figure out how user able retrieve number of products completed day of week of month. after execution of 4 weeks done, user prompted enter week , day of week inputbox’s wish retrieve information for. assume users enter day of week in string format, such “monday” or “tuesday” etc there have input box, , that's thing, can't figure out how code user can chose day , week inputting inputbox. have make 2 input boxes retrieve day , week? toys(day, 0) = inputbox("enter day") toys(0, week) = inputbox("enter week") also, need full sum of whole array, when @ picture, has total of 210 , can't figure out how full sum. this code output far. private sub btnexecute_click(sender object, e eventargs) handles btnexecute.click dim toys(4, 3) string week integer = 0 3 day integer = 0 4 toys(day, week) = inputbox("please enter value day " & cstr(day + 1) & " in week " & cs

refresh of one report region in apex -

i have page 10 clasic reports , 10 form region (one each report). on each form region button dynamic action witch insert data in table. problem how refresh 1 report after insert data new data shown in report. tried add true action in dynamic action (refresh region) has no effect. had idea? apex version 4.2 thanks in advance. one thing can is. assign static id every reports, 'myreport1', 'myreport2' or ever want (ignore if did). on each button click when updating database, add 1 more true action execute javascipt code in existing dynamic action . and put $('#myreport1').trigger('apexrefresh'); repeat of reports relevant report id .

matrix - Understanding APL's Inner Product -

here excerpt mastering dyalog apl book, chapter on inner products : hms variable contains duration in hours, minutes, , seconds: hms ← 3 44 29 chapter j – operators 397 convert seconds. shall see 3 methods now, , 4th method given in chapter. horrible solution (3600×hms[1]) + (60×hms[2]) + hms[3] apl solution +/ 3600 60 1 × hms excellent solution inner product 3600 60 1 +.× hms it says the second , third solutions equivalent in terms of number of characters typed and performance . as understand it, apl programmers should use inner product , outer product , as possible. correct? can give example when using inner product lead performance gains? happens when use inner product (on lower level)? first solution presented below horrible because doesn't use apl syntax in proper way or have worse performance? i know there few questions want asking in general how inner/outer products work , when should apl