Posts

Showing posts from September, 2011

ios - Is there a way to use React Native to render a portal? -

intent of question understand if there way render portal's content using react native replacing portal ui components corresponding native views (any github projects this)? intent avoid asking portal (responsive portal) rewritten react (because lot of months has been invested in getting portal current stage , rewriting expensive) still able render portal pages native , feel instead of wrapping portal content in webview , showing native app? thanks, padmanabhan

reactjs - Show DrawerLayoutAndroid via ToolbarAndroid using Navigator (React Native) -

i'm new react native , i'm doing simple android app. added drawerlayoutandroid can drag left of screen. i'd open when click on menu icon in toolbarandroid having navigator gave me error "undefined not object (evaluating 'this.refs['drawer']')" then solved mistake got 1 being "undefined not object (evaluating 'this.props.sidebarref'). my code this: mytoolbar.js 'use strict'; import react, { component } 'react'; import { stylesheet, view, text } 'react-native'; var toolbarandroid = require('toolbarandroid'); class mytoolbar extends component { render() { var navigator = this.props.navigator; return ( <toolbarandroid title={this.props.title} navicon={require('./icons/ic_menu_white_24dp.png')} style = {styles.toolbar} titlecolor={'white'} oniconclicked={this._oniconclicked}/> ); }

build.gradle - gradle.daemon react-native: Could not find or load main class “Dorg.gradle.daemon=true” -

when try build project command 'react-native run-android' following error appears: error: not find or load main class “dorg.gradle.daemon=true” js server running. building , installing app on device (cd android && ./gradlew installdebug... error: not find or load main class “dorg.gradle.daemon=true” not install app on device, read error above details. .bash_profile contains following global variables: export android_home=$home/library/android/android-sdk export java_home=/library/java/javavirtualmachines/jdk1.8.0_92.jdk/contents/hom export gradle_opts=“dorg.gradle.daemon=true” i have emulator running , have ran command "source ~/.bash_profile". all want enable gradle daemon , execute project . don't know if reason should rather: gradle_opts="-dorg.gradle.daemon=true" mind dash - .

sql - Displaying selected values only in VB6 -

i trying display students in datagrid have "yes" active. if student has "no" active, form has hide , show students "yes". problem recieving syntax error in clause. code: private sub form_load() dim sql string connsearch.open connstr adodc1.connectionstring = conn.connstr sql = "select * table1 active <>" & "'no'" adodc1.recordsource = sql set studenttable.datasource = adodc1 adodc1.refresh adodc1.visible = false end sub what active ? if active boolean data type (yes/no), it's optional values true or false . in case query is: "select * table1 active <> false" if active string data type; 'no' , 'no' same values? better converting lower or upper case: "select * table1 ucase(active) <> 'no'" edit: modified code dim sql string sql = "select * table1 [active] <> 'no'" adodc1.connectionstring = con

f# - How can I use FsCheck with a portable class library? -

how can use fscheck portable class library? i receive following error: error not install package 'fscheck.xunit 2.5.0'. trying install package project targets '.netportable,version=v4.5,profile=profile7', package not contain assembly references or content files compatible framework. more information, contact package author. does mean fscheck not pcl compliant?

scala - "Filename too long" in sbt assembly inside a docker container -

i have scala play project , need create fat jar in docker build time error: [warn] error extracting zip entry [...] (file name long) i tried adding option scalacoptions ++= seq("-xmax-classfile-name","72") in build.sbt doesn't works. tried appending -xmax-classfile-name=72 sbt assembly same result. as need in docker build time, can't use mounted volume mentioned here https://github.com/sbt/sbt-assembly/issues/69#issuecomment-196901781 what need fix this? in /project/plugins.sbt addsbtplugin("com.eed3si9n" % "sbt-assembly" % "0.13.0") and in build.sbt assemblyjarname in assembly := "jarname.jar" target in assembly := basedirectory.value then run command "assembly" project root , should generate jar file.

c# - convert CheckBoxFor to jQuery UI button -

i have check boxes in mvc app, i'd convert fancy jquery ui buttons detailed here: https://jqueryui.com/button/#checkbox my code: <td align="center">@html.checkboxfor(model => model.rjanval)</td> sample code: <input type="checkbox" id="check"><label for="check">toggle</label> how do it? don't understand enough happens in here "(model => model.rjanval)", can convert code. new c# , mvc why struggle. please :) (model => model.rjanval) result in generation of attributes name , id relatively property gave (only html helpers generating inputs, selects, textareas, ...). for labels , generate attribute for . so checkbox should have name="rjanval" , id="rjanval" . and label have for="rjanval" . so, can write cshtml code this: <td align="center"> <div id="buttons> @html.checkboxfor(model =>

angularjs - Password Hash on PHP Server always looks the same -

i've been provided php api ends project, i've faced weird issue, here how looks : i have set_customer api, when send request postman register user : 1 - success response ( registration ), 2 - when login loaded username , password, login successful. now when send request same api angularjs service, 1 - still success response ( registration ) ok, 2 - when try login same credentials time login fails. i have logged data i'm sending , receiving, username , password, request payload , input data, seem correct. both when i'm registering , when i'm logging in. the weird thing in nutshell when register user postman, can login afterwards if register same user via $http call, can't login anymore! p.s. looked @ database , every time register using angular $http hash same. if input different passwords. anyone possible solution ?! assumption appreciated !

android - Deep linking href in pdf -

i have deep link works when in chrome browser open app id. link looks following: intent://m/#intent;scheme=myapp://app.com/reference/2016062910185811;package=some.package.com;end this works when in webbrowser via <a href="intent://...;end">click</a> . but when setting link in pdf (via aspose) doesn't anything, although recognizes link (i can see click animation). the link set via following code:: var img = new aspose.pdf.generator.image(sec1); tr.paragraphs.add(img); //assign new instance of hyperlink hyperlink property of segment img.hyperlink = new hyperlink { linktype = hyperlinktype.file, url = "intent://m/#intent;scheme=myapp://app.com/reference/" + input.reference + ";package=some.package.com;end" }; non-standard url schemes (which intent:// is, literally) aren't treated links. sounds pdf viewer you're using isn't set recognize them correctly, , if were, link broken anywhere except on andro

how can i set proxy to my url request in ios -

i have been trying set proxy request loaded in uiwebview, using asihttprequest not able find solution nothing happens , times out. the code this: asihttprequest *request = [[asihttprequest alloc ] initwithurl:url]; [request setvalue:@"user-agent: mozilla/5.0 (ipad; u; cpu os 4_3_2 mac os x; en-us) applewebkit/533.17.9 (khtml, gecko) mobile" forkey:@"useragent"]; [request setproxyhost:@"proxyaddress"]; [request setproxyport:@"myportvalue"]; [request setdelegate:self]; [request startasynchronous]; please me find wrong

Windows batch file - string comparison with wildcard -

i have file myfile.txt bunch of strings. wrote following batch file loop through lines, , print line if equals specific string (for sake of demo, choose string foo ): @echo off setlocal enableextensions enabledelayedexpansion /f %%i in (myfile.txt) ( line=%%i if !line! equ foo* ( echo !line! ) ) in application, not need print lines match foo , lines match foobar , foobarfred , foofred , ... that's why put wildcard there. but doesn't work.. please help. findstr /b "foo" myfile.txt /b : line should start string also might useful: /i : ignore capitalization (find foo, foo, foo, ...) see findstr /? more options

shell - deleting line numbers in sed or awk -

i have file in each line begins number 0-243, , restarts 0-243 2000 times. how can delete line numbers awk or preferably sed? used command in awk doesn't work : '{$1=$2= " "; $0=$0; $1=$1}1' this should do, provided there no other numbers @ beginning of line: sed -r 's/^[0-9]+//'

C# Bitmap/Graphics Out of Memory -

i'm trying take snapshot of whole screen reading pixel values. i'm doing without problem. after 214 snapshots, i'm getting out of memory exception. bitmap screenshot = new bitmap(screen.primaryscreen.bounds.width, screen.primaryscreen.bounds.height); public bitmap takesnapshot() { graphics graphic = null; rectangle rect = new rectangle(0, 0, screen.primaryscreen.bounds.width, screen.primaryscreen.bounds.height); using (graphic = graphics.fromimage(screenshot)) { graphic.copyfromscreen(screen.primaryscreen.bounds.x, screen.primaryscreen.bounds.y, 0, 0, screenshot.size, copypixeloperation.sourcecopy); } return screenshot.clone(rect,system.drawing.imaging.pixelformat.format32bppargb); } i'm using method timer bitmap bmp = takesnapshot(); var c = bmp.getpixel(0,0); it giving invalid parameter exception. solved "using". i'm stuck on exception. you need

Python - Run function with parameters in command line -

is possible run python script parameters in command line this: ./hello(var=true) or mandatory this: python -c "from hello import *;hello(var=true)" the first way shorter , simpler. most shells use parentheses grouping or sub-shells. can't call commands command(arg) normal shell ...but can write python script (./hello.py) takes argument. import optparse parser = optparse.optionparser() parser.add_option('-f', dest="f", action="store_true", default=false) options, remainder = parser.parse_args() print ("flag={}".format(options.f)) and call python hello.py -f

osx - QListWidget on mac os X show abnormal -

Image
i use qlistwidget on qt creator of mac, code m_plistwidget->setobjectname(qstringliteral("ttmanagevmlist")); m_plistwidget->setframeshape(qlistwidget::noframe); m_plistwidget->setattribute(qt::wa_translucentbackground,false); m_plistwidget->setalternatingrowcolors(true); m_plistwidget->setcontentsmargins(0,0,0,0); m_plistwidget->setresizemode(qlistview::fixed); m_plistwidget->setautoscroll(true); m_plistwidget->setedittriggers(qabstractitemview::noedittriggers); but shows abnormal,like it has blue border,but when loses focus,it's normal. knows reason of problem? i believe can use this: m_plistwidget->setattribute(qt::wa_macshowfocusrect, false); read qt::wa_macshowfocusrect here indicates widget should qfocusframe around it. widgets draw own focus halo regardless of attribute. not qwidget::focuspolicy plays main role in whether given focus or not, controls whether or not gets focus frame. attribute applicable os x

excel - How to extract data from one cell to another -

given spreadsheet cell containing string consists of hyphenated series of character segments, need extract fourth segment. for example, consider column containing data strings xx-xxx-x- g10 -xx-xxx, x denotes character. formula need place in column b g10 result? b 1 xx-xxx-x-g10-xx-xxx g10 i'm looking formula work in in libre office calc, open office calc, ms excel, or google sheets. it simple... mid right function: =mid(a1;10;3) where: a1 data 10 start 10 character - in case g 3 range of characters count 10 (10, 11, 12) pros: simple cons: work constant strings

angularjs - how do i display base 64 encoded string as image in ionic app in offline -

my code in here here $scope.student_photo variable encoded string first in ajax , stored in local db $http.post(mdata.url+'getstudentdetails/',{student_id : student_id} ).success(function(data){ //$scope.student_pic = data.student_details[0].student_pic; //$scope.student_photo = data.student_details[0].student_photo; $scope.myimage=data.student_details[0].student_photo; //alert($scope.myimage); // var image_stu = data.student_details[0].student_photo; // localstorage.setitem("imagedata", image_stu); // document.getelementbyid("img_stu").src='data:image/png;base64,' + image_stu; //alert("done"); var events = data.student_details var l = events.length; //alert(l); db.transaction(function(tx) { tx.executesql('select * dashboard ', [], f

virtualbox - unable to mount /vagrant in Solaris box -

i created vagrantfile , downloaded solaris box. during vagrant up command, i'm getting below error. default: /vagrant => c:/users/w726901/desktop/solaris following ssh command responded non-zero exit status. vagrant assumes means command failed! sudo chown `/usr/xpg4/bin/id -u vagrant`:`/usr/xpg4/bin/id -g vagrant` /vagrant stdout command: stderr command: chown: /vagrant: invalid argument versions used: vagrant - 1.8.4 virtualbox - 4.3.18 solaris - solaris-11.2.box the vagrantfile : vagrant.configure(2) |config| config.vm.box = "solaris" config.vm.network "public_network" end solaris box link : http://www.benden.us/vagrant/solaris-11.2.box how fix issue.

php - Python setup.py egg_info failed with error code 1 at pip install psycopg2 -

[root@nav15 nav15]# pip install psycopg2 collecting psycopg2 /usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: insecureplatformwarning: true sslcontext object not available. prevents urllib3 configuring ssl appropriately , may cause ssl connections fail. more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. insecureplatformwarning using cached psycopg2-2.6.2.tar.gz complete output command python setup.py egg_info: running egg_info creating pip-egg-info/psycopg2.egg-info /tmp/pip-build-fh_xn3/psycopg2/setup.py:12: deprecationwarning: parameters load deprecated. call .resolve , .require separately. # fitness particular purpose. see gnu lesser general public writing pip-egg-info/psycopg2.egg-info/pkg-info writing top-level names pip-egg-info/psycopg2.egg-info/top_level.txt writing dependency_links pip-egg-info/psycopg2.egg-info/dependency_links.txt writing

Convert JavaFX Image object to byte array -

we can create fx image object using byte [] bytes = ------; //valid image in bytes javafx.scene.image.image image = new image(new bytearrayinputstream(bytes)); and can set imageview. i need opposite without converting first bufferedimage (swingfxutils.fromfximage(image,null)). so can directly write bytes file. i've tried following: pixelreader pixelreader = image.getpixelreader(); int width = (int)image.getwidth(); int height = (int)image.getheight(); byte[] buffer = new byte[width * height * 4]; pixelreader.getpixels( 0, 0, width, height, pixelformat.getbytebgrainstance(), buffer, 0, width * 4 ); but file generated writing byte [] buffer not valid image. any insights on this? edit: solutions given @ how byte[] javafx imageview cannot applied question. i've mentioned not want use converting bufferedimage using swingfxutils. moreover, wan

Cplex OPL model with Java data file -

i'm new user of cplex. want use java code generate data file use in cplex opl model. command should insert in opl code , java 1 can such thnig. thak you. in java use ilooplmodel.printexternaldata(java.io.outputstream outs) in opl use {st ring} printexternaldata(title) in ilooplmodel you have opl+java examples in cplex_studio1263\opl\examples\opl_interfaces\java regards

regex - How to apply string method on regular expression in Python -

i'm having markdown file wich little bit broken: links , images long have line-breaks in it. remove line-breaks them. example: from: see example [installation process ubuntu trusty](https://wiki.diasporafoundation.org/installation/ubuntu/trusty). project offers vagrant installation too, documentation admits know do, developer. if difficult ![https://diasporafoundation.org/assets/pages/about/network- distributed-e941dd3e345d022ceae909beccccbacd.png](data/images/network- distributed-e941dd3e345d022ceae909beccccbacd.png) _a pretty decentralized network (source: <https://diasporafoundation.org/>)_ to: see example [installation process ubuntu trusty](https://wiki.diasporafoundation.org/installation/ubuntu/trusty). project offers vagrant installation too, documentation admits know do, developer. if difficult ![https://diasporafoundation.org/assets/pages/about/network-distributed-e941dd3e345d022ceae909beccccbacd.png](data/images/network-distributed-e941dd3e345d022ce

c++ - How to draw a Rectangle in Qgraphicsview dynamically (runtime), using Qt4 -

using qt creator version 2.4.1. i'm starter on qt platform , trying draw rectangle dynamically. program uses 3 mouse events namely mousepressevent mousemoveevent mousereleaseevent problems mousemoveevent never called. here code snippet main.cpp #include <qtgui/qapplication> #include "dialog.h" int main(int argc, char *argv[]) { qapplication a(argc, argv); dialog w; w.show(); return a.exec(); } dialog.cpp #include "dialog.h" #include "ui_dialog.h" #include "mysquare.h" dialog::dialog(qwidget *parent) : qdialog(parent), ui(new ui::dialog) { ui->setupui(this); setmousetracking(true); scene = new qgraphicsscene(this); ui->graphicsview->setscene(scene); scene->setbackgroundbrush(qt::black); square = new mysquare; scene->additem(square); square->mpix = qpixmap(200,200); square->mpix.fill(qt::white); scene->addpixmap(square->m

java - unable to run spring MVC fully annotation based -

Image
i'm new spring mvc. project structure follows: i'm getting following error while running web project: http status 404 - type status report message description requested resource not available. apache tomcat/7.0.65 appconfig.java: package config; import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration; import org.springframework.web.servlet.viewresolver; import org.springframework.web.servlet.config.annotation.enablewebmvc; import org.springframework.web.servlet.view.internalresourceviewresolver; import org.springframework.web.servlet.view.jstlview; @configuration @enablewebmvc public class appconfig { @bean public viewresolver viewresolver() { internalresourceviewresolver viewresolver = new internalresourceviewresolver(); viewresolver.setviewclass(jstlview.class); viewresolver.setprefix("/web-inf/views/"); viewresolver.setsuffix(".jsp");

android - Options menu items not working when Scroll view is used -

i created xml file menu , inflating in oncreateoptionsmenu() method. the menu items working fine in lollipop device nested scrollview, not working (they visible not able click on items) in previous versions. when remove scrollview working fine. when gave padding of ?attr/colorprimary or more scrollview not working. there problem nestedscrollview or scrollview action bar? need scroll view. doing wrong? activity layout file: <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/apptheme.appbaroverlay"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:popuptheme="@style/apptheme.popupoverlay" /> </andr

mongodb - How to get critarea result with specific key and value from collection of mongo database? -

lets suppose, have collection called posts { "_id": objectid("5146bb52d8524270060001f3"), "post_text":"this sample post" , "user_name": "mark", "post_privacy": "public", "post_likes_count": 0 } lets assume have same table in mysql. want same query of sql result mongo. query is: select post_likes_count posts user_name="mark"; how can same result in mongodb? ans: db.posts.find({user_name:"mark"},{post_likes_count,_id:0}).pretty(); note mongodb default returns _id field each find statement. if not want field in our result set, have specify _id key 0 value in list of columns retrieved. 0 value of key indicates want exclude field result set

Chef for Windows, Gaurd examples for deploying only changes -

i looking examples on how program guards achieve differential deployments. suppose have exe1, exe2, sql1, sql2 entire application. create complete cookbooks steps deploy entire application. deploy on servers. then make change in sql2. make changes in cookbook , upload that; complete cookbook goes server. want chef needed deployment steps sql2 only. chef automatically handle that? see examples guards written, e.g. check db instance existence, if not install, etc. have write guards similar check file changes , deploy on changes? best practices? most chef resources (and similar constructs in other modern cm tools) "idempotent" meaning take whatever action required reach desired end state. means if have, say, template resource , content correct, doesn't updated. resources can't idempotent on own nature, execute , friends, can write checks ensure idempotence yourself.

iOS Swift code freezes with NSURL when sent from foreground to background to foreground again with 100% loss connection -

i have been developing swift 6 months new user. app i'm working on has focus on poor connections , slow speeds. app freezes under following conditions. i have json query data server, uses nsurl / nsdata. if have connection works, if have no connection fails expected , report error user there no connection. but: if connection has 100% loss (you can simulate via developer settings within phone, network link conditioner) query runs , app shows activity indicator. press home button put app background , click app icon open again. activity screen still displayed display frozen. activity indicator doesn't spin , battery icon , clock update draw on top of each other (there no refresh whatsoever). after 30 seconds or app terminates. expect watchdog killing app due freeze. if run same process phone connected xcode app doesn't terminate. assume watchdog doesn't kill tasks when running via xcode. this may seen rare occurrence try catch bug / freeze in code cannot erro

fortran - SELECTED_REAL_KIND in C -

is there equivalent of selected_real_kind (in fortran) in c language ? selected_real_kind standard fortran mechanism choosing @ build time real data type meets or exceeds specified parameters numeric representation. in particular, used select data type precision , / or exponent range , / or radix. standard c not have built-in parameterized facility such designating data types. does have standard macros values describe properties of implementations of standard floating-point types, float , double , , long double . joint radix, precisions in both decimal digits , implementation-radix digits, , minimum , maximum exponent values (also in both decimal , implementation-radix forms) available via these macros. these defined in standard header float.h . (the link posix, formally aligned c standard here.) it possible use c preprocessor conditionals , these macros define macros or typedefs types meet specific requirements, can use throughout code. not tidy fortran's

multithreading - C# - Enable Multi-thread mode in SQLite -

how enable multi-thread mode in sqlite? trying in run-time selection can't find out how it. trying sqliteconnectionflags can't find flag it. can provide me simple example? have no idea how compile-time or start-time selection also. official documentation: https://www.sqlite.org/threadsafe.html

php - mysql select rows with top max value -

Image
i have table in mysql columns: id , view , agree . have upload table 's image below: i want select 8 rows greater others in view column. condition agree = 1 . can tell me how can mysql query or php . select * table_name agree = 1 order view desc limit 8

python - How to access the dict value? -

i have response syntax of type dict : { 'stoppinginstances': [ { 'instanceid': 'string', 'currentstate': { 'code': 123, 'name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped' }, 'previousstate': { 'code': 123, 'name': 'pending'|'running'|'shutting-down'|'terminated'|'stopping'|'stopped' } }, ] } now if need check if currentstate stopping how so? print "stopping instance now",response['stoppinginstances'] instance in response['stoppinginstances']: if instance['currentstate']['name'] == "stopping": print "still stooping" if instance['currentstate']['name

c# - There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'SelectedCategoriesIds' -

this question has answer here: the viewdata item has key 'xxx' of type 'system.int32' must of type 'ienumerable<selectlistitem>' 1 answer i got error there no viewdata item of type 'ienumerable' has key 'selectedcategoriesids'. my model code: public class newsviewmodel { public int newsid { get; set; } public string newstitle { get; set; } public string newsbody { get; set; } public system.datetime newsdate { get; set; } public string newsimagepath { get; set; } public httppostedfilebase newsimagefile { get; set; } public int[] selectedcategoriesids { get; set; } } my code in controller: var list = db.categories.tolist(); viewbag.categorylist = c in list orderby c.categoryname select new select

javascript - Add line breaks to data being pulled from SQL database -

i retrieving field database html page. place field between <p></p> following, 84 series harmony3 desk top module 2 x uk power socket 3.15a individually fused 1m black hardwired mains cable gst wieland plug anodised silver body black plastic fascias black inner , outer end caps encoded string 84+series+harmony3+desk+top+module%0d%0a2+x+uk+power+socket%0d%0a3%2e15a+individually+fused%0d%0a1m+black+hardwired+mains+cable%0d%0ato+gst+wieland+plug++++++++++++%0d%0aanodised+silver+body%0d%0ablack+plastic+fascias%0d%0ablack+inner+and+outer+end+caps%0d%0a++++++++++++++++++++++++++++++%0d%0a%0d%0a%0a i using classic asp & dreamweaver bindings. if place same field in <textarea></textarea understands there line breaks in field, , displays text correctly, 84 series harmony3 desk top module 2 x uk power socket 3.15a individually fused 1m black hardwired mains cable gst wieland plug anodised silver body black plastic fascias black inner , outer end caps i w

python - Difference between Sqlalchemy execution time and execution time from EXPLAIN query? -

i using postgresql flask , sqlalchemy. found if in python, t1 = datetime.datetime.now() session.query(table_class).all() t2 = datetime.datetime.now() print (t2 - t1) i getting execution time of sqlalchemy query. if go postgresql , write same sql statement explain analyse can execution time of sql query. like, explain analyse select * table; i found difference between these execution times much. sqlalchemy execution time 10 times execution time explain query. small queries 2 times (75ms , 2 ms) , long queries many joins times (1.5sec , 200ms). don't know why happening. why these times have big difference? the difference cause communication overhead. when run explain analyse measuring exact time of query in postgres database. when measure time in python code measuring time of query execution plus: time of connecting database, sending data, receiving/parsing result, etc. depending on amount of data transferred , physical location of database can expect significant

javascript - Pass the youtube video ID to another JS file -

i had check whether url valid youtube video url , youtube video id it, far using simple javascript split function in order achieve this, want pass id javascript file, there youtube palyer , want play video on page. i have been viewing other stackoverflow threads i need passes videoid's file executed: http(s)://www.youtu.be/videoid http(s)://www.youtube.com/watch?v=videoid (and optionally other short url's script automatically detects whether contains youtube video) any ideas can handled browser quick/efficient appreciated!

mongo c driver - MongoDB CDriver how to update array object in index N? -

i have document looks : { "_id" : objectid("5768e43"), "appid" : { "number" : 0, }, sessions : [{ id : 111111, "setoid" : { "number" : 0 }, "custid" : { "number" : 0 }, }, { id : 133333, "setoid" : { "number" : 2 }, "custid" : { "number" : 2 }, }, { id : 7777, "setoid" : { "number" : 2 }, "custid" : { "number" : 2 }, }, ] } i sessions elment id == 133333 ( in [1] ) , able update new values , add new elements : { id : 133333, "setoid" : { "number" : 3333

python - How can I rearrange the index level with Pandas? -

the purpose of post try understand how best manipulate dataframes multilevels. create dataframe import numpy np dates = pd.date_range('20130101', periods=6) df = pd.dataframe(np.random.randn(6,4), index=dates, columns=list('wxyz')) df['portfolio']= list('abcdef') df dataframe y z portfolio 01/01/2013 1 2 02/01/2013 3 4 b 03/01/2013 5 6 c 04/01/2013 7 8 d 05/01/2013 9 10 e 06/01/2013 11 12 f pivot dataframe dfs_pivot = df.pivot(columns='portfolio') dfs_pivot pivoted dateframe y z portfolio b c d e f b c d e f 2013-01-01 1 nan nan nan nan nan 2 nan nan nan nan nan 2013-01-02 nan 3 nan nan nan nan nan 4 nan nan nan nan 2013-01-03 nan nan 5 nan nan nan nan nan 6 nan nan nan 2013-01-04 nan nan nan 7 nan nan nan nan nan 8 nan

PHP nested while loop -

i tried while inside while print multiplication table like, 1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 4 8 12 16 20 5 10 15 20 25 but got 1, 2, 3, 4, 5. code: $i = 1; $x = 1; while($i <= 5){ while($x <= 5){ echo $i * $x; $x++; } echo "<br>"; $i++; } this happening because you're not resetting $x when inner loop completes iteration. try instead: $i = 1; while($i <= 5) { $x = 1; while($x <= 5) { echo $i * $x; $x++; } echo "<br>"; $i++; }

c# - Extension Method Collision -

this question has answer here: overload resolution issue generic method constraints 3 answers i have 2 extension methods interface, 1 performs action on instance of class implementing interface , 1 on collection of classes implementing interface. problem compiler uses first extension method , creates compile error, cannot use collection version. public interface isomeinterface { } public class someclass : isomeinterface { } public static class someclassextensions { public static t dosomething<t>(this t item) t : class, isomeinterface { return item; } public static ienumerable<t> dosomething<t>(this ienumerable<t> items) t : class, isomeinterface { return items; } } internal class program { private static void main() { var items = new[] { new someclass() }

Querying database in Grails -

the values in database saved such ::{"rating1":"2","rating2":"4","rating3":"5","rating4":"0","rating5":"0"}, need acces individual values 2,4,5 etc. i made variable "rating" of domain class type , tried accesing object using (.) operator wont work , gives error: :exception::groovy.lang.missingpropertyexception: no such property: rating1 class: java.lang.string , tried casting array , list (as array, arraylist, list) etc wont work either. casting list gives exception:exception::org.codehaus.groovy.runtime.typehandling.groovycastexception: cannot cast object '{"rating1":"2","rating2":"4","rating3":"5","rating4":"0","rating5":"0"}' class 'java.lang.string' class 'java.util.list' . accessing "rating[3]" gives answer "a". should us

Drupal: unable to set labels for x axis using Charts module -

i want create line chart displaying changes in share price on time using drupal charts 7.x-2.0-rc1 api , google charts library. tried following code , populated chart random values: $chart = array( '#type' => 'chart', '#chart_type' => 'line', '#chart_library' => 'google', '#title' => t(''), '#legend' => false, '#colors' => array('ff6600'), '#width' => 480, '#height' => 240, '#data_labels' => true, '#raw_options' => array( 'vaxis' => array( 'viewwindowmode' => 'explicit', 'viewwindow' => array( 'min' => 1, ), ), 'haxis' => array( 'showtextevery' => 20 ) ), ); $data = array(); ($i = 0; $i < 100; $i++) { $data[$i] = a

c# - azure AD Security groups of a User -

i trying of security groups of authenticated user in example github example , , works many people, 1 man not work. has 403 error (forbidden) when app requests groups (lines 43-49). beginner azure ad, , can reason of situation? of other people prepared correctly in example. thanx lot. i first check user profile in azure ad , make sure looks there. ask user send fiddler trace can see data being sent , received.

C# SaveFileDialog Clicking cancel throws exception -

i have looked around @ possible different ways around issue, haven't found has fixed yet. everything works normal, savefiledialog box pops , and can click save no problem, if click cancel throws exception. my code below: private void createnewfile_click(object sender, routedeventargs e) { microsoft.win32.savefiledialog savefiledialog1 = new microsoft.win32.savefiledialog(); savefiledialog1.filename = "new note"; //default file name savefiledialog1.defaultext = ".txt"; //default file extension savefiledialog1.filter = "text files (.txt)|*.txt"; //filter files extension savefiledialog1.showdialog(); //bring dialog box if(savefiledialog1.filename != "") { using (streamwriter sw = new streamwriter(savefiledialog1.openfile())) { sw.write(textresult.text); } } } the line throws error on one: using (streamwriter sw = new streamwriter(savefiledialog1.openfile()))

Powerpoint change table formation in VBA -

i trying edit table in slide, , using code takes lot of time complete. for lrow = 1 otbl.rows.count lcol = 1 otbl.columns.count otbl.cell(lrow, lcol).shape.textframe.textrange .font.name = "arial" .font.size = 30 end next next maybe code can you. change format in each table of active presentation. have update font name , font size. sub format() dim s slide dim osh shape dim otbl table dim lrow long dim lcol long for each s in activepresentation.slides for each osh in s.shapes if osh.hastable set otbl = osh.table lrow = 1 otbl.rows.count lcol = 1 otbl.columns.count otbl.cell(lrow, lcol).shape.textframe.textrange .font.name = "batang" .font.size = 16 end next next end if next next s end sub

swift - Transform Reactive Cocoa SignalProducer into enum -

i'm trying transform api signalproducers enum loading, failed , loaded states. enum is: enum dataloadstate<datatype>{ case loading case failed case loaded(datatype) } to transform signalproducer noerror producer , start loading state: extension signalproducertype{ func materializetoloadstate() -> signalproducer<dataloadstate<value>,noerror>{ let producer = self .map(dataloadstate.loaded) .startwithvalue(dataloadstate.loading) return producer.ignoreerrors(replacementvalue:dataloadstate<value>.failed) } } extension signalproducertype { func startwithvalue(value:value)->signalproducer<value,error>{ return signalproducer(value:value).concat(self.producer) } public func ignoreerrors(replacementvalue replacementvalue: self.value? = nil) -> signalproducer<self.value, noerror> { return self.flatmaperror { error in return replacementvalue.map

In R, how can I use different colors for each range in my scatterplot? -

Image
i'm trying plot r series of 120 numbers first 40 of 1 type, next 40 items of second type , last 40 items of third type. right i'm plotting scatter-plot , hard tell 3 sections apart: data <- read.table("mydata.txt") plot(data[,1]) is there way distinguish 3 sections, in following mockup made? you provide colour vector if data ordered. mydata <- runif(120) plot(mydata, col = rep(rainbow(3), each = 40)) rainbow(3) makes colour vector of 3 colours, , rep each = 40 makes 40 copies of each.

javascript - OpenPopup Marker Bug? -

hi when try open popup of marker right after creating it, won't work. var marker = l.marker([x, y],{icon:greenicon}).bindpopup(markerstring); marker.openpopup(); console.log(marker.getpopup().isopen()); log -> false have add marker map first ? as have huge array of markers, create featuregroup first, add markers , add featuregroup map. how can access marker in featuregroup open popup afterwards? do have add marker map first ? yes, yes, yes. otherwise, how marker know map related to? how can access marker in featuregroup open popup afterwards? simply keep variable each of markers (could in array), or iterate markers in feature group determine appropriate marker based on criteria (if have some). totally application developer.

android - How Get a list of current running APP in Anrdroid -

i want use activitymanager list of current apps , return newest process` name system clipboard.just this protected void onstart() { super.onstart(); amanager=(activitymanager)this.getsystemservice(activity_service); activitymanager.runningappprocessinfo app=null; list<activitymanager.runningappprocessinfo> runningtasks; try { runningtasks = amanager.getrunningappprocesses(); app = runningtasks.get(0); }catch (final exception e){log.d(tag, "list error");} if(app!=null) { string result =app.processname; contenttext.settext(result);; clipboard.settext(result); }else { log.d(tag, "component error"); } } but when running @ simulator, errors occured: java.lang.runtimeexception: unable start activity componentinfo{//the absolute address}: try activitymanager actvitymanager = (activitymanager) th

javascript - Desktop push notification using Google cloud messaging and service worker -

i want send push notification desktop users using google cloud messaging i completed following steps successfully initialised in service worker created project on google developers console added manifest sent using php curl here curl commands $url = 'https://android.googleapis.com/gcm/send'; $msg="hi"; $data = array('title'=> $msg,'message'=>'hello'); $regids= // added regids; $fields = array('to' => $regids,'data' => $data); $headers = array( 'authorization: auth key','content-type: application/json'); $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_httpheader, $headers); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_postfields, json_encode($fields)); print_r(json_encode($fields)); $result=curl_exec($ch); echo $result; if($result==fals

angularjs - I couldn't using bootstrap $uibModal is undefined -

i trying use bootstrap couldn't app.js i want use bootstrap users module angular.module('authentication', []); angular.module('home', []); angular.module('menubar',[]) angular.module('register',[]) angular.module('register',[]) angular.module('uservalidation',[]) angular.module('users',['ui.bootstrap']) angular.module('smart-table',[]) angular.module('ui.bootstrap',[]) angular.module('mb', [ 'authentication', 'home', 'ngroute', 'ngcookies', 'menubar', 'register', 'uservalidation', 'users', 'smart-table', 'ui.bootstrap' ]) and added js file in index.jsp <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.14.1.js"></script> and controller &

javascript - Move cells up/down in tables with rowspan in jquery -

i'm trying create table option of moving cells up/down. have rowspan option in table mentioned below code. have problem in moving (up/down) whole row rowspan having problem. have included code below. can on solving issue. <table id = "customtable" border="1"> <tbody> <tr class="oddrow"> <td rowspan="3">one</td> <td rowspan="3"> <img alt="up" src="blue_shiftup.png" class="up" /> <img alt="down" src="blue_shiftdown.png" class="down" /> </td> <td>11</td> <td>12</td> <td>13</td> <td rowspan="3"> 1 last cell</td> </tr> <tr class="oddrow"> <td>14</td> <td>15&