Posts

Showing posts from July, 2011

Google Drive SDK - JavaScript : How to list SHARED FILES (not shared with me) -

i'm looking way of finding list of user's shared files on google drive sdk using javascript. important: not looking list of files 'shared me'. what have @ moment lists files 'shared me' , i'm wonder if there way of changing 'sharedwithme' query string parameter, list files have shared?? // load api , make api call. display results on screen. function makeapicall() { // load drive gapi.client.load('drive', 'v2', function() { // request files (q query string, filter files) var request = gapi.client.drive.files.list ( {'maxresults': 200,'q':"trashed=false , sharedwithme"} ); any great, thanks. dave the answer is: list email address of user have shared files in 'readers' parameter in q query string. (note: 'readers' collection of users have permission view file)e.g.: // check if recipient in list of readers var request = gapi.client.drive.files.

webview - Android - Using Fragments -

i'm new java, , android development. want able display local page page within app using fragments (because don't want entire app web based). so, i've gone arview.xml , added fragment: <fragment android:id="@+id/fragment_bbc" android:name="android.webkit.webviewfragment" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" /> now, want place web page in there (for now, i'll use bbc website). within 'oncreate(bundle savedinstancestate)' have this: webfrag = (webviewfragment) mguiview.findviewbyid(r.id.fragment_bbc); mwebview = (webview) mguiview.findviewbyid(r.id.fragment_bbc); mywebview.loadurl("http://www.bbc.co.uk"); i have errors of 3 of lines, saying can't resolved. where going wrong? thanks you shouldn't u

javascript - How do I call my viewmodel function from its view - child of viewmodel (knockout.js) -

i have view called agency , viewmodel. viewmodel has property called agency data contained. data has children on view function doesn't fire when child. <section class="view"> <header> <button class="btn btn-info btn-force-refresh pull-right" data-bind="click: refresh"> <i class="icon-refresh"></i>refresh</button> <button class="btn btn-info" data-bind="click: save"> <i class="icon-save"></i>submit data</button> <br /> <br /> <h3 class="page-title" data-bind="text: title"></h3> <div class="article-counter"> <address data-bind="text: agency().length"></address> <address>found</address> </div> </header> <

.htaccess - Apache RewriteRule of multiple variables in query string -

i've been trying figure out how write new rewrite rule struggling badly. removing world-wide (ww) site domain.com , want forward old links country selector. appreciated. thank in advance. # if user goes url www.domain.com/products/folder1/folder2/index?sku=123&var2=abc&isocountrycode=ww # forward them url www.domain.com/choose/country_selection?ref_url=/products/folder1/folder2/index.cfm?sku=123&var2=abc # attempt not work rewritecond %{query_string} ^(.*)isocountrycode=ww(.*)$ [nc] rewriterule ^(.+)$ /choose/country_selection.cfm?ref_url=$1?%1%2 [l,r=302] i have been using website test code http://martinmelin.se/rewrite-rule-tester/ answered own question. helicontech ape requires second ? escaped backslash... rewritecond %{query_string} ^(.+&)?isocountrycode=ww&(.+)?$ [nc] rewriterule ^(.+)$ /choose/country_selection.cfm?ref_url=/$1\?%1%2? [nc,r=301,l] rewritecond %{query_string} ^((.+)&)?isocountrycode=ww$ [nc] rewriterule

vb.net - Parsing HTML with VB DOTNET -

i trying parse data website specific items tables. know tag bgcolor attribute set #ffffff or #f4f4ff want start , actual data sits in 2nd within . currently have: private sub runform() dim theelementcollection htmlelementcollection = webbrowser1.document.getelementsbytagname("tr") each curelement htmlelement in theelementcollection dim controlvalue string = curelement.getattribute("bgcolor").tostring msgbox(controlvalue) if controlvalue.equals("#f4f4ff") or controlvalue.equals("#ffffff") end if next end sub this code gets tr element need, have no idea how (if possible) investigate inner elements. if not, think best route take? site not label of tables. 's looking like: <td><b><font size="2"><a href="/movie/?id=movietitle.htm">the movie</a></font></b></td> i want pull out "the movie" text , add text file

c++ - binary_search with std::pair using a custom operator -

i trying binary_search including vector of integer pairs , integer follows: #include <vector> #include <algorithm> using namespace std; typedef vector<pair<size_t,size_t> > int_pairs; bool operator<(const size_t& l, const pair<size_t,size_t>& r) {return r.first < l;} // useful binary search int main(){ int_pairs pairs_vec; pairs_vec.push_back(pair <size_t,size_t>(1,2)); pairs_vec.push_back(pair <size_t,size_t>(2,2)); size_t i(2); binary_search(pairs_vec.begin(),pairs_vec.end(),i); } the compiler tells me operator< not defined: erreur: no match ‘operator<’ (operand types ‘const long unsigned int’ , ‘std::pair<long unsigned int, long unsigned int>’) am doing right way? tried change definition of operator in many different ways, nothing seems work. the reason doesn't work operator< isn't looked point call binary_search , rather later inside body - , that's i

jenkins - Rename job in Folder 2 changes job name in Copy Artifact plugin in a job in Folder 1 -

i think may have found bug in either copy artifacts plug-in or folders plug-in... if change job name in 1 folder causes configuration change job in different folder. i using folders plug-in , copy artifact plugin. i recreated issue in clean jenkins server folders , copy artifacts plug-ins installed follows: 1. create folder: folder 1 2. create job: job 1. job creates , archives text file: job1.txt (windows batch step: echo %job_name% > job1.txt) 3. create second job: job 2. configure job 2 use copy artifact plug-in job1.txt artifact job 1. 4. run job 1. job1.txt file created , archived 5. run job 2. job1.txt file retrieved job 1. copy folder 1 folder 1. (create new job folder 2 , copy existing job folder 1). folder 2 created containing job 1 , job 2. rename folder 2; job 1 (to job 1 renamed) the copy artifact reference in folder 2; job 2 changed expected. inspect folder 1; job 2. copy artifact reference has changed. not expected. glenn sounds bug i

mysql - php variable used as mysqli column name syntax error -

this question has answer here: when use single quotes, double quotes, , backticks in mysql 10 answers this think it´s problem... $sql1 = "select `puntos_globales`, '$juego' `lista_jugadores` `id_jugador`='$notop'"; this error message: error: you have error in sql syntax; check manual corresponds mysql server version right syntax use near "blackops2'='1' `id_jugador` = '10" @ line 1 $juego .. php variable holds column name; in case blackops2. don´t know why in error says blackops2'='1'?? from error seems didnt provide true query , looks have 2 clause blackops2='1' `id_jugador` = '10" try that `id_jugador` = '10' , blackops2='1'

wpf - Validation with IDataErrorInfo through DependencyProperty -

i've created small user control extend fun validation! problem validation not work: idataerrorinfo.this[] never called. thank in advance help. stephan here code: <usercontrol x:class="wpfapplication5.textboxwithvalidation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:name="textboxwithvalidationcontrol"> <grid> <stackpanel orientation="horizontal"> <textbox height="23" width="120" text="{binding path=text,elementname=textboxwithvalidationcontrol, validatesondataerrors=true, updatesourcetrigger=propertychanged}"> </textbox> </stackpanel> </grid> and code behind is: public partial class textboxwithvalidation { public static readonly dependencyproperty textproperty = dependencyproperty.register("te

how to run ZK app in firefox? -

i want run aplication on firefox, or other external web browser. zk script shown correctly in eclipse internal web browser, can visualising in firefox too? actually there firefox plugin, didn't tried self here links: zk jet @ mozilla.org zk jet @ zkoss.org zk jet browser extension available firefox , google chrome provides user zk sandbox environment.

php - What kind of ID is more safer -

i'm developing small social network , database "users" has 2 id's first 1 id_user = primary key , autonumerica 1,2,3,4,5. 1 id_uniq = it's generate php uniqid() recommend use?, saw example facebook use long id's profile.php?id=100003565125387.., althought not same because uniqid() generate id's letters , numbers, in case kind of id safer?._ i have developed similar kind of project. , used id_user. , worked fine. problem user can find out else's id. make sure other people can't log else's account have used session. if feel not safe enough can use uniqid. depends on , how handle it. opinion.

perl - How to write a test for testing if a folder is readable / writable -

i wrote module checks directory if writable or readable. but, how test it? usually, when writing module can write tests testing features of module. how can create directory, not writable test created module? i imagine this: use strict; use warnings; use file::temp qw/ tempdir /; use test::more tests => 5; begin { use_ok('my::dircheck') }; $readable_dir = tempdir(); $check = my::dircheck->new(directory => $readable_dir); is($check->is_readable(), 1, 'temp dir readable'); # fixme: how make not readale? isnt($check->is_readable(), 1, 'temp dir not readable'); $writable_dir = tempdir(); is($check->is_writeable(), 1, 'temp dir writeable'); # fixme: how make not writable? isnt($check->is_writeable(), 1, 'temp dir not writeable'); but how create directory, make e.g read-only , rid of afterwards? instead of file::temp , try use file::path , allows choose mode parameter able set directories's permiss

express - require an external module in jade in a node.js webserver -

i need require util module in jade template checking. can that? tried following in jade template sits in $root/views/jade/sample.jade var utils = require('../../app/server/modules/queries.js') for module sits in $root/app/server/modules/queries.js but not work. can want???? you can register helpers within express. in request handler. var utils = require('../../app/server/modules/queries.js') function(req, res) { res.render("sample", { locals: { title: "welcome derpco", someutilfunction: utils.someutilfunction } }); }; also can register helpers globally using app.locals.helpername = ...

vim - Using '#' in bash command in .vimrc -

i'd create new command compiles current *.tex file , shows in pdf viewer (i'm using osx due use preview). here attempt: autocmd bufreadpost,bufwritepost *.tex nmap <leader>b :!temp=% && pdf=${temp:0: ${#temp}-4 } && echo $temp && "/usr/texbin/pdflatex" -synctex=1 -interaction=nonstopmode % && open $pdf && unset temp pdf<cr> temp file name of mit *.tex file. pdf file name of *.pdf. however when execute following error message: 499: empty file name '%' or '#', works ":p:h" is there different method shorten string without using '#'? solution: autocmd bufreadpost,bufwritepost *.tex nmap <leader>b :!pdf="%<.pdf" && "/usr/texbin/pdflatex" -synctex=1 -interaction=nonstopmode "%" && open "$pdf" && unset pdf<cr> why not use error message's suggestion , set pdf in vimscript instead

node.js - Keep track of the children in the parent, or keep track of the parent in the children? -

so let's i'm creating list sections. is preferred keep array of objectid 's in parent element. var listschema = new mongoose.schema({ sections : {type: [objectid], ref : "section"} }); or keep reference parent's objectid in each item , find var sectionschema = new mongoose.schema({ list : {type: objectid, ref : "list"} }); (or both maximum flexibility?) i've been doing second way, i'm thinking might stuck in relational db paradigm. because once there multiple levels of nesting seems pretty dirty callbacks data want. , don't take advantage of populate function. assuming each object has 1 parent, it's easier keep parent id in child object. although, if you're trying find children of object, rather parent, easier store array of children ids in parent object. i'm not sure of availability of maps in language you're using, youcan use maps link parent ids children ids. works storing parent

actionscript 3 - How to Splice multi-dimensional arrays? -

there may simple way troubled me. i'm trying splice 2-dimension array below : removechild(test[1].splice(currshape, 1)); but won't splice it, , me following error : type coercion failed: cannot convert []@29258d59 flash.display.displayobject. any helps appreciated. your call splice() working. note splice() method returns array containing elements removed original array . you pass array splice() returned argument removechild() . , removechild() method failing ... expects the argument displayobject not array , , throws exception. you can change code following, written on 2 lines clarity: var removeditems:array = test[1].splice(currshape, 1); removechild( removeditems[0] );

jQuery Validator Plugin won't update rules -

i have form has sections split tabs. entire form should validated when user submits form (i.e. input has focus , press enter or save button pressed) , i'd validate elements on first tab on click event of tab (other first 1 obviously) disallow moving tab before first tab's elements validated. problem seem continue running after first attempt @ validating rules , elements validated set , don't updated based on passing of different set of rules. edit: clarify, can more see issue if click tab 2 fill out text 1 , text 2 , hit save, exact opposite. any thoughts on matter appreciated. in advance! this based on jquery validate plugin here: http://jqueryvalidation.org/ here's link fiddle: http://jsfiddle.net/fsb69/ <html> <head> <script type="text/javascript" src="jquery-1.7.2.js"></script> <script type="text/javascript" src="jquery.validate.js"></script> <script type="t

javascript - Custom Syntax Checker For an online editor -

i making new programming language. there project or bootstrap can use syntax checking, showing syntax errors? project have built using javascript, because need build syntax checker online editor? thanks ! you might check out pegjs @ http://pegjs.org/ allows create parser grammar definition.

c# - how to re-use my windows forms in a dashboard that works like HTML frames? -

my c# standard windows forms app finished, has 10 forms. new requirement change "multiple forms" 1 dashboard click link on bar on side or top , switch between forms in main area of dashboard 1 @ time, pretty same way old html frame works framesets (just imagine windows forms framesets). without going detail, each of these forms pretty involved, multiple threads , on, , looking simple trick display them, oposed recoding entire thing. i looked @ http://www.codeproject.com/articles/37397/a-multipanel-control-in-c it's not want. is there way this? if convert forms custom controls, becomes pretty simple use tabcontrol http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.aspx display custom controls on surfaces of tabs contains. by making them custom controls avoid mixing of code each of them (they remain distinct) become added other surfaces. ui dozen display tabs.

excel vba - Sudden Random Error -

i have following code, sub addzeroes() 'declarations dim integer, j integer, endrow long 'converts column format text format application.screenupdating = false columns("a:a").select selection.numberformat = "@" 'finds bottom row endrow = activesheet.range("a1").end(xldown).row 'selects top cell in column activesheet.range("a1").select 'loop move cell cell = 1 endrow - 1 'moves cell down 1. assumes there's header row starts @ row 2 activecell.offset(1, 0).select 'the do-while loop keeps adding zeroes front of cell value until hits length of 7 while len(activecell.value) < 7 activecell.value = "0" & activecell.value loop next application.screenupdating = true end sub and adds preceding zeroes numbers , converts them text make them 7 charecters long if less 7. , has been working day , has stopped. keep getting erro

performance - dgemm or dgemv for Matrix Multiplication? -

i know dgemv matrix-vector, more efficient? using dgemm directly matrix multiplication or using dgemv matrix multiplication multiplying matrix each individual column of matrix b using dgemv ? if make repeated calls dgemv, not benefit cache tiling , re-use, biggest advantages dgemm implementations have. dgemm vastly more efficient multiple calls dgemv.

memory management - gfortran Deallocation segmentation fault -

compiling gfortran, produces 4 'ok': type typethree integer real*8 real*8, allocatable :: aa(:) end type typethree type typetwo type(typethree), allocatable :: b end type typetwo type typeone type (typetwo), allocatable :: c(:) end type typeone type(typeone), allocatable :: d(:) allocate(d(2)) print *, 'ok' deallocate(d) print *, 'ok' allocate(d(2)) print *, 'ok' allocate(d(1)%c(2)) print *, 'ok' deallocate(d(1)%c) print *, 'ok' end and produces segmentation fault when trying deallocate d(1)%c . using ifort , resolves issue. removing integer i under typethree resolves issue. letting compiler deallocation (commenting out deallocate(d(1)%c) ) resolve issue. idea appreciated. using ulimit -s unlimited doesn't help. also: $ gfortran -v using built-in specs. collect_gcc=gfortran collect_lto_wrapper=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper target: x

javascript - DOM Exception 8 Error - Leaflet w/ Clustering -

i have leaflet map pulls in data geojson file , clusters it, so: var markers = l.markerclustergroup({ showcoverageonhover: true, spiderfyonmaxzoom: true }); var geojsonlayer = l.geojson(thefts, { oneachfeature: function (feature, layer) { layer.bindpopup(feature.properties.bike_value); } }); markers.addlayer(geojsonlayer); map.addlayer(markers); map.fitbounds(markers.getbounds()); the middle piece what's giving me trouble: var geojsonlayer = l.geojson(thefts, { oneachfeature: function (feature, layer) { layer.bindpopup(feature.properties.bike_value); } }); every time try click on popup, console error says uncaught error: notfounderror: dom exception 8 . th error stack looks this: uncaught error: notfounderror: dom exception 8 leaflet.js:7 o.popup.o.class.extend.onremove leaflet.js:7 o.map.o.class.extend.removelayer leaflet.js:6 o.map.include.closepopup leaflet.js:7 o.popup.o.class.extend._close leaflet.js:7

php - Tab and pre wrapped around JSON output in Chrome -

i using simple code print array json structure. header('content-type: application/json'); echo json_encode($this->data, json_pretty_print); i'm using chrome version 28.0.1500.95 m. odd reason output wrapped in pre tag tab character (i.e. \t ) @ beginning. json seems parsing okay still tab character when no data sent. how can fix ? <pre style="word-wrap: break-word; white-space: pre-wrap;"> { "title": "node", "items": [ { "label": "do stuff", "icon": "..\/ui\/images\/icons\/16x16\/icon.png", "action": "dostuff" } ] }</pre> edit: here's code on jquery side: $.ajax({ url : "/myproject/getmenu/", type : 'get', datatype: "json", success : function(data) { //alert(json.stringify(data,undefined,2)); if (jquery.isemptyobject(d

java - Using ZBar (Android) SDK, My Application Is Getting Different ISBNs From The Same Book -

Image
i creating application using zbar sdk on android scan books , isbn. have gotten work on physical side. press button, scanner window pops , scans bar code. the problem comes when application gets isbn scanner, seems scanner either reading bar code incorrectly or not pulling in right data. know how fix issue? thanks. below relevant code, , few screens @override public void onclick(view v) { //todo add functionallity if(v.getid() == r.id.scanbutton) { intent intent = new intent(this, zbarscanneractivity.class); intent.putextra(zbarconstants.scan_modes, new int[]{symbol.isbn10, symbol.isbn13, symbol.ean8, symbol.ean13 }); startactivityforresult(intent, zbar_scanner_request); } } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { if (resultcode == result_ok) { // scan result available making call data.getstringextra(zbarconstants.scan_result) // type of scan result

java - If-Else, return statement and local variable tradeoffs -

i have 3 ways write code, listed each pro's , con's best coding practice ? although code not important, meant return decimal number result if 0's stripped off decimal series, example: 11 == 10 0's eliminated. 1. pro's : no need local variables store return value. con's : multiple return statements. public static int getstrippednumber(int num) { int numberofdecsets; if ((numberofdecsets = num % 10) == 0) { return num - numberofdecsets; } else { return num - ( numberofdecsets + 1 ); } } 2. pro's : no need local variables store return value. con's : multiple return statements. public static int getstrippednumber(int num) { int numberofdecsets; if ((numberofdecsets = num % 10) == 0) { // numbers 10, 20, 100 etc. return num - numberofdecsets; } return num - ( numberofdecsets + 1 ); } doubt: advised use 'else' when 'if' returns ? option 1 uses else option

jquery - Delay hover animation -

this question has answer here: how pass 'this' settimeout callback 8 answers my code is: $(document).ready(function() { $('.holder').hover(function() { $(this).find('.heading').slideup(); },function() { $(this).find('.heading').slidedown(); }); }); now want implement settimeout function. problem $(this) just store $(this) in variable , use variable within anonymous function: $(document).ready(function() { $('.holder').hover(function() { var $self = $(this); settimeout(function(){ $self.find('.heading').slideup(); }, 500); },function() { $(this).find('.heading').slidedown(); }); }); edit in response comments: $(document).ready(function() { var timer; $('.holder').hover(function() { var

c++ - gcc 4.8 linker error during linking boost thread library -

i have compiled boost library myself using g++4.8 compilation finished success. located in ~/bin/boost. after compilation files located in /users/$(user)/bin/boost/stage/lib/ below necessary make parts: cc=g++-4.8 ld=g++-4.8 boost_lib_path=/users/$(user)/bin/boost/stage/lib/ boost_header_path=/users/$(user)/bin/boost/ lflags=-l$(boost_lib_path) -lboost_thread release: $(obj) $(ld) $(obj) obj/main.o $(lflags) -o $(release_name) everything goes ok during compilation linking process fail. errors same: ndefined symbols architecture x86_64: "boost::system::system_category()", referenced from: __static_initialization_and_destruction_0(int, int) i have read : attempting use boost.filesystem doesn't seem link? c++ / boost: undefined symbols in example? , many others still did not find solution. i have no idea problem, have change order of linking, try link directly thread library still same result. problems occur during compilation of https:/

date - Perl Data::ICal print event time as T000000Z instead of omitting it -

i'm trying generate ical feed using data:ical events printed without time. i've read time not required if it's 000000 google calendar not handle events without time properly. here example script , output. need output to in utc timezone. #!/usr/bin/perl -w use strict; use date::ical; use data::ical; use data::ical::entry::event; use datetime; use data::dumper; sub get_utc_offset($) { ($orig_tz_str) = @_; # using set winter date avoid problems daylight savings time $utc_compare_datetime = datetime->new( year => 2012, month => 1, day => 1, hour => 1, minute => 1, time_zone => 'utc' ); $tz = datetime::timezone->new(name => $orig_tz_str); $utc_offset = $tz->offset_for_datetime($utc_compare_datetime); $utc_offset_str = datetime::timezone->offset_as_string($utc_offset); return $utc_offset_str; } sub add_ical_ev

Extract text from Microsoft Word with final version track changes using Python? -

import win32com.client def function( directory ) : app = win32com.client.dispatch( 'word.application' ) doc = app.documents.open( directory ) text = doc.content.text app.quit() i using code extract contents microsoft word docs extracts "final showing markup" version. want extract contents of "final" version. there way using pywin32? i don't know pywin32, alternative cold extract whole thing each time , pass them git. give full history of changes between versions.

javascript function ajax does not work in android 4.1 -

i have javascript code works except in native browser in android 4.1 jquery-1.10.2 used well. the function following: function ajax(url, successmethod, params){ $.ajax({ type: 'get', url: url, data: params, datatype: 'json', timeout: 300, success: successmethod, error: function(xhr, type){ alert('ajax error!') } }); } i don't know why javascript doesn't work in android 4.1 native browser. i changed function's name , code running now: function callrequest(url, successmethod, params){ $.ajax({ type: 'get', url: url, data: params, datatype: 'json', timeout: 300, success: successmethod, error: function(xhr, type){ alert('ajax error!') } }); } solved: problem function name ajax. changed , worked fine.

extjs - Rally Ext JS change functionalty of existing component -

i trying either override or extend existing component - rally.ui.percentdone component. want provide portfolio item data necessary render using same color coding rally native apps use (the rally health color calculator ). i need function pass correct record. here idea far: ext.define('custom.percentdone', { requires: ['rally.ui.renderer.template.progressbar.portfolioitempercentdonetemplate', 'rally.util.healthcolorcalculator'], extend : 'rally.ui.percentdone', alias : 'widget.cpercentdone', config: { record: null }, constructor: function(config) { config = this.config; this.rendertpl = ext.create('custom.renderer.template.progressbar.percentdonetemplate', { calculatecolorfn: ext.bind(function(recorddata) { console.log('called custom coloring fn'); var colorobject = rally.util.healthcolorcalculator.calculatehealthcolorforpor

node.js - How do I get rid of error "'.' is not recognized as an internal or external command" when running 'npm install' for MEAN stack? -

Image
downloaded mean stck zip mean.io did npm install after few minutes got error. please see screenshot. do? npm http 200 https://registry.npmjs.org/event-emitter/-/event-e mitter-0.2.2.tgz > mean@1.0.0 postinstall c:\ss\d1\google\04\mean\mean-stack > ./node_modules/bower/bin/bower install '.' not recognized internal or external command, operable program or batch file. npm err! weird error 1 npm err! not ok code 0 looks mean stacks postinstall script hardcoded unix style paths. in unix ./somethig/or/another signifies accessing something directory starting here (the meaning of . ). i'd suggest submitting bug on github page start. might able away editing package.json have post install script use windows style paths. node_modules\bower\bin\bower install . don't have windows cannot certain.

c# - How to add ListItem to DropDownList from code and get the selected value -

i succeeded adding list-items dropdownlist database, after ran application , selected value dropdownlist, checked break point @ code , saw selected value wrong. selects first value. my code is: userbll ubll = new userbll(); list<item> list = ubll.getallitemscategory(); foreach (item item in list) { int var = 1; listitem litem = new listitem(item.name, var.tostring()); modelslist.add(litem); var++; } dropdownlist2.datasource = modelslist; dropdownlist2.databind(); how can fix when following executed i'll right selection , not first item? order.nameitem = dropdownlist2.selectedvalue; you need check !ispostback in page_load event, this: protected void page_load(object sender, eventargs e) { if(!ispostback) { // put logic here bind dropdownlist2.datasource = modelslist; dropdownlist2.databind(); } }

oracle - How to fetch values from cursor into variables? -

i have problems fetching values cursor variables: create or replace procedure projectinfo(num clubs.clubid%type) --identify variables p_cln clubs.clubname%type; p_projn projects.projectname%type; p_projnum number; p_taskn tasks.taskname%type; p_tasknum number; cursor cur select c.clubname, p.projectname, t.taskname clubs c join projects p on c.clubid=p.clubid join tasks t on t.projectid=p.projectid c.clubid=num; --i have checked above cursor , it's worked fine!!! begin p_projnum:=0; p_tasknum:=0; open cur; loop fetch cur p_cln,p_projn, p_taskn; dbms_output.put_line(p_cln|| ' ' ||p_projn|| ' ' || p_taskn); -- above command not print variable values!!! exit when cur%notfound; p_projnum:=p_projnum+1; dbms_output.put_line(' ************************ '); dbms_output.put_line(' club name : ' ||p_cln); dbms_output.put_line( ' project ' ||p_projnum|| ' ' || p_projn); loop p_tasknum:=p_tasknum+1; dbms_output.put_line('t

R: postForm from the RCurl package and issues API call -

Image
does have experience limitations of postform rcurl package? i pulling data off server , out of got error message * http 1.0, assume close after body , 500 internal server error . tested configurations , seemed fine. i've created clean database , re-uploaded database 20/30 cases @ time while repeatedly pulling data api/ postform call r . works should until around 150 cases error message appears. regardless of order upload cases in error appears around 150/160 cases , total files size around 11 12 mb. in other words, error doesn't seem dependent on specific cases not same cases breaks it any advice appreciated. i've attached screenshot spice rather boring post bit , make not having working example, update 2013-08-24 19:33:18z here curlversion()$version , sessioninfo() information, > curlversion()$version [1] "7.22.0" > sessioninfo() r version 3.0.1 (2013-05-16) platform: i686-pc-linux-gnu (32-bit) locale: [1] lc_ctype=en_us.utf-8

syntax - LESS namespaces: "#namespace > .mixin()" vs. ".namespace.mixin()" -

all less documentation , tutorials use #namespace > .mixin() syntax when takes namespaces. find myself more comfortable .namespace.mixin() syntax, i.e.: .namespace() { .mixin() { foo: bar; } } #usage {.namespace.mixin()} am missing something? there difference between these 2 variants (in partucular, way mixins/variables affect scope , vice versa)? or kind of historically rooted tradition? you're right, ".namespace > .mixin", ".namespace.mixin" , ".namespace .mixin" different beasts when used selectors. things seem dissimilar when goes mixin invoke/expansion. cannot craft example where: "#usage {#namespace > .mixing}" "#usage {#namespace.mixing}" "#usage {#namespace .mixing}" etc. produce non equal output, assuming .mixin defined parametric ruleset. same ".namespace". e.g.: /* */ #namespace { .mixin1() { foo1: bar; .mixin1() { foo2: bar;

bash - {expect} - how to create the variable's name within a loop after (flight) take-off? -

this full script: #!/usr/bin/expect set a1 "aaa" set a2 "bbb" set a3 "ccc" {set b 1} {$b<4} {incr b} { send a$b } the output is: a1a2a3 what wanted values for $a1 $a2 $a3 how fix ? someone recommended "eval" eval send "a$b" which not seem working, outputs same thing above. it want array : array set myarr { a1 "aaa" a2 "bbb" a3 "ccc" } foreach {var value} [array myarr] { puts "color: $var count: $value" } this code outputs me: color: a3 count: ccc color: a1 count: aaa color: a2 count: bbb so don't have order. or you're looking list : set mylist {"aaa" "bbb" "ccc"} lappend mylist "ddd" foreach elem $mylist { puts $elem } this output exactly: aaa bbb ccc ddd this page should make such things pretty clear you

c# - How can I create an if else statement with this situatiion? -

i want command if enter nothing or null value not execute insert command.im using c# , sql server. code this: sqlcommand cmd = con.createcommand(); cmd.commandtext = "insert records ([student id], [first name], [last name], [middle initial], gender, address, status, year, email, course, [contact number]) values ( @studentid, @firstname, @lastname , @middleinitial, @gender, @address, @status, @year, @email, @course, @contactnumber)"; sqlparameter p1 = new sqlparameter("@studentid", sqldbtype.nchar); p1.value = textbox1.text; cmd.parameters.add(p1); sqlparameter p2 = new sqlparameter("@firstname", sqldbtype.nvarchar); p2.value = textbox2.text; cmd.parameters.add(p2); sqlparameter p3 = new sqlparameter("@lastname", sqldbtype.nvarchar); p3.value = textbox3.text;

Nested order by/order by within order by in SQL -

i looking sort sql results via sql query presumably sort of nested order by/order within order clause i have following data: term user item_no score man sam 2 null man sam 1 170 man jerry 1 100 man jerry 2 null man sam 3 null and wish obtain following order results: term user item_no score man sam 1 170 man sam 2 null man sam 3 null man jerry 1 100 man jerry 2 null the results must sorted firstly score (stored in item_no 1 each user) descending. further items created user seleted term must picked , inserted directly following , in item_no order. my current query looks this: select * table term = 'man' order score desc, item_no asc ...however results follows: term user item_no score man sam 1

java - GWT Deferred Binding and Dependency Injection -

assuming have so interface interface isinterface {} implementation classes public concreteclassa implements isinterface { injectora a, injectorb c, injectorc c; @inject concreteclassa(injectora a, injectorb b, injectorc c) { this.a = a; this.b = b; ..... } } public concreteclassb implements isinterface { injectora a, injectorb b, injectorc c; @inject concreteclassb(injectora a, injectorb b, injectorc c) { this.a = a; this.b = b; ..... } } ..and decide use gwt deferred binding in gwt module.gwt.xml //pseudo xml configuration if (type isinterface) if toggle == use concreteclass else use concreteclassb now, when try run this. won't work because gwt expected concrete class , b have default 0 constructor. so, tried following on concrete class @inject injectora a; @inject injectorb b; @inject injectorc c; concreteclassa() { } which bypass 0 constructor error gives me nullpointerexception when try use a, b or c. 1 way m

Using vagrant & puppet, how to create and restore a database on fresh postgresql-server instance? -

i have fresh provisioned instances of apache , postgres set go. restore dump or mount logical volume data postgres instance. likewise, i'd ensure dump written out or volume unmounted when bring instance down. can use logical volume way? how should approach? i see this: how handle data such mysql, web sites sources vagrant? the other answer had following suggestions. below discuss implications postgresql. in current version of vagrant (1.0.3), have 2 main options: use shared folders. can put mysql data directory shared folder data comes onto host machine. con of shared folders quite slow compared native vm filesystem in virtualbox, , can run weird permission issues well. setup task (rake, make, etc.) copy mysql data shared folder on demand. then, before decide destroy vm, can run task export data shared folder, can reimport data when bring vm up. the shared folders approach may work, if need extremely careful file permissions. post

mysql - php echoing the ACTUAL statement of a query after its executed -

this frustrates me lot since moved pdo i have this: $sql = "select * $table id=:id"; $this->stmt = $this->dbh->prepare($query); $this->stmt->bindvalue($param, $value, $type); bindvalue(:id => $this->user_id); $this->stmt->execute(); now select runs, doesnt break dont expected results, if echo $this->stmt this: pdostatement object ( [querystring] => update `users` set user_active= :user_active, user_activation_hash= :user_activation_hash user_id = :user_id , user_activation_hash = :verification_code ) now looks problem values passed, instead of passing number might have messed quotes , passed $id string , didnt evaluate variable cannot figure way out see actual statement values were. there must easier way, simple standard mysql assign query variable , echo out or use or die mysql_error? fwiw tried debugdumpparams , returns this: update `users` set user_active= :user_active, user_activation_hash= :user_activation_hash user_i

node.js - Mongoose and Query Injection when using Javascript? -

how mongodb address sql or query injection? explains how handle query injection bson when using javascript on server. haven't been able track down how/whether mongoose handles query injection though. at point have 2 questions: does mongoose protect against query injection (using bson or other method) if does, there quirks it's implementation developer need aware of? mongoose not protect against query injection unfortunately need perform own injection detection following guidelines link above.