Posts

Showing posts from April, 2015

c# - How can I invoke PaintEventArgs for results returned by EventArgs from Web Service -

i have code: public partial class form1 : form { private int size; public form1() { initializecomponent(); size = 10; } private void runautomat_click(object sender, eventargs e) { var mymatrix = new int[size][]; (int = 0; < size; i++) { mymatrix[i] = new int[size]; (int j = 0; j < size; j++) mymatrix[i][j] = 0; } var cw = new mywebservice(); var result = cw.fillmatrix(mymatrix, size); } } next want draw grid result, don't have idea how send method painteventargs. example this: private void pb_paint(object sender, painteventargs e) { int cellsize = 2; (int x = 0; x < size; ++x) (int y = 0; y < size; ++y) { if (result [y, x].state == 1) e.graphics.fillrectangle(new system.drawing.solidbrush(color.cyan), new rectangle(y * cellsize, x * cellsize, cellsize

ios - Ionic Framework navigating from a view on one tab to a view on another tab -

i'm building hybrid mobile application using ionic framework. i'm using tabs style app , i'm wondering if it's possible route view within 1 tab view tab ability hit button , go view on other tab. i shouldn't need show of code here question more of logic question within ionic framework. if have example code of working within framework please share though. thanks! ionic uses angular states, can in www/js/app.js : .state('tab.chats', { url: '/chats', views: { 'tab-chats': { templateurl: 'templates/tab-chats.html', controller: 'chatsctrl' } } }) to "chats" tab view use state: $state.go('tab.chats'); in controller function , call function in button onclick().

sql server - SSIS ETL package intermittently loads partial data -

i have ssis package uses sql statements pull data 10 postgres databases identical schemas different data. package written job 10 tasks, each task has hardcoded values indicating server pull data from. source sql doesn't change, , db schemas across 10 source servers identical, data different. basically, we're running data extract against 10 instances of app's backend on loop. we use 32-bit odbc driver connect postgres sql server 2008 r2 via system dsn connections. don't use fetch because works larger reports fails smaller ones. on target sql server side, after each run result data each sql statement gets appended same table source id. way can query single table or of 10 sources' data. each day package runs, gets truncated , reloaded. on source side, data staged via backup/restore around 6 am; our jobs start around 8 am. ssis etl dumps data intake bucket, , actual final insert user-facing tables happens via stored procedure. to summarize, we have p

iteration - Unexpected behaviour while iterating directories in python -

i'm making inventory of files in big library. idea write paths in column, parent directory of file in other colum, , files in other column. i need write parent directory in corresponding cell each file , means writing folder's name many times there files inside it. this have far: import os import openpyxl def crearlista (*arg, **kw): inventario = openpyxl.workbook(encoding = "utf-8") sheet = inventario.active = 1 e = "" dirpath, subdirs, files in os.walk("//media//rayeus/datos/mis documentos/nueva carpeta/", topdown=false): name in subdirs: e = os.path.join (name) name in files: sheet.cell(row=i, column=3).value = name sheet.cell(row=i, column=1).value = dirpath sheet.cell(row=i, column=2).value = e = + 1 this works perfectly: iterates through every file in folder , writes name , dirpath in desired locations. problem starts iterating through

3d - How to load *.babylon exported from blender using JavaScript/FileApi/XHR? -

Image
i'm pretty fine working .babylon file format. exporter developed blender 3d editor works , if load exported model using next code: // won't write full code // because fetched playground , it's standard , works babylon.sceneloader.load("", "filename.babylon", engine, function (newscene) { ... works , webgl renderer in browser shows model. but, if don't want load models static files must saved in public folder of http-server ( iis, apache, lighttpd, nginx, etc.. ) . for e.g. wanna load .babylon file user's side or secure access .babylon files @ backend. all right, let's watch situation, if provide kind of uploader (using file api browser) in web-application, user able load 3d-models pc or other devices. i'm trying load models way: file uploading ( change event of input-file ) works well: function handlefiles( event ) { var uploader = event.srcelement || event.currenttarget; var files = uploader.

javascript - Deferred chain crashing browser -

this small function should able open , close box. opening , closing needs take account css transitions, figured can use $.deferred . here's relevant code: function test(){ // these assigned deferred objects during transitions this.opening = this.closing = false; this.isopen = false; this.x = $('<div />').appendto('body'); this.x.width(); } test.prototype.open = function(){ // box opening: return opening deferred if(this.opening) return this.opening; // box closing: chain // supposed wait box close, // open again if(this.closing) return this.closing.then((function(){ return this.open(); }).bind(this)); // box open, resolve if(this.isopen) return $.when(); console.log('opening'); this.opening = new $.deferred(); this.x.addclass('open'); settimeout((function(){ this.opening.resolve(); this.opening = false; this.isopen = true; }).bind(this), 1000);

javascript - Asynchronous call in if statement ends up executing else statement -

this question has answer here: how return response asynchronous call? 24 answers in specific case execute asynchronous call inside if block, how come else statement block gets executed if dosubmit evaluates true ? outcome of ends @ line after error_2 comment: $scope.save = function() { if (dosubmit) { var dto = { 'attributes': $scope.fields, 'requestorigin': $location.absurl() }; var req = { method: 'post', url: 'endpoint', data: dto }; $http(req).success(function(data, status) { // success $scope.completed(data); }).error(function(data, status) { // error_1 $scope.validationfailed(); }); } else { // error_2 $scope.validationfailed(); } } /

java - auto reload content of a postgreSQL table -

i using code: my code to output table. question how possible updating in page without reloading? thank you either use ajax requests or if feel good, try html5 websockets : add trigger table update / insert / delete , , keep clients up-to-date. ajax means you'll doing request client server every few seconds, check if have changed , if so, you'll download new data (usually devs use json), , update table using javascript data. with websockets , event starts server side : whenever db table updated, send request server clients tell them update table new data. you'll find plenty of examples on web, searching either ajax or websockets . if don't know are, i'd recommend go ajax , setting-up websockets server php might tricky.

c# - Binding Event to a Method of the ViewModel without ICommand -

the problem: bind event public method of viewmodel via xaml. the notorious solution create public icommand property on viewmodel returns relaycommand or delegatecommand , use eventtrigger , invokecommandaction windows.interactivity in xaml bind event command. similar alternative use mvvmlight's eventtocommand , provides possibility pass eventargs command's parameter. this solution has pitfall of being verbose, , hence makes code hard refactor , maintain. i use markupextension binding event public method of viewmodel directly . such possibility provided eventbindingextension this blog post . example usage in xaml: <button content="click me" click="{my:eventbinding onclick}" /> where viewmodel has following method: public void onclick(object sender, eventargs e) { messagebox.show("hello world!"); } i have few questions regarding approach: i have tested , works charm me since no expert ask if solution have

python - Adding list elements to WHERE clause -

i want add condition where clause: stmt = 'select account_id asmithe.data_hash percent < {};'.format(threshold) i have variable juris list. value of account_id , juris related in when account_id created, contains substring of juris . i want add query condition needs match of juris elements. add ...and account_id '{}%'".format(juris) doesn't work because juris list. how add elements of list where clause? use regex operator ~ : juris = ['2','7','8','3'] 'select * tbl id ~ \'^({})\''.format('|'.join(juris)) which leads query: select * tbl id ~ '^(2|7|8|3)' this brings rows id start with of 2,7,8 or 3. here fiddle it. if want id start 2783 use: select * tbl id ~ '^2783' and if id contains of 2,7,8 or 3 select * t id ~ '.*(2|7|8|3).*'

Google Analytics service Intent crashes on Android Oreo -

i have upgraded app support sdk 26 , google analytics causes crashes when running on android oreo: fatal exception: java.lang.runtimeexception: unable start receiver com.google.android.gms.analytics.analyticsreceiver: java.lang.illegalstateexception: not allowed start service intent { act=com.google.android.gms.analytics.analytics_dispatch cmp=com.example.android/com.google.android.gms.analytics.analyticsservice }: app in background uid uidrecord{3f302e5 u0a107 rcvr idle procs:1 seq(0,0,0)} @ android.app.activitythread.handlereceiver(activitythread.java:3259) @ android.app.activitythread.-wrap17(unknown source) @ android.app.activitythread$h.handlemessage(activitythread.java:1677) @ android.os.handler.dispatchmessage(handler.java:105) @ android.os.looper.loop(looper.java:164) @ android.app.activitythread.main(activitythread.java:6541) @ java.lang.reflect.method.invoke(method.java) @ com.android

jquery iterate through nested object -

i´m getting data php. parse json var d = $.parsejson(returndata); d.designer looks like: [object, object, object] 0: object _id: 1 family: null firstname: "xx" lastname: "yy" __proto__: object 1: object _id: 2 family: null firstname: "xx" lastname: "yy" __proto__: object 2: object _id: 5 family: null firstname: "xx" lastname: "yy" __proto__: object with jquery how can loop trough objects get: id: 1 id: 2 id: 5 where id value key _id ? you can use each return value , key every element $.each(d, function( index, value ) { console.log("id: "+index); });

powershell - get return from another power shell script -

i have ps script invoke-expression on other scripts on same computer. here code: $webmemory = "c:\memory_script\webmemory_script.ps1" $intmemory = "c:\memory_script\intmemory_script.ps1" $hungweb = "c:\scripts\hungweb_script.ps1" $hungint = "c:\scripts\hungint_script.ps1" $intmemoryresult = @() $webmemoryresult = @() $hungwebresult = @() $hungintresult = @() $date = get-date $shortdate = (get-date -format ddmmyyy.hhmm) $filepath = "c:\scripts\memory&hungresults\results" + $shortdate + ".txt" $break = "`r`n" out-file -filepath $filepath -inputobject $date -force -encoding ascii -width 50 out-file -filepath $filepath -append -inputobject $break -encoding ascii -width 50 $intmemoryresult += invoke-expression $intmemory $webmemoryresult += invoke-expression $webmemory $hungwebresult += invoke-expression $hungweb $hungintresult += invoke-expression $hungint write-host $webmemoryresult out-file -filepath

c# - Change UI-layout based on selected ComboBoxItem -

i have combobox this: <combobox> <comboboxitem>combobox item #1</comboboxitem> <comboboxitem>combobox item #2</comboboxitem> <comboboxitem>combobox item #3</comboboxitem> </combobox> and below have grid, rest of ui is. , wanted ask best way display other ui each of items. like "item #1" i'd have radio button , text field , "item #2" id display data in textblock, ... (note: combobox should stay @ same position switch) i'm not quiet sure how implement right mvvm-model , didn't find useful problem in internet far. i got work due of highcores comment. looked @ link tabcontrol , transfered combobox. so xaml looks this: <combobox name="routeoptions" itemssource="{binding}" displaymemberpath="displayname"/> <contentpresenter content="{binding selecteditem, elementname=ro

c# - Multi-Keys Hash or Dictionary, a list of values as output -

i new c# , need have general list multiple keys. i have 3 parameter creates key of data. each record (each 3 key) have set of values. i need have generic list value of each node in list values of keys , value of each node pointing list contained related values key. following example of data , data structure looking for: key1 key2 key3 value1 value2 value3 0 0 0 b c 0 0 1 d e f 0 1 1 g h - <0,0,0, list(a,b,c)> ---> <0,0,1,list(d,e,f)>---> <0,1,1,list(g,h)>--->null i thinking of having hash table multiple keys , value pointing object link list. or creating dictionary these 3 keys , again returning pointer head of link list. i appreciate if can tell me how can in c#. first, should use dictionary<tkey, tvalue> , , not hashtable . non-generic collection types there backward compatibility. better use generic types new code. as specific problem, you

windows - Where do I save a .py file so that I can import it from python interpreter ( from powershell ) -

i have python file wrote myself, has several functions in it. trying import python interpreter within powershell (windows 7). learning exercise. isn't importing, it's throwing error module not exist. question need save .py file to? there specific place python looks modules imported? i'm using python2.7.10. this isn't module standard library or third party i've downloaded. python file importing can call functions it... it's answered now, calling python withion wrong directory. have call python same directory file saved in. thank guys. save module.py file /documents . navigate /documents in powershell , start python command line typing python , pressing enter. can import file command import module

ruby - RSpec less strict equality expectation for test -

i have following test: it "can add item" item = item.new("car", 10000.00) expect(@manager.add_item("car", 10000.00)).to eq(item) end item's initialize looks (class has attr_accessor for, type, price, , is_sold): def initialize(type, price) @type = type @price = price @is_sold = false @@items << self end manager's add item looks like: def add_item(type, price) item.new(type, price) end this test failing because 2 items have different object ids, although attributes identical. item's initialize method takes type, , price. want check equality on features... there way test strictly attribute equality? i have tried should be, should eq, be, , eql? no luck. assuming class has public interface reading attributes (e.g. attr_reader :type, :price ), sensible way implement == method: class item # ... def ==(other) self.type == other.type && self.price == other.

Relate requests sent from user in HTTP APIs -

i wanted make app send photos on instagram via old api (which requests sent https://i.instagram.com/api/v1 ) , strange me. i saw examples of logging in , sending photos on web. (i) authorized account (with username , password), (ii) uploaded photo on instagram , (iii) posted account. the thing relatable between part , iii user id (gotten log-in section , given configure post), can user id without authorizing account. thought there must more user id relates these 2 requests. can't figure out is. the question is: way these apis use make contact between requests sent user (without access token)? or how figure out user logged-in me?

mysql - What is the best way to share data between a web app and a iOS app? -

not looking many details here, i'm wondering how code ios app accesses/modifies same data used in web app. can done using coredata? can done mysql db? can done using mongodb? do have links go learn more this?

android - How can I receive pending messages using google nearby API? -

i able send message 1 user using google nearby api. however, according guidelines having device in subscribe/publish state uses 2.5-3.5 times more battery usual. therefore recommend subscribe/publish once activity enters foreground. means, unless 2 devices have app on screen @ same time, not able send/receive messages 1 another. user enter foreground, send message, , when user b enters foreground, them see message. the ideal scenario perform firechat ( https://play.google.com/store/apps/details?id=com.opengarden.firechat&hl=en ). send/receive messages real time. leaving subscribing/publishing in background time regardless of battery consumption? i add ultimate goal able make frictionless (no pairing necessary) chat between people nearby 1 (capable of reaching 30m distance). if there better way in general interesting hear. i user enter foreground, send message, , when user b enters foreground, them see message. that's how works. each message has ttl (time li

numpy - Error in backpropagation python neural net -

Image
darn thing won't learn. weights seem become nan. i haven't played different numbers of hidden layers/inputs/outputs bug appears consistent across different sizes of hidden layer. from __future__ import division import numpy import matplotlib import random class net: def __init__(self, *sizes): sizes = list(sizes) sizes[0] += 1 self.sizes = sizes self.weights = [numpy.random.uniform(-1, 1, (sizes[i+1],sizes[i])) in range(len(sizes)-1)] @staticmethod def activate(x): return 1/(1+numpy.exp(-x)) def y(self, x_): x = numpy.concatenate(([1], numpy.atleast_1d(x_.copy()))) o = [x] #o[i] (activated) output of hidden layer i, "hidden layer 0" inputs weight in self.weights[:-1]: x = weight.dot(x) x = net.activate(x) o.append(x) o.append(self.weights[-1].dot(x)) return o def __call__(self, x): return self.y(x)[-1]

javascript - JQuery .text() method outputting garbled text -

Image
so i've been having strange issue jquery's .text() method. have right js code generates random phrase few banks of random words, believe has no problem (it produces string). when click link in browser, link's text replaced random phrase produced random phrase generator. far, there nothing wrong generated random phrase. however, tends garble text behind it: it seems browser having difficulty when pushing text next line, causing overlap text there. when highlight paragraph, "resets" correctly , it's fine until try clicking link again. if zoom in or out, seems it's fine until return 100% zoom. if make text font size smaller, seems work fine too. here javascript code: //initially random phrase , display on page getrandomphrase(); $('#phrase').text(finalphrase.new); //on click, random phrase , display on page $('#phrase').click(function () { getrandomphrase(); $('#phrase').text(finalphrase.new); }); here html tag

Tricking numpy/python into representing very large and very small numbers -

i need compute integral of following function within ranges start low -150 : import numpy np scipy.special import ndtr def my_func(x): return np.exp(x ** 2) * 2 * ndtr(x * np.sqrt(2)) the problem part of function np.exp(x ** 2) tends toward infinity -- inf values of x less approximately -26 . and part of function 2 * ndtr(x * np.sqrt(2)) which equivalent to from scipy.special import erf 1 + erf(x) tends toward 0. so, very, large number times very, small number should give me reasonably sized number -- but, instead of that, python giving me nan . what can circumvent problem? there such function: erfcx . think erfcx(-x) should give integrand want (note 1+erf(x)=erfc(-x) ).

Issue with logic and Loop in Java -

i started coding small program in java. wanted exercise try-catch block, did not come part , got stuck on loop part. know basic loop issue, guess caught myself in simple logical problem. need program if user press 1, jump switch statement , execute proper case. if user press 1 or 2, go menuloop function , execute again until pressed correct number (1 or 2). used while loop control. here code. import java.util.scanner; public class trycatchexercise { public static void menuloop() { scanner input = new scanner(system.in); int choice; system.out.println("1. check number 1"); system.out.println("2. check number 2"); system.out.print("please enter choice... "); choice = input.nextint(); while (choice != 1 || choice != 2) { system.out.println("invalid entry, press 1 or 2"); menuloop(); } //isn't logical @ point loop skipped , // go switch if user pressed 1 or 2.?? sw

http - How can I stream a large Azure blob as chunks to clients using web API? -

i have users need able download large zip files using web api endpoints. of these files can on 1gb in size. files stored blobs in azure. loading entire stream not work, multiple users, run out of memory. need somehow send in chunks. can explain/show me how work using web api? i'm not sure how write this. or perhaps other better suggestions on how go achieving objective in scalable fashion? here endpoint have: public async task<ihttpactionresult> getfile(int fileid) { // todo: somehow stream chunks azure through client's browser... } a web browser used initiate request web api. include anchor tag on html page user can click download file: <a href='localhost/file?fileid=3'>click here download</a> you should directly stream blobs via azure storage client library. make webapi call sas uri blob want download , include uri in anchor tab. if uri constructed properly, download start user clicks link. don't have worry memory issu

oauth - Building an API, keeping client access token safe -

i'm building api consumed ios application. consuming applications issued access token. the access token used make ssl requests our api, , these requests originate ios device. using charles however, running client's application on phone can de-encrypt outgoing requests , see access token is. what i'm having hard time wrapping head around is, how possible keep access token safe, using ssl? couldn't obtain access code, incorporate in own application, , begin sending requests access token if original client? what missing here?

jsf - How to reference CSS / JS / image resource in Facelets template? -

i've done tutorial facelets templating . now i've tried create page isn't in same directory template. i've got problems page style, because of styles referenced relative path so: <link rel="stylesheet" href="style_resource_path.css" /> i can use absolute referencing starting / : <link rel="stylesheet" href="/project_root_path/style_resource_path.css" /> but bring me troubles when i'll moving application different context. so i'm wondering best way reference css (and js , image) resources in facelets? introduction the proper jsf 2.x way using <h:outputstylesheet> , <h:outputscript> , <h:graphicimage> name referring path relative webapp's /resources folder. way don't need worry context path in jsf 1.x. see how include css relative context path in jsf 1.x? folder structure drop css/js/image files in /resources folder of public webcontent below (just cre

javascript - Pass data to transcluded element -

i want create directive organizes displays data grouped date. want able specify directive display individual rows. in perfect world (but nice , pretty) friday, oct 28 [some directive html] [some directive html] [some directive html] saturday, oct 29 [some directive html] sunday, oct 30 [some directive html] [some directive html] ... this doesn't work, if have better approach please tell me, hoping able along these lines: app.directive('dateorganized', [function(){ return { template: '<div>' + '<div ng-repeat="organizeddate in organizeddate">' + '<div>{{organizeddate.date | date}}</div>' + '<div ng-repeat="item in organizeddate.items">' + '{{rowdirectivehtml}}' + '</div>' + '</div>' +

ios - How to install SDWebImage -

Image
i need manage photos in app , have read sdwebimage framework seems best way go. finding incredibly difficult install. dont know ruby , have never used podfile, installing downloading latest sdwebimagefolder & framework , adding them project. when try import viewcontroller using suggested imports: #import <sdwebimage/uiimageview+webcache.h> #import "uiimageview+webcache.h" i file not found on #import if change "sdwebimage/uiimageview+webcache.h" suggested file not found on the: #import uiimageview+webcache.h though can see when open sdwebimage folder in project! i'm guessing these errors lead not found error when try use sd_setimagewithurl method. here's screen shot of project: i hope can framework looks have functionality. appreciated. thanks when add sdwebimage folder in project select following option. add copy of folder destination project , create groups. and have write like #import "uiimageview+webcache.h&qu

javascript - Is there another way to disable cache when fetching script? -

i use fetch script; $.getscript("http://www.example.org/"); however, dont want cached. means if use getscript again, script should fetch again. this 1 works in theory; $.getscript("http://www.example.org/?" + math.random()); but in practically, it's not. because "?" disabled on remote site url, question is, there otherway tell browser not cache ? recreate function needs: (function () { $.getscript = function(url, callback) { $.ajax({ type: "get", url: url, success: callback, datatype: "script", cache: false }); }; })(); now won't cache anymore when call function like $.getscript('script.js', function() { // non cached script.js });

ruby on rails - Doorkeeper refresh token and concurrency -

in current implementation of doorkeeper, when access_token refreshed doorkeeper sends new refresh_token.this valid implementation becomes problematic when there concurrent apis calls client side (ios, android) calling refresh access token @ same time. means there @ least 1 thread ending expired tokens cant refresh. anyone has solution race condition? we've solved before (not doorkeeper) couple of different ways. request queue : on our mobile apps we've implemented request queue, , before request made check if token needs refreshed pause queue, refresh token, unpause again. no changes server required in case this has tradeoffs (you need sync request threads etc), pretty reliable @ stopping refresh contention without needing modify server. refresh jitter , jwt : since using jwt (where access_token expiry written token , not revoked @ server end), can add random number of "jitter seconds" refresh expiry each time check. decreases likelihood of 2

INVALID_RESPONSE_ERROR from google.payments.inapp.getSkuDetails -

i trying google browser extension in-app purchase working, keep getting error. i have connected google wallet merchant account chrome web store developer dashboard. in edit page of extension in dashboard, have added items "in-app products" tab (and made sure active). i have included buy.js js file in app/ext package. but when try list of items within extension calling getskudetails method, invalid_response_error here code i'm running: google.payments.inapp.getskudetails( { 'parameters': {'env':'prod'}, 'success': function(response) { console.log('success', response); }, 'failure': function(response) { console.log('failure', response); } }); as can see, have included necessary parameters according https://developer.chrome.com/webstore/payments-iap furthermore, when try sample extension provided google, same error. https://github.com/googlechrome/chrome-ap

php - Magento Product Attribute "Manage Label / Options" content not showing -

Image
i have been given task of upgrading old store's magento ver. 1.7.0.2 magento ver. 1.9.2.0. had quite few issues seems normal when comes magento upgrades, got sorted after nights work. there seems minor issue on backend if navigate following... > admin > catalog > attributes > manage attributes > [any custom attribute] > edit product attribute the "manage label / options" tab displays nothing if click it. can see mean in screenshot provided. i still have old system backed (magento ver. 1.7.0.2) , displays following on same page i have tried searching similar issue, without results. have tried looking phtml files, not find errors there. nor there errors ini_set('display_errors', 1); on. tried deleting cache , reindexing without luck. hope can me issue, , in advance! if there additional information required, i'll happy provide it. i solved problem! missing following folder, got old system: adminhtml/default/defa

Extract a .ff files (fast files) to view .gsc files inside using C# -

i want extract .ff files ( fast files ) view .gsc files inside using c# . can't find help. in advance. you should able extract 7z. here's library helps extract 7z compatible archives: https://sevenzipsharp.codeplex.com/

javascript - attachEvent not working in chrome browser for focusout event -

i have below code working fine in ie 9 when going through chrome getting error 'element has no method"attachevent"' . tried using.on addeventlistener() still unable through. element used here sharepoint people picker field. referring jquery 2.1. please advice if missing anything? code: var element = getpeoplepickerrelcontrol("user", "div[title='people picker']"); if (element != null) { $(element).focusin(function () { _cardholderinfo = getuserdetails(element.innerhtml); }); // if(element.attachevent) element.attachevent("onfocusout", manipulateleaderprofile); attachevent specific ie only. if want attch event in chrome should use addeventlistener method. attach events shown below if(navigator.useragent.tolowercase().indexof('msie') != -1){ element.attachevent("focusout", manipulateleaderprofile); } else{ element.addeventlistener("focu

android-ImageView in listview not showing image when scroll up and down -

i'm getting images internet via universalimagedownloader , i'm using viewholder showing them : public class listadapter2 extends baseadapter { activity activity; public arraylist<hashmap<string, string>> list; public listadapter2(activity activity, arraylist<hashmap<string, string>> list) { super(); this.activity = getactivity(); this.list = list; } public hashmap<string, string> geting(int position) { return list.get(position); } public void addall(arraylist<hashmap<string, string>> result) { if (this.list == null) { this.list = result; } else { this.list.addall(result); } notifydatasetchanged(); } public int getcount() { return list.size(); } public object getitem(int position) { return list.get(position); } public long getitemid(int arg0) { return 0; }

php - Codeigniter on duplicate key update with auto increment in MySQL -

how insert on duplicate key update in mysql primary key auto increment number ? unique key cannot specified new record.. odku works not primary keys, works on unique keys. u should define 1 unique key catch duplicates. alter table `table` add unique ( `field1` /* ... ,`fieldn` */ );

Get 1 minute interval from start and end field on SQL Server -

i have table information process happens @ different intervals of time. i need information table , data (for instance, tons) every 1 minutes. this data on table, indicated beggining , end of each process, , need information , make graph every 1 minutes. starttime endtime status 0 1209 4 1209 1215 2 1215 1900 4 1900 3611 4 3611 5934 2 5934 6382 4 6382 13965 2 13965 15823 4 15823 22103 2 what want this: time status 00:01:00 4 00:02:00 4 00:03:00 2 (just example) how can turn time given between 2 fields single interval? (the time in seconds on table, , need minutes)

c# - Inject different implementations of an Interface to a command at runtime -

i have interface in project 2 classes implement it: public interface iservice { int dowork(); } public class service1:iservice { public int dowork() { return 1; } } public class service2:iservice { public int dowork() { return 2; } } i have command handler depends on iservice too: public commandhandler1:icommandhandler<commandparameter1> { iservice _service; public commandhandler1(iservice service) { _service = service } public void handle() { //do _service.dowork(); //do else } } public interface icommandhandler<tcommandparameter> tcommandparameter :icommandparameter { void handle(tcommandparameter parameter); } public interface icommandparameter { } i want inject service1 or service2 commandhandler1 based on user selection. suppose have enum , user select value it: public enum services { service_o

windows installer - How to Check the Developer Office tools for Visual Studio 2015 is installed in the machine, using launch condition -

i have installer our product requires "developer office tools visual studio 2015" installed in machine. how can add launch condition installer check whether "developer office tools visual studio 2015" installed or not in machine. thanks in advance suggestions. regards, devaraj

winapi - C# about sending simulated keyboard events to another APP -

private void button3_click(object sender, eventargs e) { setforegroundwindow(wndhandle); sendkeys.sendwait("123"); } i use win32 api ,use sendkey achieve target,but using sendkey has disadvantage "i have setforegroundwindow() before use sendkey",it doesn't match wish. i want click button in gui c# created, , simulate keyboard event app, , important of all, wish don't have set window of app ground window. does have idea how it? appreciate much. does target application must active?

node.js - Skipper gridfs validating and express response issue -

i upload images mongodb skipper-gridfs module in express.js application. uploading codes follows upload: function (req, res) { req.file('avatar') .upload({ adapter: require('skipper-gridfs'), uri: 'mongodb://localhost:27017/test.images' }, function (err, uploadedfiles) { if (err) return res.negotiate(err); else return res.ok({ files: uploadedfiles, }); }); } following response this... { "files": [ { "fd": "2d8910a0-8ca2-4df1-9930-6ddd721a0416.jpg", "size": 172883, "type": "image/jpeg", "filename": "photo on 12-20-14 @ 9.53 pm.jpg",

android - How to get history of Chrome's incognito mode? -

i getting history of chrome browser using content://com.android.chrome.browser/bookmarks. working fine.but now, need browsing urls of incognito mode. how can urls or history of incognito mode. you cannot. according official pages: if don’t want google chrome save record of visit , download, can browse web in incognito mode. https://support.google.com/chrome/answer/95464?hl=en this means chrome not save history of user in incognito mode.

php - Looping through a recordset twice -

i'm developping moodle 2.9.1 pluggin , need loop through small recordset twice on same page. i'm using $rs = $db->get_recordset_sql($sql, array()); to data mysql. i need function mysql data_seek(0) work on recordset again cannot find related in moodle api or forums. if know data not going excessively huge, can use get_records_sql() instead. return array, indexed first field in select. can want array (loop through multiple times, split, pop, shift, etc).

php - Ajax not posting all data objects -

i send data ajax posting not posting data. posting 185 json objects, posting 142 objects out of 185. code is $.post( "<?= $this->webroot ?>st/getall", ( data ),function( htmldata ) { alert('rgrgr'); console.log(htmldata); $("#submit").prop('disabled', true); $("#blank").remove(); $("#tb tr:first").after(htmldata); },'html');

javascript - Fetch records from table -

i working on chat app. stored msg db, not fetch , show admin msg send in reply person after person 1 send msg admin. $email = $_get["q"]; if($email== "admin@gmail.com") { $sql = "select *, date_format(chatdate,'%d-%m-%y %r') cdt chat order username , id"; $sql = "select * (" . $sql . ") ch order id"; $result = mysql_query($sql) or die('query failed: ' . mysql_error()); // update row information $msg="<table border='0' style='font-size: 10pt; color: blue; font-family: verdana, arial;'>"; while ($line = mysql_fetch_array($result, mysql_assoc)) { $msg = $msg . "<tr><td>" . $line["cdt"] . "&nbsp;</td>" . "<td>" . $line["username"] . ":&nbsp;</td>" . "<td>" . $line["msg"] . &

Unable to connect to Mysql Database hosted on VM Windows Server using 3306 port -

Image
i have been trying find solution not fixed problem. mysql database hosted on remote server inside virtual machine, have rights virtal machne, have tried following solutions still problem not fixed: added 3306 port mysql in firewall settings, disabled firewall, remove bind-address my.ini files on local machine server , grant priviliges mysql client tool no success. can me out problem please?

ios - Assertion failure in +[JSQMessagesAvatarImageFactory in ios8 -

Image
i work on chat application using jsqmessageviewcontroller third party framework (same whatsapp type). displaying list of chat members in tableview. when click 1 chat item needs navigate chat view controller. requirement. now, when click 1 chat member in list view following exception class jsqmessagesavatarimagefactory.m : “assertion failure in +[jsqmessagesavatarimagefactory jsq_circularimage:withdiameter:highlightedcolor:], /users/pods/jsqmessagesviewcontroller/jsqmessagesviewcontroller/factories/jsqmessagesavatarimagefactory.m:148” , “terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid parameter not satisfying: image != nil'” i using code of project: https://github.com/jessesquires/jsqmessagesviewcontroller using framework through cocoa pods. you forgot include avatar images in project (under images.xcassets), shown below:

c# - SQL Server : stored procedure to have optional parameter -

how specify default parameters stored procedures? i have seen following 2 options. option 1: create procedure myprocedure(@dataone int, @datatwo int = default) option 2: create procedure myprocedure(@dataone int, @datatwo int = 3) i have used stored procedure 1 single parameter in places of c# code. want use 1 optional parameter. want make sure optional parameter have default value too. any please? have gone wrong ? i used above 2 methods. did not work. did not default value. the default value of parameter used if not send parameter @ all. don't send parameter code behind if want use default value. use create procedure myprocedure(@dataone int,@datatwo int=3).. , don't send @datatwo code behind, 3 used default value. hope helped.

java - Using JPA cursor takes more time during data pulling and at the end OutOfMemory exception occured -

suppose have database (postgres) 12 million row. want data page size 30k using jpa cursor. during first request consume more time. here query hints: query.sethint(queryhints.cursor, true) .sethint(queryhints.scrollable_cursor, true) .sethint("eclipselink.read-only", "true") .sethint(queryhints.cursor_initial_size, 30000) .sethint(queryhints.cursor_page_size, 30000); now when calling using cursor = (cursoredstream) query.getsingleresult(); list = cursor.next(math.min((rangecount - o), pagesize)); it consumes 236 sec executing first line (executing query). my persistent.xml configuration cursor given below, <property name="eclipselink.persistence-context.close-on-commit" value="true" /> <property name="eclipselink.persistence-context.flush-mode" value="commit" /> <property name="eclipselink.jdbc.cache-statements" value="true&q