Posts

Showing posts from September, 2013

wpf - Problems with Column content and GridSplitter -

how can set width of content of 1st 3rd or 5th columns, , still have splitters work properly? <window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:infinity.shell.controls.text;assembly=infinity.shell" xmlns:dock="clr-namespace:infinity.shell.controls.docking;assembly=infinity.shell" xmlns:syncfusion="http://schemas.syncfusion.com/wpf" x:class="infinity.mainwindow" mc:ignorable="d" title="mainwindow" height="350" width="499.573" background="#ff1e1e1e"> <grid> <grid.columndefinitions> <columndefinition width="*"/> <columndefinition

I have to create windows application which open source database can i use? -

i have create windows application in c# which open source database can use . single user application on desktop or laptop. database needs installed on client machine only. in project used sql lite great success. have install c# adapter , i've included article through it. here main website: https://www.sqlite.org/ link use sql lite project. http://blog.tigrangasparian.com/2012/02/09/getting-started-with-sqlite-in-c-part-one/

java - Android Auto text reply to phone call not working -

i have created app initiates broadcast receiver class should auto respond phone calls text message. receiver working following exception: java.lang.illegalargumentexception: invalid destinationaddress please help!!! main activity: package com.biapps.makin_biscuits; import android.content.broadcastreceiver; import android.content.context; import android.content.contextwrapper; import android.media.audiomanager; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.content.intent; import android.telephony.phonestatelistener; import android.telephony.telephonymanager; import android.view.view; import android.widget.imagebutton; import android.util.log; import android.widget.textview; import android.widget.toast; import com.biapps.contact; import com.biapps.databasehandler; import java.util.list; public class mainactivity extends appcompatactivity { //set object labels , states here private imagebutton icon; private audiom

java - Solr return only parent document on child query match -

i have set of documents indexed has pseudo parent-child relationship. each child document had reference parent document. due availability complexity, these documents not being indexed support block-join, i.e. instead of nested structure, flat. here's example: <doc> <field name="id">1</field> <field name="title">parent title</field> <field name="doc_id">123</field> </doc> <doc> <field name="id">2</field> <field name="title">child title1</field> <field name="parent_doc_id">123</field> </doc> <doc> <field name="id">3</field> <field name="title">child title2</field> <field name="parent_doc_id">123</field> </doc> <doc> <field name="id">4</field> <field name="title">misc title2</fiel

Read Text file and display results in separate Labels C# Visual Studios -

i'm looking read .txt file folder exe in , display parts of text file in multiple corresponding labels or richtextbox's in form. dummy example: text box contents: "b1.txt" questiontitle="why did chicken cross road"; answertitle[0]="it didn't"; answertitle[1]="who"; in form i'd when hit search display following: label 1 - question: why did chicken cross road label 2 - answer 1: didn't label 3 - answer 2: cares i've seen people use streamreader , others use file.openread. i'm not sure best method ready text text file , displaying specific text file specific label or richtextbox. any great!! to split on string need use overload takes array of strings: string[] lines = thetext.split(new string[] { environment.newline }, stringsplitoptions.none); if want handle different types of line breaks in text, can use ability match more 1 string. correctly split on either type of line break, , pr

c - Caesar Cipher shifting characters -

i had received assignment last month , ended getting wrong because of problem state after this. currently, doing caesar's cipher , believe have right format. ask user string , encrypted key == 3 . however, want loop around alphabet if plaintext letter x , y , z , x , y , or z . but, when put of characters in, not a , b , , c , ]... , other braces. hints fix problem. thank you! void main() { int key = 3; char string[256]; int = 0; printf("enter string want encrypted\n"); fgets(string, sizeof(string), stdin); (i = 0; < strlen(string); i++) { if (string[i] == ' ') {;} else if ((string[i] >= 'a' && string[i] <= 'z' || string[i] >= 'a' && string[i] <= 'z')){ string[i] = string[i] + key; } } printf("cipher text:%s",string); } you need @ ascii table: http://www.asciitable.com/ . you're using ascii e

ActionDispatch::Cookies::CookieOverflow Ruby On Rails Application -

i can not save user data there problem size of cookies (4kb) i centos server, nginx, passenger actionpack (3.2.22) lib/action_dispatch/middleware/cookies.rb:305:in `[]=' actionpack (3.2.22) lib/action_dispatch/middleware/session/cookie_store.rb:64:in `set_cookie' rack (1.4.7) lib/rack/session/abstract/id.rb:335:in `commit_session' rack (1.4.7) lib/rack/session/abstract/id.rb:211:in `context' rack (1.4.7) lib/rack/session/abstract/id.rb:205:in `call' actionpack (3.2.22) lib/action_dispatch/middleware/cookies.rb:341:in `call' actionpack (3.2.22) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' activesupport (3.2.22) lib/active_support/callbacks.rb:405:in `_run__4594969678639542870__call__4298955712328050144__callbacks' activesupport (3.2.22) lib/active_support/callbacks.rb:405:in `__run_callback' activesupport (3.2.22) lib/active_support/callbacks.rb:385:in `_run_call_callbacks' activesupport (3.2.22) lib/active_support/cal

regex - building a large xts object out of a list of files with rbind.xts and a user defined function -

i trying create 1 large xts data set out of list of files. able accomplish being explicit shown below, read.cqg user defined function using read.zoo , as.xts read/convert data xts object. each read.cqg call returns xts object. the code below works , returns large xts object. large_xts_object <- rbind.xts(read.cqg("somefile01.txt"), read.cqg("somefile02.txt"), read.cqg("somefile03.txt"), read.cqg("somefile04.txt"), read.cqg("somefile05.txt"), read.cqg("somefile06.txt"), read.cqg("somefile07.txt")) i use regular expressions , lapply avoid having explicitly write file name. me understand using lapply , shorten code. this attempt, doesn't give me results want. large_xts_obj <- rbind.xts(lapply(list.files(pattern=&q

node.js - Shimming jQuery nodes for browserify -

i have file requires module installed npm: -- login.js -- require('jquery-form'); the module relies on jquery variable existing in window scope i'm browserifying this, understand need shim it. i've installed browserify-shim , using (from package.json): "browserify-shim": { "./node_modules/jquery/dist/jquery.js": "jquery" }, however, when jquery-form runs, jquery not defined. missing? you need "shim" jquery dependency of jquery-form . if these installed via npm there no need browser directive. because jquery-form doesn't have main directive in package.json need add browser directive show browserify file include in bundle. "browserify-shim": { "jquery-form": { "depends": ["jquery"] }, "browserify": { "transform": [ "browserify-shim" ] }, "browser": { "jquery-form": "./node_modules/jquery-

java - how to stop progressbar spining after connection has been lost in android -

when pressed button on mobile phone after switch off wifi or mobile data network. progress bar spinning not stop , button not work. protected void onrefreshingstatechanged(boolean refreshing) { super.onrefreshingstatechanged(refreshing); if (!refreshing){ if (mprogressdialog != null && isbackpressed){ mprogressdialog.hide(); mprogressdialog = null; this.setresult(result_ok, getintent()); finish(); } }else{ if (mprogressdialog == null && isbackpressed){ mprogressdialog = progressdialog.show(this, "fetching data", "please wait while updating records ...", true); } } } any appreciated. try set cancelable property of progressbar. mprogressdialog = new progressdialog(this); mprogressdialog.setcancelable(true);

jquery - how to call parent div tag but no id and class? -

i have img common class <div debug-id="slide-0" style="width: 800px; height: 356px; top: 0px; left: -800px; position: absolute; overflow: hidden;"> <img class="commonclass" u="image" id="imgid_1" src="upload/img_1.jpg" border="0" style="width: 800px; height: 356px; top: 0px; left: 0px; position: absolute;"></div> img class name same div debug-id different how call parent div of style left <div debug-id="slide-1" style="width: 800px; height: 356px; top: 0px; left: 0px; position: absolute; overflow: hidden;"> <img class="commonclass" u="image" id="imgid_2" src="upload/img_2.jpg" border="0" style="width: 800px; height: 356px; top: 0px; left: 0px; position: absolute;"></div> and more <div debug-id="slide-2" style="width: 800px; height: 356px; top: 0px; left: 0px; p

Rails 4 params validation -

user create post , assign 1 of collections (post belongs_to collection) i have working dropdown read collection_id current user, however, i'd avoid user(attacker) pass wrong parameters collection_id belongs incorrect user. i tested using text_field , assign collection_id incorrect user , post saved, want prevent. how can that? 1) within business layer. (i guess inside model validation) 2) within db layer (some db constrains) 3) preferable both note: need pre-fill form variables previous step, user can change or fill in case empty post_controller.rb: @post = current_user.posts.build(url: @url, content: @title) def post_params params.require(:post).permit(:content, :url, :collection_id) end models: collection.rb: belongs_to :user has_many :posts user.rb: has_many :posts has_many :collections post.rb: belongs_to :user belongs_to :collection routes: post 'post' => 'posts#create' form: <%= form_for(@post, html: { multi

ibm mobilefirst - How to restrict user to login from single client at a time in worklight 6.1 ? -

for example, if user installed app in more 1 devices, , tries login devices @ same time want restrict him not login other devices until going logout first device. 1 active login @ time. how achieve above ibm worklight 6.1 ? api available same client or adapter side ? please let me know. there not built-in feature per-se in worklight give want. what explore world of custom authenticators , login modules . need create custom properties stored in database, allowing identify if user "logged-in", in case perhaps either show message user, or have him force-logout. either way, should not stick worklight 6.1 - extremely old version.

sql - Selected non-aggregate values must be part of the associated group -

i have 2 tables in teradata: table_a , table_b. between them left join. afterwards making select statement contains attributes both tables: select attribute_1 attribute_2 ... attribute_n afterwords, using sum functions calculations. these functions this: sum ( case when attribute_1 > 2 attribute_2*1.2 else 0 end (in example attributes in select part used). but use in case part attributes not in select statement - liek this: sum ( case when attribute_x > 2 attribute_y*1.2 else 0 end of course @ end doing group 1,2,...,n the error getting "selected non-aggregate values must part of associated group." furtheremore, have checked billion times number of selected attributes in select part, , n. question - why getting error? because using in sum part i.e. case part attributes (attribute_x , attribute_y) not included in select part? blueprint of end-statement looks sthg. this: insert table_new select attribute_1, attribute_2, ... attribute_n, sum ( cas

php - Omeka: Get all items in Controller -

i'm writing omeka plugin , wants list of public items elements, in controller under plugin. i've tried get_items() function doesn't exists, looks function available views - not sure how. another try manually fetch records database, that's not standard way. so, question is, there predefined function/class or way items in controller? i'm not sure if there function items along of element texts, if want list of items, inside controller should able make call like: $items = $this->_helper->db->gettable('item')->findall(); the omeka docs warn against getting items @ once because memory intensive. so, alternatively, can loop through items. $items = $this->_helper->db->gettable('item'); $item = $items->findfirst(); while($item != null){ // $item = $items->findnext($item); } there "public" property on item tells if it's public. in order element texts item, think you'd have make qu

Integration of microsoft test manager with TFS for Bug management -

currently using tfs (web version) know product backlog item can added via 1-product backlog item 2-bug (we using bug keep track of customer/partner logged bugs) when ever post bug mtm visible in product backlog list (which don't want) is there alternates this? can create 1 more menu under backlogs tab? enter image description here you should create separate work item type, maybe "issue", represent externally reported issue. you can triage issues , break them down bugs , pbi's appear on backlog ordering. try , avoid bug task anti-pattern: https://nkdagility.com/avoid-bug-task-anti-pattern-tfs/ however can configure tfs treat bugs tasks, , never apear on board. go backlog , click lower cog configure this. you create custom "issue" work item type reported stuff , add shown on backlog. you need edit process template this.

swift - RxSwift unwrap optional handy function? -

currently have created function unwrapoptional safely unwrap optional input in stream. func unwrapoptional<t>(x: optional<t>) -> observable<t> { return x.map(observable.just) ?? observable.empty() } let aopt: string? = "aopt" _ = observable.of(aopt).flatmap(unwrapoptional).subscribenext { x in print(x)} let anil: string? = nil _ = observable.of(anil).flatmap(unwrapoptional).subscribenext { x in print(x)} let a: string = "a" _ = observable.of(a).flatmap(unwrapoptional).subscribenext { x in print(x)} // output aopt what want archive create handy function instead of using flatmap(unwrapoptional) , example observable.of(a).unwrapoptional() something tried do, never compiles... extension observabletype { func unwrapoptional<o : observableconvertibletype>() -> rxswift.observable<o.e> { return self.flatmap(unwrapoptional) } } you want unwrapopt

Save file in Visual Studio 2015 package -

i'm working on first visual studio extension. managed setup event listener when file saved , modify file using docdata on way: var docdata = new docdata(this, filename); var editoradaptersfactoryservice = (this.getservice(typeof(scomponentmodel)) icomponentmodel).getservice<ivseditoradaptersfactoryservice>(); var textbuffer = editoradaptersfactoryservice.getdatabuffer(docdata.buffer); textbuffer.replace(new span(0, textbuffer.currentsnapshot.length), content); the problem here after modify new file have save couldn't find examples how save file. inside documentsaved listener have envdte.document can call envdte.document.save() i'm trying save file, have full path of new file i'm trying save. though iterating on files in project looking specific file , there use available save() method in projectitem . tried using code in this answer didn't work. any guidance on great! with full path try projectitem dte.solution.findprojectitem("

YouTube dropped #t start time support in direct URL and embed videos? -

recently, 1 use #t=2m0s or #t=120 set start time direct links: http://www.youtube.com/watch?v=fk2buvrv-uc#t=2m30s as embed videos: <iframe width="420" height="315" \ src="http://www.youtube.com/embed/fk2buvrv-uc#t=2m30s" \ frameborder="0" allowfullscreen></iframe> now seems youtube dropped #t start time support , above doesn't work anymore. how can place reference videos particular start time? embed videos looks different parameter used - start=<number of seconds> (see this blog , documentation ). example: <iframe width="420" height="315" frameborder="0" allowfullscreen src="http://www.youtube.com/embed/nc9xq-tvyhi?start=110&end=119"></iframe> direct links for direct links, enough replace # & : http://www.youtube.com/watch?v=fk2buvrv-uc&t=2m30s

hidden input breaks the css style -

hello i've got style .portfolio-filters input[type=checkbox]:checked{background:#cb2127} and code <ul class="portfolio-filters list-unstyled"> <li> <div class="form-group"> <input id="custom-software" type="checkbox" name="" value="" checked=""> <label for="custom-software">custom software</label> </div> </li> the problem inside div form-group if add hidden input fields, breaks css. do have idea how can fix problem? how hide input? should use display:none if don't want maintain position

python - Converting Yes and No to 0 and 1 in R -

how convert categorical value (yes/no) numeric value (0/1) in data set of 20 variables , 3144 observations in r? in r can either do df1[] <- +(df1=="yes") or df1[] <- lapply(df1, function(x) as.integer(x=="yes")) note: if "yes" should 0 , "no" 1, replace df1=="no" , x=="no" in post.

string - c# return data from Asynchronous function -

i have 2 methods public void getemp() { httpwebrequest request = (httpwebrequest)httpwebrequest.create(new system.uri("http://sdw2629/empservice/employeeinfo.svc/employee")); request.method = "get"; request.contenttype = "application/json; charset=utf-8"; request.begingetresponse(new asynccallback(readwebrequestcallback), request); } and private void readwebrequestcallback(iasyncresult callbackresult) { httpwebrequest myrequest = (httpwebrequest)callbackresult.asyncstate; using (httpwebresponse myresponse = (httpwebresponse)myrequest.endgetresponse(callbackresult)) { using (streamreader httpwebstreamreader = new streamreader(myresponse.getresponsestream())) { string results = httpwebstreamreader.readtoend(); //execute ui stuff on ui thread. } } } here want return string "results" other method string data= obj1.getemp() how can achie

java - How to find what value this code returns without a computer? -

what value mystery(12345678) return? public string mystery(int n) { string soln = “”; while (n > 0) { soln = n % 10 + soln; n = n / 100; } return soln; } the answers are: a) “1357” b) “2468” c) “7531” d) “8642” e) causes run-time error. edit: know answer b) compiling not sure how works. you can see it's loop of adding one's digit of n first index of string, dividing n 100. eventually, 2468

dynamics crm 2011 - Property 'stageid' is of an unrecognized EdmPropertyKind. Entity new_test has duplicate navigation property names -

i using crm2016 i created test entity replicate issue i did not customization on it. created new record default fields , form. tried access webapi it http://localhost/crmdatabase/api/data/v8.0/new_test(bgcs0249-0a06-e611-941a-003002djlnc) it worked fine , brought record. deleted records , created business process flow it, 1 stage , 1 step i activated , added new test record , tried access webapi url , threw below error { "error":{ "code":"","message":"property 'stageid' of unrecognized edmpropertykind. entity new_test has duplicate navigation property names. property names (navigation , structural property) must unique in entity ","innererror":{ "message":"property 'stageid' of unrecognized edmpropertykind. entity new_test has duplicate navigation property names. property names (navigation , structural property) must unique in entity ","type&

Opening console app using C# code in win forms -

i trying open console application windows forms application. have used below code. code opening console application not displaying (showing black screen). able console output using standardoutput. process proc = new process(); proc.startinfo.createnowindow = false; proc.startinfo.useshellexecute = false; proc.startinfo.redirectstandardoutput = true; proc.startinfo.redirectstandarderror = true; proc.startinfo.redirectstandardinput = true; proc.startinfo.filename = @"c:\program filex86)\consoletool.exe"; proc.start(); streamwriter sw = proc.standardinput; sw.writeline("init"); txtoutput.text += proc.standardoutput.readtoend().replace("\n", "\r\n"); txtoutput.text += proc.standarderror.readtoend().replace("\n", "\r\n"); proc.waitforexit(); how display on console window opened using code? use allocconsole function open console window , use console.writeline or other console functions normally! example:

Hadoop MapReduce program issue -

i have string line=”hadoop open source frame work , hadoop framework handling big data”; i want perform below operations inside main method split line space , store in new string array count number of occurrence of word hadoop in given string replace ‘,’with space in given string create array list generic string , store spitted string inside it

rfc - Processing FMTP line above RTP line in a SIP SDP body? -

sdp rfc silent on sequence of codecs . question can send fmtp line above rtpmap? there no standard codec dependent. if software includes codec's, should pass these parameters codec interface or configure codec accordingly. each codec expects different parameters, there no high-level format should respected.the processing differs codec codec. sometime contains values can omitted, contains important parameters must used accordingly. the format this: a=fmtp payloadnumber parameters_separated_by_semicolon for example g.723 can have this: a=fmtp:4 bitrate=6.3;annexa=yes or g.729: a=fmtp:18 annexb=yes or speex: a=fmtp:105 mode=8;mode=any

xml - PdfHelper return Object reference not set to an instance on Umbraco 7.4 -

i have installed pdf creator on umbraco 7.4. if test using razor example template, can create pdf when using pdfhelper returns system.nullreferenceexception: object reference not set instance of object. line 3: @helper start() { line 4: <!-- start root --> line 5: @html.raw("<fo:root xmlns:fo=\"http://www.w3.org/1999/xsl/format\" xmlns:ibex=\"http://www.xmlpdf.com/2003/ibex/format\">") line 6: <!-- end root --> line 7: } i have created new template: <?xml version="1.0" encoding="utf-8" ?> @inherits umbraco.web.mvc.umbracotemplatepage @{ layout = null; //response.contenttype = "text/xsl"; //response.appendheader("x-pdf-render", "true"); // -- uncomment force browser download pdf. // response.appendheader("x-pdf-force-download","darren.pdf"); } @pdfhelper.start() @pdfhelper.metadata(@currentpage.name, "

c++ - Typedef redefinition with different types ('uint_least16_t' (aka 'unsigned short') vs 'char16_t') -

Image
my project contains swift 2.2, objective c , c++ xcode 7.3 i getting following errors in generated producmodulename-swift.h file typedef redefinition different types ('uint_least16_t' (aka 'unsigned short') vs 'char16_t') typedef redefinition different types ('uint_least32_t' (aka 'unsigned int') vs 'char32_t') at following section if !defined(swift_typedefs) # define swift_typedefs 1 # if defined(__has_include) && __has_include(<uchar.h>) # include <uchar.h> # elif !defined(__cplusplus) || __cplusplus < 201103l typedef uint_least16_t char16_t; typedef uint_least32_t char32_t; # endif i can bypass error changing c++ parms c++ 11 skip troublesome code. however know if there cleaner solution this. to clarify code above code xcode generates when compiling. have no control on code

c# - Error CS0122 'AuthenticationOptions' is inaccessible due to its protection level -

i following guide write own katana authentication middleware . now encountered problem when i'm writing authenticationoptions. "inaccessible due protection level" when inherent microsoft.owin.security.authenticationoptions. thing class protected, should not inaccessible? have tried clean , rebuild, still same error. must missing something? my class: using microsoft.owin; using microsoft.owin.security; using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace dummy { public class dummyauthenticationoptions : authenticationoptions { public dummyauthenticationoptions(string username, string userid) : base(constants.defaultauthenticationtype) { description.caption = constants.defaultauthenticationtype; callbackpath = new pathstring("/signin-dummy"); authenticationmode = authenticationmode.passive; usernam

CPU usage of PHP instances -

i have multiple php instances on bluemix account. api service collected cpu, memory , disk stats these php instances. when php instance busy, cpu usage on 200. value shown in dashboard of bluemix php instance. how possible? because php instance works on multiple cpus? if so, how can retrieve number of cpus of php instance? the cpu usage of application instance can range 0% (no cpu used) number of logical cpus on dea\host * 100% means if application dea 2 core cpu, cpu usage app may 0%~200%. i found useful link https://github.com/cloudfoundry/dea_ng/issues/93 discussed same question , seems can't retrieve number of cores.

Android see if application is disabled -

in our app have intent start skype. method looks this: public void startskype(view view) { if (!isskypeclientinstalled()) { openmarket(); return; } final intent intent = new intent(intent.action_view, uri.parse("skype:" + getstring(r.string.usr_name) + "?chat")); intent.setcomponent(new componentname("com.skype.raider", "com.skype.raider.main")); intent.setflags(intent.flag_activity_new_task); startactivity(intent); } it works fine in cases, day received crash caused android.content.activitynotfoundexception: unable find explicit activity class {com.skype.raider/com.skype.raider.main}; after trying reproduce while found happens if application set disabled in phone settings (not phones have setting). there way see if application not available or have wrap method in ugly try-catch block? you can check field enabled of applicationinfo : public boolean enabled when false, indicat

openscenegraph - How can I capture an Image for post processing in OSG -

i need capture image viewer , need post processing , display on it. right more interested in first part of it. capture image viewer. while going through osg came across screencapturehandler. not able image out of it. i still working done in case of have other way of how can done or example screencapturehandler can share. to capture rendered view image use custom osg::camera::drawcallback. to capture view @ point, set drawcallback on camera, force rendering, restore null callback. notice following code part of member function of custom viewer (that's not case): osgviewer::view::getcamera()->setfinaldrawcallback(new viewcapturecallback(img)); osgviewer::viewer::renderingtraversals(); osgviewer::view::getcamera()->setfinaldrawcallback(null); the viewcapturecallback uses image->readpixels() read backbuffer. glreadbuffer( gl_back ); osg::graphicscontext* gc = renderinfo.getstate()->getgraphicscontext(); // here should process backbuffer's siz

jquery - Javascript $ notation -

this question has answer here: can explain dollar sign in javascript? 7 answers please can explain javascript code does. $('#element_id').html(response.title); i need access value of element_id can't using document.getelementbyid. thanks this code calls function named $ , access method of returned object. it's jquery code due selector string. $('#element_id') : returns jquery object element given id. .html(response.title) : sets inner html of dom element response.title . the raw javascript this: document.getelementbyid("element_id").innerhtml = response.title;

jquery - difference between $('.mydiv').children().last() and $('.mydiv').last() -

is there difference between : $('.mydiv').children().last() and $('.mydiv').last()? which 1 better used when want last children inside div example? use $('.mydiv').children().last() as $('.mydiv').last() not provide children

How to download image file with unknown length on android -

i'm trying display file local network url http://192.168.1.118:1881/image.jpg and display immidiatelly in imageview. problem when open inputstream url , try decode bitmapfactory null bitmap. suppose because message input stream: libcore.net.http.unknownlengthhttpinputstream. that image supported , hosted server app can't modify. thanks much, i've tried hard , looked solutions, nothing works me download byte array , decode byte array: byte[] data = read(inputstreamfromconnection); if (data != null) { bitmap downloadedbitmap = bitmapfactory.decodebytearray(data, 0, data.length); } public static byte[] read(inputstream is) { bytearrayoutputstream baos = new bytearrayoutputstream(8192); try { // read buffer, read big chunk @ time. byte[] buf = new byte[2048]; int len; // read until -1 returned, i.e. stream ended. while ((len = is.read(buf)) != -1) { baos.write(buf, 0, len); } }

javascript - Draw a graph from a dynamic table using jquery, js and cal(x) -

i design selftracking frontend participants enter numbers frontend. whilst these written database want them instantly visualized. calculations use calx jquery plugin (which allows excel computing). have form fields like: <td><input name="name1" type="text" id="cc3" size="10" data-formula="($bb3/$aa3)*100"> data-formula presents box value. want visualize value (here in percent) bar (like progressbar described here http://jsfiddle.net/z6k3c/ ). the problem is, have started working js , jquery , cannot figure out how can parse value data-formula following code snippet bar changes dynamically entered numbers (not on click, on change) $(function() { var colors = []; $("#slider").slider({ max : 200, value: 10, slide: function(event, ui) { colors = (ui.value < 20) ? ['#f00','#000'] : ['#ff0','#000']; colors = (ui.value > 50 && ui.value

authentication - Laravel 5.2 Auth::login($user) not working -

i writing laravel 5.2 application. need manually login user using \auth::login($user) . doing in following way. if ($user = user::where('phone',session('phone'))->first()) { \auth::login($user); // \auth::loginusingid($user->id); // auth::attempt(['email' => $user->email, 'password' => 'password']); $data = \auth::user(); //returning correct results } i have tried options namely auth::login($user) , authh:loginusingid($user->id) , attempt method. these methods working fine $data variable storing object of correct user. problem when move other route '/home' user remain no more authenticated. what might wrong here? how correctly? since laravel 5.2, have attach routes need session the 'web' middleware . see app/http/kernel.php, 'web' middleware contains \illuminate\session\middleware\startsession.

selenium - protractor NoSuchElementError: no such element -

when try send keys in non-angular page protractor shows error "nosuchelementerror: no such element" nosuchelementerror: no such element (session info: chrome=47.0.2526.80) (driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=windows nt 6.1 sp1 x86_64) (warning: server did not provide stacktrace information) command duration or timeout: 24 milliseconds documentation on error, please visit: http://seleniumhq.org/exceptions/no_such_element.html build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' system info: host: 'sekhar-pc', ip: '192.168.1.3', os.name: 'windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_13' * element info: {using=id, value=ius-userids} session id: 352e36f285f80dee03eb5c88697ebc08 driver info: org.openqa.selenium.chrome.chromedriver capabilities [{platform=xp, acceptsslcerts=true, javascriptenab

Javascript POST data goes to GET PHP array -

i spent hours figuring why ajax script wasn't working. found out request variables sent post went $_get. why that? here final working code. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>groups</title> <link rel="stylesheet" href="main.css"> </head> <body> <?php include "navigation.php"; $conn=new mysqli('',databaseuser,databasepassword,database); $q="select * user_groups"; $r=$conn->query($q); if($r) { echo "<table><tr><th>name</th><th>delete topics</th><th>edit others' content</th><th>delete comments</th> <th>deactivate users</th><th>delete own topics</th></tr>"; $number=0; while($row=$r->fetch_array()) { $n=$row['groupname']; $dt=$row['candeletetopics']

java - TestNG - priority of @AfterMethod -

is possible call @aftermethod methods in specific order? have example code: public class prioritytest { @beforeclass(alwaysrun = true) public void setup() throws exception { system.out.println("beforeclass prioritytest.java"); } @test public void defaultpriority(){ system.out.println("default"); } @test (priority = 3) public void t1(){ system.out.println("t1"); } @test (priority = 2) public void t2(){ system.out.println("t2"); } @test (priority = 1) public void t3(){ system.out.println("t3"); } @test (priority = -1) public void t_1(){ system.out.println("t -1"); } @aftermethod public void after2(){ system.out.println("after2"); } @aftermethod public void after1(){ system.out.println("after1"); } } priority of @test works perfectly. want same @aftermethod, when write code @aftermethod (priority = 1) compilation error. when run without priority there alphabeticall

git - GitHub client: Pull Request Button is missing -

Image
i use github client bitbucket repository. work & sync correctly, pull request button not showing. in github repo works. i found simular issue - github mac: pull request button missing , use bitbucket , can't change repo marker "other". any proposal? github: other repo: answer official github support ( support@github.com ): in order create pull request repository must exist on github.com. and there button called 'view branch' beside update master button. if click this, 'view master' button should change 'compare'. if click button should see list of branches can choose merge!

javascript - callback to set postdata without having to reload grid? -

does (free-) jqgrid provide callback-function can set postdata before grid loaded? in case it's pseudo postdata since using jqgrid loadonce : true . using postdata apply filters grid. load data ajax call. i want load grid data @ once server - locally apply filters. when user changes filters (for example using toolbar-searching/filtering) gets applied local data. i have tried: beforeinitgrid : function() { $("#grid").jqgrid('setgridparam', { search: true, postdata : {"toolbar":[{"name":"customer","value":"difranco"}],"postdata":{"_search":"true","nd":"1461054190117","rows":"30","page":"1","sidx":"my_date","sord":"asc","totalrows":"10000","filters":"{\"groupop\":\"and\",\"rules\":[{\&quo

recursion - Conversion of recursive C function into ARM assembly? -

Image
for homework assignment, i've been given recursive c function count integer partitions need convert arm assembly. things know arm assembly: 1) r0 hold return value of call 2) r1 , r2 , , r3 argument registers the code follows: int count_partitions(int n, int m) { if (n == 0) return 1; else if(n < 0) return 0; else if (m == 0) return 0; else return count_partitions(n - m, m) + count_partitions(n, m - 1); } i believe have done first 3 if & else-if statements correctly. logic final else statement find count_partitions(n, m-1), store onto stack, find count_partitions(n-m, m) , , add previous return value got stack - code not seem work? i've attached attempted solution , have color coded different segments of c code , corresponding assembly code. let me know what's wrong? you can use after cmp command , jump function: beq label ; branch equal bne label ; branch not equal ble label ; branch less equal blt

java - How to get Button click from Fragments -

i got fragment need take buttonclick. problem click going mainactivity hosting fragments , not fragment itself. have tried loging , nothing shows in logs when click button. i show u entire oncreateview. @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.server_settings, container, false); final button loginbutton = (button) view.findviewbyid(r.id.addserversettingsbtn); loginbutton.setonclicklistener(new onclicklistener() { @override public void onclick(final view v) { //were magic won't happen. } }); return inflater.inflate(r.layout.server_settings, container,false); } your problem (i believe) you're returning instance of inflated view doesn't have onclick handler assigned. try this: @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view

Dart CheckboxInputElement doesn't show text -

dart checkboxinputelement adds specified text between opening , ending input tags , browser ignores text. example, following dart code: formelement form = new formelement(); checkboxinputelement option = new checkboxinputelement(); option.name = "text1"; option.value = "text1"; option.text = "text1"; form.children.add(option); window.children.add(form); creates following html code: <form> <input type="checkbox" name="text1" value"text1">text1</input> </form> i end checkboxes without descriptors. you have add label descriptor text , link checkbox: formelement form = new formelement(); checkboxinputelement option = new checkboxinputelement(); option.name = "text1"; option.value = "text1"; option.id = "text1"; form.children.add(option); labelelement label = new labelelement(); label.htmlfor = 'text1'; label.text = "this

Image blob storing using python 2.7 and retrieving using php -

i doing work on project. want store image blob in mysql database using python , want retrieve using php.i working on raspberry pi. here python code: import mysqldb import sys pil import image import base64 import cstringio import pil.image db = mysqldb.connect(user='root', password='mungu', host='localhost', database='watchdogdb') image = image.open('/var/www/html/abc.jpg') blob_value = open('/var/www/html/abc.jpg', 'rb').read() sql = 'insert img(images) values(%s)' args = (blob_value, ) cursor=db.cursor() cursor.execute(sql,args) db.commit() db.close() /// here php code : $result = mysql_query("select id, image_time, ext,title {$table} order id desc limit 1"); if (mysql_num_rows($result) == 0) // table empty echo '<ul><li>no images loaded</li>'; else { echo '<ul>'; echo "<table bor

java - How would I incorporate a JavaScript browser inside a JFrame -

it has become apparent me isn't possible include javascript jeditorpane. is there way? must include website tab inside jframe's jscrollpane, cannot because there no way within java's means. are there other solutions achieve objective. perhaps libraries? problem solved javafx. can incorporated with jfxpanel. (i'll post example here later)

Guaranteed ANSI C struct sizes -

i want read, edit, , write bmp files without external libraries, using standard c. if understand correctly, important bytes aligned match bmp file format. however, think have read somewhere on internet compiler allowed pad struct bytes cannot sure how many bytes struct takes up, or how members aligned within struct. how solve issue using standard c? there syntax asking compiler make sure struct looks way specify it? how solve issue using standard c? there syntax asking compiler make sure struct looks way specify it? the c standard not provide standard way control struct layout. so, if dead set on using specified standard, cannot use structs process windows bitmap files. to solve using standard c need write/read byte arrays , serialize/deserialize them yourself.

Storing csv file's contents into data Frames [Python Pandas] -

i have written function reads csv files, stores them data frame , resample them on hourly basis. below code; def abc(path1,path2): df1=pd.read_csv(path1, sep='\t',names = ["datetime", "value"]) df2=pd.read_csv(path2, sep='\t',names = ["datetime", "value"]) df1['datetime']=pd.to_datetime(df1['datetime']) df1=df1.set_index('datetime') df1=df1.resample('h',how='sum') df2['datetime']=pd.to_datetime(df2['datetime']) df2=df2.set_index('datetime') df2=df2.resample('h',how='sum') abc = pd.dataframe(df1['value'] + df2['value']) abcd = abc * 0.519 return abc, abcd abc, abcd= abc('c:\users\desktop\b1.tsv' ,'c:\users\desktop\b2.tsv') this program works if have 30 file paths difficult make 30 data frames , process. thinking of following way of doing abov

android - How to handle returns can be either OBJECT or ARRAY with Retrofit 2? -

i'm having issue api return either array or object, below data format: object format: { "info":"no package", "time":"04-20-2016" } array format: [ { "package_id":"1234", "from":"ca", "arrive_time":"05-02-2016" }, { "package_id":"4567", "from":"de", "arrive_time":"05-04-2016" } ] after checked posts ( custom converter retrofit 2 , multiple converters retrofit 2 ), have clue should dealed gson deserializer or custom converter, case seems little different. how deal it? in advance. update: change example more proper one. chaosphinx i agree problem different posts have referenced. your first json has informations , exception in request , second 1 returned when request successful. can suggest check response http code before convert json. if code 2

ios - when ever iam passing the values ..array inside the dictionary showing error from server database -

when ever iam passing values ..array inside dictionary showing error server database ...please 1 me if thers wrong in code .. iam getting error dis officeprice: '(\n {\n officeprice = (\n {\n "amber_price" = 1;\n "amethyst_price" = 1;\n "cartage_price" = null;\n "cartage_price_type" = null;\n "credit_period" = 1;\n "diamond_price" = 1;\n "emerald_price" = null;\n "making_charge" = 1;\n office = 1;\n "ruby_price" = null;\n "sapphire_price" = 1;\n wastage = 1;\n "weight_by" = 1;\n }\n );\n }\n)', officecontactperson: '(\n {\n "contact_name" = kumar;\n designation =

Cmake external Dependency configuration -

i have sdk robotic device called (falcon haptic device), , trying to compile simple example provided company want set linking , dependency configuration using cmake. on disk have flowing files sdk include dhdc.h drdc.h lib dhdms.lib dhdms64.lib drdms.lib drdms64.lib and in different directory have project call "mmt" mmt mmt.cpp include dhdc.h drdc.h cmakelists.txt build and have following cmakelists cmake_minimum_required(version 2.6 fatal_error) project(mmt) include_directories(include) add_library(foo static imported) add_library(fop static imported) set_property(target foo property imported_location "c:/program files/force dimension/sdk-3.5.1/lib/dhdms.lib") set_property(target fop property imported_location "c:/program files/force dimension/sdk-3.5.1/lib/drdms.lib") add_executable(myexe mmt.cpp) target_link_libraries(myexe foo fop ) i succeeded in generating .sln file , when open it doesn't h

javascript - Unable to create working custom transformer -

as advised in https://github.com/facebook/react-native/issues/393#issuecomment-173247497 , have created custom transformer unable make work. transformer: var transformer = require('react-native/packager/transformer'); var fs = require("fs"); module.exports = function (data, callback) { if (data.filename.indexof("index.android.js") !== -1) { callback({ code: data.sourcecode, map: json.parse(fs.readfilesync("./index.android.js.map").tostring()), filename: data.filename }) } else { transformer(data, callback); } }; repro: clone https://github.com/krtr/native-repro npm install react-native run-android react-native start --transformer <absolute path transformer.js> tap reload js in phone/emulator