Posts

Showing posts from June, 2011

node.js - Mongoose - Save doesnt work when am connecting to mongodb running in different server -

when trying save document in collection or find list of collections in mongodb running remotely doesnt work works when connecting mongo db locally. save doesnt show if throwed error or successful. appreciated. below code var mongoose = require('mongoose'); var dbname = 'ost'; var connectionstring = 'mongodb://vm-1b98-f53f.nam.nsroot.net:32017/ost?ssl=true&sslverifycertificate=false'; mongoose.connect(connectionstring); mongoose.connection.on('error', function (err) { console.log('mongoose default connection error: ' + err); }); mongoose.connection.on('connected', function () { console.log('mongoose default connection open ' + connectionstring); var region = require('./region.js'); var r = new region({ nodeid: 8687, regionname: 'emea' }); r.save(function (err, regionobj) { if (err) { console.log('error'); throw err; } else { console.log('saved successfully:'

extjs - How to populate a Tree with flat JSON? -

i receiving json response api following objects structure: { "servers": [ { "name": "root company ltd.", "guid": "{1760f250-5012-46b2-8bbf-955ffd1c51ad}", "parentguid": null, "active": true, "connected": true }, { "name": "25-tecvoz hlv1wad", "guid": "{cc893441-a3b5-42b2-95b6-f3e56f0286ae}", "parentguid": "{1760f250-5012-46b2-8bbf-955ffd1c51ad}", "active": true, "connected": true }, { "name": "20-axis m1031", "guid": "{216142b2-a9b8-4aff-85cd-1d97685f4ee1}", "parentguid": "{1760f250-5012-46b2-8bbf-955ffd1c51ad}", "active": true, "

django - python social auth linkedin picture url is null -

i'm using python social auth django login via linkedin , try obtain public picture url. however, no matter keep getting null. tried every combination possible, public-picture-url pictureurl, every combo of underscores, camelcase , dash, or without "public". nothing works. here's (current) settings: social_auth_linkedin_scope = ['r_basicprofile', 'r_emailaddress'] social_auth_linkedin_field_selectors = ['picture-url', 'email-address', 'headline', 'industry'] social_auth_linkedin_extra_data = [('id', 'li_id'), ('firstname', 'first_name'), ('lastname', 'last_name'), ('emailaddress', 'email_address'), ('headline', 'headline'), ('picture-url', 'picture_url')] authentica

php - How to ensure data inserted only once at a time? -

this how json like: $return='{"sub":{"2":""},"postcode":"56000","slider1":"100","action":"test"}'; $data = json_decode($return, true); this how value, $postcode=$data['postcode']; $budget = $data['slider1']; $subject =$data['sub']; var_dump($key =array_keys($data['sub']));// prints 0=>2 foreach($key $key1=>$key2) { $key1;//prints 0 $key2;//prints 2 } $key2;//prints 2 i'm inserting data this: try { //$pdo = new pdo('mysql:host=localhost;dbname=users', $username, $password); //$pdo->setattribute(pdo::attr_errmode, pdo::errmode_exception); include($_server['document_root'].'/config.php'); $stmt = $pdo->prepare('insert test (postcode,budget,subject) values(:postcode,:budget,:subject)'); $stmt->execute(array( ':postcode' => $postcode, ':budget'=>

mongodb - ERROR backtype.storm.util - Async loop died! java.lang.RuntimeException: java.lang.NullPointerException -

i trying write output of storm word count program mongodb.this error getting when executing program.though able print reusult.problem starts when trying write output. the error generated : jun 01, 2015 3:24:23 pm com.mongodb.dbtcpconnector fetchmaxbsonobjectsize warning: exception determining maxbson size using0 java.io.ioexception: couldn't connect [ritesh-rm/127.0.1.1:27017] bc:java.net.connectexception: connection refused @ com.mongodb.dbport._open(dbport.java:206) @ com.mongodb.dbport.go(dbport.java:94) @ com.mongodb.dbport.go(dbport.java:75) @ com.mongodb.dbport.findone(dbport.java:129) @ com.mongodb.dbport.runcommand(dbport.java:138) @ com.mongodb.dbtcpconnector.fetchmaxbsonobjectsize(dbtcpconnector.java:419) @ com.mongodb.mongo.getmaxbsonobjectsize(mongo.java:541) @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:237) @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:210) @ com.mongodb.dbcollection.insert(dbcollection.java:80) @ bolts.wordcount

sql server - T-SQL Stored Procedure returned value into variable -

Image
i have simple stored procedure on ms sql 2012 express returns result doing : declare @value int; select @value; meanwhile trying call stored procedure doing like declare @result int; exec @result = spfoo ..... however value on @result spfoo is 0. how can real value returned stored procedure? thanks first declare @value output parameter in called sp create procedure spcallee @value int output begin set @value = 1 end go get result in caller sp create procedure spcaller begin declare @result int = 0 exec spcallee @value = @result output select @result end go

How to get value of HTML Div using PHP -

i have div php .it given below. $did = "<div id='primary'>value 110</div>"; i need value in variable 'value 110' only.i don't want use jquery , ajax or other javascript . i need div value in php variable. and value inside div 'value 110' coming through jquery.so run time value onclick of edit button. php simple html dom parser may need, give try. here's example shows how edit html element: $html = str_get_html('<div id="hello">hello</div><div id="world">world</div>'); $html->find('div', 1)->class = 'bar'; $html->find('div[id=hello]', 0)->innertext = 'foo'; echo $html; // output: <div id="hello">foo</div><div id="world" class="bar">world</div> from example can create code need: $html = str_get_html("<div id='primary'>value 110</d

openwrt - Installing "opkg"? -

i'm trying install package openwrt sdk. have use opkg package manager typing: opkg update opkg install <package> however, in case, opkg not installed , result can't proceed. could tell me how can install it? thank you. i'm using kubuntu btw: linux ghanem-vgn-bz31xt 3.16.0-34-generic #47-ubuntu smp fri apr 10 18:02:58 utc 2015 x86_64 x86_64 x86_64 gnu/linux opkg doesn't have 'release' can install - of course because need native libraries of os , used in wide array of oss. whenever have play on ubuntu have these 3 'one-liners' install it, if try , modify match os i'm sure it'l work you: download opkg release (latest when written 0.3.1): wget http://downloads.yoctoproject.org/releases/opkg/opkg-0.3.1.tar.gz tar -zxvf opkg-0.3.1.tar.gz install compilation dependencies: apt-get update && apt-get install -y gcc libtool autoconf pkg-config libarchive13 libarchive-dev libcurl3 libcurl4-gnutls-dev libssl-dev

android - How to start this activity use adb shell am start -D -d pg/xx.The activity name is Main$Activity -

i want debug android's file. use start activity: start [-d] [-w] start activitey. applicationg package name com.dualboot.apps.springzen . main activity com.dualboot.apps.springzen.main$activity . use command 'adb shell start com.dualboot.apps.springzen/com.dualboot.springzen.main$actinity' it's not exist starting: intent { act=android.intent.action.main cat=[android.intent.category.launcher] cmp=com.dualboot.apps.springzen/com.dualboot.springzen.main } error type 3 error: activity class {com.dualboot.apps.springzen/com.dualboot.springzen.main} not exist. how start activity since calling component need include component -n option tag. use this: adb shell start -n com.dualboot.apps.springzen/.mainactivity if have $ in class name (i doubt it) refers inner class need use: adb shell start -n com.dualboot.apps.springzen/.main\$activity

How to control Save File when I modify a file in Android Studio? -

now use android studio instead of eclipse, hope can control if need save file, seems android studio save file automatically. after try close modified file window, hope android studio can display prompt dialog , let me choose if save modified file. how can do? thanks! android studio based on jetbrains intellij idea platform takes full control on when files saved. options controlling file save found in appearance & behavior > system settings > synchronization section of settings. these not require. many people switching alternative ide's have same concerns you. in discussions can find there no way around this. the jetbrains developers argue because platform has built in local history differences file saves, possible rollback file saves. read more jetbrains developers here: https://devnet.jetbrains.com/docs/doc-191 here similar discussion on issue intellij ide: intellij - not asking if want save file

php - Throwing exceptions for error results in consumed APIs -

do write specific exception s error responses of apis use? e.g.: class smsserviceexception extends exception { } class smsservicesendexception extends smsserviceexception { } is there specific built in exception in php situation? there 1 invalid arguments invalidargumentexception . you're go when comes exception. php has native exceptions these not refer non-built-in php problem. it quite common mistake miss argument, throw exception php needs when doing own things, creating classes can freely create exceptions since many of ideas not have default exception in php. you on other hand write exception class entire api , pass in name of module edit exception creating 1 "flexible" exception. make abit less readable code tho keep in mind ;)

wordpress - how to add a sidebar to a woocommerce page -

i have wordpress site , i'm using woocommerce pluging. have product page , sidebar showing @ bottom of page. how edit code put sidebar shows sidebar on left of main content area. not under main content area? the code template is: <?php /** * woocommerce_before_main_content hook * * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs content) * @hooked woocommerce_breadcrumb - 20 */ do_action( 'woocommerce_before_main_content' ); ?> <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?> <h1 class="page-title"><?php woocommerce_page_title(); ?></h1> <?php endif; ?> <?php do_action( 'woocommerce_archive_description' ); ?> <?php if ( have_posts() ) : ?> <?php /** * woocommerce_before_shop_loop hook

Bash error on if statement -

i have error in bash script when if control between string , script read function #! /bin/bash test1="false" while [ $test1 == "false" ]; tail -1 demo.txt | while read test echo $test done if [ "test" == $test ]; test1="true" echo "end" else test1="true" echo "else" fi done this code , result: #! /bin/bash test1="false" while [ $test1 == "false" ]; tail -1 demo.txt | while read test echo $test done if [ "test1" == "$test" ]; test1="true" echo "end" else test1="true" echo "else" fi done "test2.sh" 17 lines, 215 characters xxx@xxx:/tmp $ ./test2.sh test1 else if $test empty, if becomes: if [ "test" == ]; which raises error: -bash: [: test: unary operator expected you need enclose variable in quotes in order there

twitter bootstrap - Django 1.8 DateTimeInput storing as UnixTimestamp -

i have problem datetimeinput fields in django 1.8. the following form used: def __init__(self, *args, **kwargs): """additional init function changing field behavior """ super(updatemaintenanceform, self).__init__(*args, **kwargs) self.fields['name'].widget = forms.textinput(attrs={'class': 'form-control'}) self.fields['description'] = forms.charfield( required=false, widget=forms.textarea(attrs={'class': 'form-control'}) ) self.fields['active_since'] = forms.datetimefield( input_formats=['%d.%m.%y %h:%m'], widget=forms.datetimeinput(attrs={'class': 'form-control'}) ) self.fields['active_till'] = forms.datetimefield( input_formats=['%d.%m.%y %h:%m'], widget=forms.datetimeinput(attrs={'class': 'form-control'}) ) self.initial['active_since'] = datetime.fromtimestamp

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null .

csv - mysql replace unwanted symbols and characters -

i have huge mysql database table. table (here showing 5 rows) id categories 1 !98!n!85!n!73!n!76!n 2 !110!n!29!n!76!n!75!n!81!n!80!n!37!n!42!n!1!n!150! 3 !73!n!80!n!81!n!75!n!76!n!110!n!29!n!37!n!42!n!1!n!127!n!30!n!84!n!6!n!150!n!126!n 4 !24!n!147!n!73!n 5 !59!n!97!n!73!n here can see in categories have data !98!n!85!n!73!n!76!n . here can see there ! symbol before , after number , , there n after numbers. want remove unwanted datas , use comma in between 2 numbers. data this 98,85,73,76 so can tell me how in smarter way. , suggestions helpful. execute update mytable set stringcolumn = replace(stringcolumn, '!n!',','); after execute update mytable set stringcolumn = replace(stringcolumn, '!n',''); after execute update mytable set stringcolumn = replace(stringcolumn, '!',''); may you

html - How do I use the new css feature in Polymer? -

i trying change css on paper-header-panel. according docs on polymers website can simple change shadow with: paper-header-panel { --paper-header-panel-shadow: { height: 6px; bottom: -6px; box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.4); }; } sadly can't work... tried change color on paper-toolbar, not work. here code: <!doctype html> <html> <head> <!-- polymer --> <script src='bower_components/webcomponentsjs/webcomponents.js'></script> <link rel='import' href='bower_components/polymer/polymer.html'> <link rel='import' href='bower_components/paper-header-panel/paper-header-panel.html'> <link rel='import' href='bower_components/paper-toolbar/paper-toolbar.html'> <link rel='import' href='bower_components/paper-icon-button/paper-icon-button.html'> <meta charset='utf-8'> <title>test</title>

ios - Adding view controller as launch screen -

i working on launch screen want add progress bar. launchscreen.xib doesn't allows me add progress bar on launch screen. so possible add view controller launch screen time interval can add progress bar on launch screen of project? no,you can not. can not add logic code it. and know that, @ launch screen time. app not launched @ all. code progress bar not running. i think better way using launch screen first,then show viewcontroller progress bar like.

sql - Update table values from another table with the same user name -

i have 2 tables, same column named user_name, saying table_a, table_b. i want to, copy table_b, column_b_1, column_b2, table_b1, column_a_1, column_a_2, respectively, user_name same, how in sql statement? as long have suitable indexes in place should work alright: update table_a set column_a_1 = (select table_b.column_b_1 table_b table_b.user_name = table_a.user_name ) , column_a_2 = (select table_b.column_b_2 table_b table_b.user_name = table_a.user_name ) exists ( select * table_b table_b.user_name = table_a.user_name ) update in sqlite3 not support clause, makes little more work in other rdbms. if performance not satisfactory, option might build new rows table_a using select , join table_a temporary table. delete data table_a , repopulate temporary.

android - SearchView in Actionbar Appcompat -

in application, using theme.appcompat.light.darkactionbar facing weird problem. have created searchview in actionbar , has set property app:showasaction="collapseactionview|ifroom" but searchview not expanded or collapsed on touch. menu.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/search" android:title="@string/search" android:icon="@android:drawable/ic_menu_search" app:showasaction="collapseactionview|ifroom" android:actionviewclass="android.support.v7.widget.searchview" /> </menu> i have tried different solutions none worked. idea? try change android:actionviewclass="android.support.v7.widget.searchview" by app:actionviewclass="android.support.v7.widget.searchview" this worked me &l

java - Returning Total No of Records in @RequestParam in spring -

@requestmapping(value = "/states/{countrycode}", method = requestmethod.get ) public service getstates(@pathvariable ("countrycode") string countrycode,@requestparam(value = "count", required = false, defaultvalue = "10") integer count) in case problem don't want set default value count, if user pass count should return many number of records , returning ,but when user not passing count should return record db,but not working service return logic return modelststelist.sublist(0, count); here count coming method parameter in service. in case, remove required = false, defaultvalue = "10" add this, public service getstates(@pathvariable ("countrycode") string countrycode,@requestparam(value = "count") integer count) pass count backend, details , return it

python - Proxies from a file with Requests -

how use proxies text file requests? proxies in file in format: ip:port can't build dict {'scheme' : 'scheme://ip:port'} and need access 2 different sites same proxy , switch proxy. 1 of site uses http , other uses https. i tried doing http request: response = c.get(url, proxies = {'http': 'http://'+p}) and https request: response = c.get(url, proxies = {'https': 'https://'+p}) but first 1 doesn't work , throws me error. any workarounds this? my assumption fails due untrusted ssl certificate. requests.exceptions.sslerror: [errno 1] _ssl.c:503: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed to solve this, read following post however, if similar message this connection server refused. it can caused many reasons, such firewall blocking port or proxy configured badly. anyway, see if bug in program, try use proxy (ssl) in browser , surf internet. regard

c - How is it that "sizeof (char[0])" compiles just fine with GCC -

a colleague of mine inserted (void) sizeof (char[0]) @ end of multi line, macro alternative do {...} while (0) apparently. have looked around can't find reference , surprises me compiles. is valid c? love reference std. if compile gcc -pedantic , you'll warning message: warning: iso c forbids zero-size array [-wpedantic] the latest draft of c standard, n1570 , section 6.7.6.2 (array declarators) paragraph 1 says: if expression constant expression, shall have value greater zero. this part of constraint, char[0] constraint violation, requiring diagnostic conforming c compiler. (it's not 100% clear that particular clause applies type name char[0] in absence of declared object, general idea standard c not support zero-length arrays.) gcc supports zero-sized arrays extension, documented here .

c# - How to run ASP.NET MVC project inside another ASP.NET MVC project -

let's have mvc project there root folder mvc2 and. now, want mvc project mvc2 folder , serve it. below url should serve mvc2 project folder inside root project. root project mvc. currentsite.com -> current mvc app currentsite.com/mvc2/ -> should run nested mvc app. i think there should webconfig setting should make work. thank in advance. answer dearly appreciated. is possible? , if , possible interact each other. i re-consider architecture if you're having embed mvc projects within 1 another. depending on how closely related 2 are, think going in following directions: mvc areas - if both projects heavily linked, share lot of same code , resources put them 2 separate areas within application. default area routing give currentsite.com/mvc2 aswell, provided area called mvc2. approach means you'd deploy both sites (if that's need consider). separate projects - if there's not great deal of similarity between 2 , you'd prefer kee

visual studio - Exporting Resharper Inspection Results for Incoming Calls? -

in resharper, inspection results - incoming calls is possible export results text,html or xml? there export button drop down text,html , xml. clicking not bring reharper save file dialog. highlighting , pressing ctrl + c not copy values. is bug in resharper, or feature doesn't work in in reshaper evaluation mode? ps: notice export seems not work file structure either, either missing setting or bug or not enabled evaluation mode. i have tested on 2 separate machines, 1 fresh installation on windows , vs2013, same results. also pressing '+' expand all incoming calls not cause nodes expand, still have manually click every node, common behavior or in evaluation mode? it looks export issue bug. i've reported here - rsrp-440597 . can log on, vote , track it. the expand behaviour little unintuitive. it's expanding items have been expanded, rather expanding hasn't yet been searched for. can understand why - massively slow recursively works o

javascript - receive the value from link -

good day everyone. have problem realization 1 situation. have links let 5 (but can more that). every link have id="#link", have 5 different variables. need how receive 1 of variables in jquery depending of link click on. how can realize it? <?php $a=1; $b=2; $c=3; $d=4; $e=5; printf ("<a href=\"\" id=\"#link\">link_a</a>"); printf ("<a href=\"\" id=\"#link\">link_b</a>"); printf ("<a href=\"\" id=\"#link\">link_c</a>"); printf ("<a href=\"\" id=\"#link\">link_d</a>"); printf ("<a href=\"\" id=\"#link\">link_e</a>"); ?> so here 5 variables - a, b c d e, , 5 links, need recive 1 of variables depending of clicked link; $(document).on('click','#link',function() { alert(result); return false; }); p.s. numbers of variables , links can more 5

Java swing won't display g.drawImage() until repaint() is called -

@override public void paintcomponent(graphics g) { graphics2d g2 = (graphics2d) g; super.paintcomponent(g2); g2.fillrect(20, 20, 200, 200); g2.drawimage(map, 0, 0, 1004, 687, null); } this code paintcomponent in jpanel. when application launched, can see rectangle (which there because wanted check if paintcomponent being called). the map doesn't draw until force repaint resizing window or pressing button forces repaint(). i tried calling validate() in several places because answers suggested that, didn't work. g2.drawimage(map, 0, 0, 1004, 687, null); try using: g2.drawimage(map, 0, 0, 1004, 687, this); maybe image isn't read @ time paintcomponent() method invoked. "this" cause image painted when i/o finished. panel notified i/o done , panel repaint itself.

Grizzly FIlterchain VS HTTPHandler -

i trying learn grizzly , basic background .net , when read thru grizzly tutorials few things confuses me , if me understand or can point documentation details concepts in depth helpful. confusion related basic difference between httphandler , filterchain , understood can create custom filters can act upon requests , invoke next item in filter chain. kind of pipeline processing incoming request. httphandler same thing right ? http requests ? basic difference these 2 fit ? helpful if point diagram shows network listener , filterchain , httphandler fit processing requests filter , filterchain core abstractions grizzly framework, used implement protocol , http 1 of them. httpserver , httphandler higher level abstractions, provider servlet-like api work http requests. httpserver under hood built on top of filterchain , filters , httphandler represents piece of logic, processes http requests sent specific url, set when register httphandler on httpserver . coming http

php - password confirmation doesn't work, not defined -

as said in title. got following error message property "user.repeat_password" not defined. although have defined in user model. class user extends cactiverecord { public $repeat_password; /** * @return string associated database table name */ public function tablename() { return 'sys_user'; } /** * @return array validation rules model attributes. */ public function rules() { // note: should define rules attributes // receive user inputs. return array( array('password, repeat_password', 'required', 'on'=>'insert'), array('password, repeat_password', 'length', 'min'=>6, 'max'=>40), array('repeat_password', 'compare', 'compareattribute'=>'password', 'on'=>'create'), array('username', 'lengt

comparing characters (letters) on c -

im making program compare letters. goal of make hangman game. cant make letter comparison work #include<stdio.h> #include<conio.h> #include<string.h> int c=0,x; char a[50],b[50],n[50],j,h; char a1[50],b1[50],y; main() { printf("player 1:enter word\n"); gets(n); x=strlen(n); printf("%d letters\n",x); puts("now enter word letter letter"); { gets(a); strcat(b,a); c++; } while(c!=x); printf("%s",b); getch(); system("cls"); c=0; puts("player 2:try guess word letter letter"); { gets(a1); y=strcmp(a,a1); printf("%d",y); strcat(b1,a1); c++; } while(c!=x); printf("%s",b1); getch(); return 0; } im having problems in particular player 2 section. not supposed whole comparing letters program; comparing letters whatever in player 1 section (

events - A way to unclick a button that has been clicked using Javascript -

is there way deselect or unclick button has been clicked using javascript? so have button: if (i === 10) { var clicked = document.getelementbyid('i10'); clickedbutton.push(click.textcontent); clicked.style.color = "pink"; } so when click button turns text pink. there way click on button again , have remove push , turn text black? sorry, javascript isn't strongest point. web programming lesson time: if want set styles, don't use javascript set style, use css styling definitions, , use javascript point css . in css: .highlight { color: pink; background: blue; font-style: fantasy; whatever-else: stuffgoeshere; } and button handling: button.addeventlistener("click", function(evt) { var e = find.your.element.however.you.need(); e.classlist.toggle("highlight"); }); magic: doing things right way, code extremely straight forward, , we're not hardcoding styling, we're referri

node.js - express router similar routes -

i need have 2 routes, similar in start different in ends, how can enforce exact pattern respective route called. edit - problem lies in app.use statement, i've not reached route yet. a) app.get("/admin/event/:id/sessions", function(request, response){ b) app.get("/admin/event/:id", function(request, response){ c) app.use("/admin/event/:id", function(request, response, next){ d) app.use("/admin/event/:id/sessions", function(request, response, next){ c getting called request get /admin/event/1/sessions , expectation d should getting called. please advise.

vb.net - Converting a OleDbDataReader to a String to display a COUNT command in List View -

i want display in listview count of specific employee name whilst using 2 ms access queries. count being displayed 0, 1 or 2 there many none "----" values in database. the command binded radiobutton : private sub radiobutton2_click(sender object, e eventargs) handles radiobutton2.click dim con new oledbconnection("provider=microsoft.jet.oledb.4.0;data source=" & application.startuppath & "\sheetlog.mdb;jet oledb:database password = 'password';") con.open() dim try2 string = "----" dim try3 string dim oledbcmd, oledbcmd2 oledbcommand dim cmd, cmd2 string cmd = "select distinct empname sheet" oledbcmd = new oledbcommand(cmd, con) dim oledbreader oledbdatareader = oledbcmd.executereader() listview1.clear() listview1.gridlines = true listview1.fullrowselect = true listview1.view = view.details li

android - (Design Support Library) CollapsingToolbarLayout -- Toolbar not getting pinned on collapse -

Image
i'm having trouble integrating design support library application. reason, toolbar collapses collapsingtoolbarlayout, , not leave pinned in cheesesquare example chris banes. https://github.com/chrisbanes/cheesesquare i didn't different layout. in fact, replaced styles his, , dropped in layout. wonder if using toolbar, instead of android.support.v7.widget.toolbar causing this. here problem. here xml of appbar section. <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:lay

java - How to determine message type in protobuf so that I can use that type.parsefrom(byte[ ]) -

i trying send protobuf data cpp side java side. i have multiple message types defined in .proto on cpp side, have enums every message type , adding buf output follows: uint8_t* __temp = (uint8_t*)(buf); *__temp++ = (type) >> 8; *__temp = (type) & 0x00ff; how 'type' have added buf, can achieve messagetype parsefrom(byte[] data); it not clear exact requirement. assume trying send different types of messages , the receiver should able parse correct object out of received bytes. can done shown in example below: message message1 { required string = 1; required string b = 2; } message message2 { required int64 id = 1; required string data = 2; } message wrappermessage { required int64 commonfield = 1; oneof msg { message1 m1 = 2; message2 m2 = 3; } } basically, wrappermessage object sent on wire wraps message1 or message2 object. on receiving side may parse wrappermessage object first , use hasfield

Spring Hadoop Samples Mapreduce throw auxService:mapreduce_shuffle exception -

i following spring hadoop samples here , after trying run under mapreduce project: $ mvn clean package $ sh ./target/appassembler/bin/wordcount i got error: 17:42:55,067 info doop.yarn.client.api.impl.yarnclientimpl: 174 - submitted application application_1433091289740_0003 resourcemanager @ localhost/127.0.0.1:8032 17:42:55,095 info org.apache.hadoop.mapreduce.job:1272 - url track job: http://http://sjcc02mt0nufd58.local:8088/proxy/application_1433091289740_0003/ 17:42:55,096 info org.apache.hadoop.mapreduce.job:1317 - running job: job_1433091289740_0003 17:43:15,269 info org.apache.hadoop.mapreduce.job:1338 - job job_1433091289740_0003 running in uber mode : false 17:43:15,271 info org.apache.hadoop.mapreduce.job:1345 - map 0% reduce 0% 17:43:16,306 info org.apache.hadoop.mapreduce.job:1424 - task id : attempt_1433091289740_0003_m_000000_0, status : failed container launch failed container_1433091289740_0003_01_000002 :

c++ - sequenced before:the order of arguments of different functions -

#include <iostream> using namespace std; int f(int){cout << "f ";return 0;} int g(int){cout << "g ";return 0;} int a(){cout << "a ";return 0;} int b(){cout << "b ";return 0;} int main() { f(a()) + g(b()); return 0; } i konw sequenced before f, b sequenced before g. f , g unsequenced. how many results there? 1.a f b g 2.b g f example 1 , 2 may happen. how these? a b f g a b g f b f g b g f possibly or impossible? the thing that's guaranteed b() evaluated before g() , , a() before f() . 2 ordering relations obeyed. output compatible ordering possible. in case, means outputs 1 6 may happen.

android - Parse xml from url. Exception -

i need info url(" http://someurl.com/file.xml "). info in tags - "name", "surname". how can ? i know must using asynctask internet connection. i trying using xmlpullparser in asynctask, exception "indeoutofbound" class requesttask extends asynctask<string, void, void> { string name; @override protected inputstream doinbackground(string... uri) { try { xmlpullparserfactory factory = xmlpullparserfactory.newinstance(); factory.setnamespaceaware(true); xmlpullparser xpp = factory.newpullparser(); xpp.setinput(new inputstreamreader( geturldata("http://someurl.com/file.xml"))); while (xpp.geteventtype() != xmlpullparser.end_document) { if (xpp.geteventtype() == xmlpullparser.start_tag) { if (xpp.getname().

boolean - How do I undo True = False in python interactive mode? -

this question has answer here: naming conflict built-in function 7 answers so tried "evil" thing ned deily mentioned in answer here . have type true false. how reverse within interactive window? thing not do: true = false since true has been overridden false, there doesn't seem obvious way back-track. there module true comes can like: true = <'module'>.true you can del custom name set default: >>> true = false >>> true false >>> del true >>> true true >>>

xpath - fn:sum error "cannot cast to xs:double" -

i'm trying add multiple nodes (names & amount of nodes uncertain). performing query for $x in //onboard/* return $x returns (and more) <total> <one/> </total> <total> <one>124</one> <two>1</two> <three>0</three> </total> <total> <one>46</one> </total> <total> <one>129</one> <two>1</two> <three>0</three> </total> <seafarers> <one>149</one> <two>3</two> <three>3</three> <six>155</six> </seafarers> <soldiers> <one>135</one> <six>118</six> </soldiers> per child of name 'total' or 'seafarers' or similar not fixed return sum of values of nodes node 'one' node 'six' again, unsure how many nodes there , if of them exist (for each node @ least 1 number node exists, not have 'one

python - Play Animations in GIF with Tkinter -

i've been trying play animated gif using tkinter.photoimage , haven't been seeing success. displays image, not animation. following code: root = tkinter.tk() photo = tkinter.photoimage(file = "path/to/image.gif") label = tkinter.label(image = photo) label.pack() root.mainloop() it displays image in window, , that's it. i'm thinking issue has tkinter.label i'm not sure. i've looked solutions tell me use pil (python imaging library), , it's don't want use. with answer, created more code (which still doesn't work...), here is: from tkinter import * def run_animation(): while true: try: global photo global frame global label photo = photoimage( file = photo_path, format = "gif - {}".format(frame) ) label.configure(image = nextframe) frame = frame + 1 except exception:

Background image using Gulp and Sass -

i searched , found these background images path in sass , compass , multiple background images using sass / compass , sass background images please bear me since new gulp. don't have separate config.rb file , set in gulpfile.js. here have compass = require('gulp-compass'); gulp.task('compass', function(){ gulp.src(sasssources) .pipe(compass({ // loading config without config.rb sass: '1_components/sass', style: 'expanded', image: '2_builds/development/images' })) .on('error', gutil.log) .pipe(gulp.dest('2_builds/development/css')) .pipe(connect.reload()) }); gulp.task('watch', function(){ gulp.watch(jssources, ['js']); gulp.watch('1_components/sass/*.scss', ['compass']); gulp.watch(htmlsources, ['html']); }); and in sass file when type #section0, #emptyattach { @include background (linear-gradient(center left, rgba(

javascript - Looking inefficiencies in a JS function -

i'm working out codeeval problem gives me array of strings. each string has 4 integer values represent 2 points on cartesian grid so, 'a, b, x, y', may same. objective determine relative direction of second point in relation first point , express relationship in conventional orienteering terms, e.g., n, ne, e, ..., nw. if points identical, return here. i able solve problem ok, , core of function here var ary = line.split(' '), direction = '', dif_long = ary[2] - ary[0], dif_lat = ary[3] - ary[1]; if (dif_lat !== 0){direction = (dif_lat > 0) ? 'n' : 's';} if (dif_long !== 0){direction += (dif_long > 0) ? 'e' : 'w';} if (direction == '') {direction = 'here';} console.log(direction ); i've put sample data on js fiddle , modified generate list rather console.log. my problem got 0 points solution. leads me think have performance problem somewhere. appreciat

javascript - external js not loading -

i'm trying codepen code working locally: http://codepen.io/desandro/pen/mcdbd/ however, when try load js external script, not work: <!doctype html> <html lang = "en"> <script src="isotope.pkgd.js"></script> <script src="jquery.min.js"></script> <script src="isotopes.js"></script> but if copy paste file markup: <!doctype html> <html lang = "en"> <script src="jquery.min.js"></script> <script src="isotope.pkgd.js"></script> <script> $( function() { // quick search regex var qsregex; var buttonfilter; // init isotope var $container = $('.isotope').isotope({ itemselector: '.element-item', layoutmode: 'fitrows', filter: function() { var $this = $(this); var searchresult = qsregex ? $this.text().match( qsregex ) : true; var buttonresult = buttonfilter