Posts

Showing posts from February, 2012

BNE branch in MIPS assembly -

right i'm preparing test in computer architecture, , being stuck in task don't understand. * $1=4, $2=2, $3=x here's code loop: addi $2,$2-1 sll $2,$2,2 mult $3,$1 mflo $3 sw $3, 0($2) bne $2,$1,loop my question is, value $2 have after this? 4 or 4x? maybe clearer if write out ordinary paper math: $1 = 4 $2 = 2 $3 = x loop: $2 = $2 -1 $2 = $2 * 2^2 $lo = $3 * $1 $3 = $lo "contents of memory address in $2" = $3 if $2 != $1 goto loop

Visual Studio, csproj: How can I specify a linked file in DependentUpon? -

suppose have default.aspx.cs in project, want make dependent upon default.aspx file that's linked. e.g.: <content include="..\somedir\default.aspx"> <link>default.aspx</link> </content> this doesn't work: <compile include="default.aspx.cs"> <dependentupon>default.aspx</dependentupon> <subtype>aspxcodebehind</subtype> </compile> this doesn't work: <compile include="default.aspx.cs"> <dependentupon>..\somedir\default.aspx</dependentupon> <subtype>aspxcodebehind</subtype> </compile> for both, error: the parent file, 'default.aspx', file 'default.aspx.cs' cannot found in project file. is possible have file dependent upon linked file? i tried same thing , seems not supported. check this: https://bitbucket.org/jfromaniello/nestin/issue/4/error-when-nesting-linked-files "dependentupon

express session - Error: Connection strategy not found MongoDB -

here simple connection use express session store, keeps banging out error though text right book. pretty sure has 'new mongostore' object initialization. var express = require('express'), expresssession = require('express-session'); var mongostore = require('connect-mongo/es5')(expresssession); var sessionstore = new mongostore({ host: '127.0.0.1', port: '27017', db: 'session' }); var app = express() .use(expresssession({ secret: 'my secret sign key', store: sessionstore })) .use('/home', function (req, res) { if (req.session.views) { req.session.views++; } else { req.session.views = 1; } res.end('total views you:' + req.session.views); }) .use('/reset', function(req, res) { delete req.session.views; res.end('cleared views'); }) .listen(3000); add url new mongostore()

linked list - C++ Linker Errors (LNK 2019: unresolved external symbol) / Project Specific -

main issue i trying build homework project involving linked lists , custom classes, when build project, following 3 linker errors... 1>customerimp.obj : error lnk2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class linkedlisttype<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > const &)" (??6@yaaav?$basic_ostream@du?$char_traits@d@std@@@std@@aav01@abv?$linkedlisttype@v?$basic_string@du?$char_traits@d@std@@v?$allocator@d@2@@std@@@@@z) referenced in function "public: void __thiscall customertype::printrentedvideo(void)" (?printrentedvideo@customertype@@qaexxz) 1>testvideostore.obj : error lnk2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl o

VIM Always Use Tabbed Pages -

i command can put in ~/.vimrc file make vim open in tabbed pages mode without having pass -p on command line. is there such command? if not, there better way this. currently, i'm using alias vi='vim -p' in bash profile. thanks..... setting following in ~/.vimrc , source ~/.vimrc au vimenter * if !&diff | tab | tabfirst | endif works being mentioned here or set alias in rc file e.g. ~/.bashrc . approach take. alias vim='vim -p' alias vi='vim -p'

MultipleApiVersions with Swagger -

i trying enable versioning on rest api, version specified in header, "api-version":2 , vendor media type, "accept: application/vnd.company.resource-v2+json , application/json; version=2" , or in query string "?version=2" . implementation using ihttprouteconstraint , routefactoryattribute. works perfectly. however, swagger not able match right model correct versioned document. operationid version 1 model. public class devicescontroller : apicontroller { [httpget, routeversion( "api/devices", 1, name = "v1.devices" )] [responsetype( typeof( ienumerable<models.v1.device> ) )] public ihttpactionresult getv1( ) { return ok( new list<models.v1.device> { ... } ); } [httpget, routeversion( "api/devices", 2, name = "v2.devices" )] [responsetype( typeof( ienumerable<models.v2.device> ) )] public ihttpactionresult getv2( ) { return ok( new list<

python - Modifying a variable in a function has no result -

i have tkinter application, have mainloop typical of tkinter, , various functions handle mouse clicks , garbage. in 1 of functions, generate string , want store string somewhere in program, can use later on if other function called or maybe if want print main loop. import , that, here , there etc etc #blah blah global declarations fruit = '' def somefunction(event): blahblahblah; fruit = 'apples' return fruit mainwin = tk() #blah blah blah tkinter junk #my code here #its super long don't want upload #all of works, no errors or problems #however button = button( blahblahblha) button.bind("<button-1", somefunction) print fruit #yields nothing mainwin.mainloop() this abridged example. else in program works fine, can track variable throughout program, when it's time saved later use, gets erased. for example, can print variable pass along 1 function argument, , fine. preserved, , prints. instant try loop or store later u

Parsing complicated Json Array in C# -

this question has answer here: parse json string inconsistent field names 1 answer i have json array: { "array":[ { "name_0":"value_0", "name_1":"value_1" }, { "name_2":"value_2", "name_3":"value_3", "name_4":"value_4", "name_5":"value_5" } ] } the data structures inside json array not consistent. how can parse them in c#? thanks! one way be var serializer = new javascriptserializer(); var data = serializer .deserialize<dictionary<string, list<dictionary<string, string>>>>(input); this because json data structure this. innermost element have dictionary<string, string> nested in generic list in turn nested in generic dict

Does Apache or some other CLIENT JAVA implementation support HTTP/2? -

i'm looking java client can connect http/2 based server.. server supporting http/2 api. don't see popular apache http client https://hc.apache.org/ still supporting http/2. does apache have implementation java client supports http/2? if not, there java client supports connecting http/2 preferably on java 7? jetty 's provides 2 http/2 java client apis. both require java 8 , mandatory use of alpn, explained here . low level apis these apis based on http2client , it's based on http/2 concepts of session , streams , uses listeners notified of http/2 frames arrive server. // setup , start http2client. http2client client = new http2client(); sslcontextfactory sslcontextfactory = new sslcontextfactory(); client.addbean(sslcontextfactory); client.start(); // connect remote host obtains session. futurepromise<session> sessionpromise = new futurepromise<>(); client.connect(sslcontextfactory, new inetsocketadd

erlang - Run an escript using TLS distribution -

i have been unable make tls distribution work when providing arguments vm via %! line in escript. cat test.es #!/usr/bin/env escript %%! +p 256000 -env erl_max_ets_tables 256000 -env erl_crash_dump /dev/null -env erl_fullsweep_after 0 -env erl_max_ports 65536 +a 64 +k true +w w -smp auto -boot /tmp/start_clean -proto_dist inet_tls -ssl_dist_opt server_certfile "/var/lib/cinched/cert.pem" server_cacertfile "/var/lib/cinched/cacert.pem" client_certfile "/var/lib/cinched/cert.pem" client_cacertfile "/var/lib/cinched/cacert.pem" server_keyfile "/var/lib/cinched/key.pem" client_keyfile "/var/lib/cinched/key.pem" -name test@192.168.101.1 main(_) -> io:format("ping: ~p~n",[net_adm:ping('cinched@192.168.101.1')]). [root@dev1 ~]# ./test.es {error_logger,{{2016,1,15},{23,36,42}},"protocol: ~tp: not supported~n",["inet_tls"]} {error_logger,{{2016,1,15},{23,36,42}},crash_report,[[{

html - When I move checkbox position to navbar, then hide and show sidebar is not working -

in demo used checkbox hide , show sidebar respectively move content left side question when change checkbox current position navbar doesn't work. please me. jsfiddle index.html <div id="wrapper"> <div id="header"> <h2>my header</h2> </div> <div id="navbar"> <h2>my navbar</h2> </div> <div class="content-wrapper"> <input id="slide-sidebar" type="checkbox" role="button" /> <label for="slide-sidebar"><span>close</span></label> <div class="sidebar-left"> <h2>lecture dates</h2> <p>11/07 - lecture on caesar</p> <p>11/08 - lecture on caesar</p> <p>11/09 - lecture on caesar</p> <p>11/10 - lecture on caesar</p>

python - How to pass different commands in tkinter based on user input -

i'm starting learn python , thought idea learn tkinter. i'm doing program takes 3 numbers user input , calculate them, printing result. from tkinter import * root = tk() root.title("test") e1 = entry(root) e1.pack() e2 = entry(root) e2.pack() e3 = entry(root) e3.pack() l = label(root) l.pack() def my_function(a,b,c): if condition: (calculations) l.config(text="option1") else: (calculations) l.config(text="option2") b = button(root, text="result", command= lambda: my_function(float(e1.get()),float(e2.get()),float(e3.get()))) my question is, how can set button print error message in case inputs not numbers? when try inside function, valueerror: cannot convert string float i managed make work despite still printing error in shell using def combine_funcs(*funcs): def combined_func(*args, **kwargs): f in funcs: f(*args, **kwargs) return combined_func def check

python - Removing strings from other strings -

how remove part of string like blue = 'blue ' yellow = 'yellow' words = blue + yellow if blue in words: words = words - yellow that thought like? edit: know thatit won't work want know work. since cant use '-' in str() you can use str.replace exchange text empty string: words = words.replace(yellow,'') note transform: "the yellow herring" into simply: "the herring" (the replacement happen anywhere in string). if want remove 'yellow' end of string, use .endswith , slice: if blue in words , words.endswith(yellow): words = words[:-len(yellow)]

Memory leak in Java? -

i wondering if following code produced sort of memory leak in java. anyways here's code: public class test { public static void main(string[] args){ a = new a(); a.x = new a(new a(new a(new a(a)))); a.x.x = null; } } class a{ public x = null; a() {} a(a a){ x = a; } } if number a's: a = new a(); // 1 a.x = new a(new a(new a(new a(a)))); // 2 3 4 5 then have circular chain: a → 1 → 2 → 3 → 4 → 5 → 1 when break circle using a.x.x = null , get: a → 1 → 2 instances 3, 4, , 5 eligible garbage collection. then, when main exits, a goes out of scope, , instances 1 , 2 eligible garbage collection. note program end before gc has chance anything.

c# - Why is WPF not updating on INotifyPropertyChanged? -

i implementing inotifypropertychanged implementing same interfaces , passing calls observablecollection`1 : class wrappedobservablecollection<telement> : inotifypropertychanged, inotifycollectionchanged //, ...others { private readonly observablecollection<telement> baselist; public wrappedobservablecollection(observablecollection<telement> baselist) { contract.requires(baselist != null); this.baselist = baselist; } #region wrapping of baselist public event propertychangedeventhandler propertychanged { add { ((inotifypropertychanged)baselist).propertychanged += value; } remove { ((inotifypropertychanged)baselist).propertychanged -= value; } } #endregion } this works fine, when bind .count property, ui never updates. suspect wrong implementation of inotifypropertychanged have verified propertychanged.add called, , event raised when property being changed. passing .add call i

Email validation error in PHP -

i have build form , and link emailvalidation.php send data on mail. facing error in php code on line 37. don't know error. error: fatal error: call undefined function checkdnsrr() in g:\pleskvhosts\domain.com\httpdocs\php\functions\emailvalidation.php on line 37 php code: <?php function validemail($emailaddress) { $isvalid = true; $atindex = strrpos($emailaddress, "@"); if (is_bool($atindex) && !$atindex) { $isvalid = false; } else { $domain = substr($emailaddress, $atindex + 1); $local = substr($emailaddress, 0, $atindex); $locallen = strlen($local); $domainlen = strlen($domain); if ($locallen < 1 || $locallen > 64) { // local part length exceeded $isvalid = false; } else if ($domainlen < 1 || $domainlen > 255) { // domain part length exceeded $isvalid = false; } else if ($local[0] == '.' || $local

ios - How to set a small image on a uiimage view on a particular position? -

i created uiview. need set small image on particular position. i can setting image in small separate view. but, plan dynamically on large uiview full screen. thanks. uiview *view = [[uiview alloc] initwithframe:cgrectmake(0,0,320,200)]; view.backgroundcolor=[uicolor clearcolor]; [self.view addsubview:view]; // add image in view uiimageview *imageview =[[uiimageview alloc] initwithframe:cgrectmake(50,50,20,20)]; imageview.image=[uiimage imagenamed:@"image.png"]; [view addsubview:imageview];

ruby on rails - How to add time format to locale on production? -

i use activeadmin gem , here error when try access site: actionview::template::error (translation missing: ru.time.formats.long) . same error in development mode on local computer, , add time: formats: long: "%y-%m-%d %h:%m:%s" to activeadmin original ru locale in external libraries. no good, know. in production can't this. tried add format config/locales in app, nothing happen. how add it? update i'm sorry stupid question leave here. problem solved adding format locale in config/locales , server restart problem solved adding format locale in config/locales time: formats: long: "%y-%m-%d %h:%m:%s" and server restart

html - How can I display first 3 element instead of displaying all css only -

i have code this: <ul> <li>karnataka</li> <li>assam</li> <li>gujarath</li> <li>westbengal</li> <li>karnataka</li> <li>assam</li> <li>gujarath</li> <li>westbengal</li> <li>karnataka</li> <li>assam</li> <li>gujarath</li> <li>westbengal</li> </ul> and want display first 3 li elements. this css code may you. <style> ul li { display: none; } ul li:nth-child(1), ul li:nth-child(2), ul li:nth-child(3) { display: list-item; } </style>

bash - How to store a variable with command status [shell script] -

i searching word in file through grep command. need store status in variable v1 0 or 1. how can it? tail -n 2 test.s | grep -q "fa|"$(date "+%m/%d/%y") tail -n 2 test1.s | grep -q "fa|"$(date "+%m/%d/%y") tail -n 2 test2.s | grep -q "fa|"$(date "+%m/%d/%y") if above searching word found variable v1 value should 0 else 1. file content : keytran|20160111|test.s submkeyqwqwqw|ndm|jan 11 01:34|test.s|6666666|sdgdh-rb|ltd.et.cts00.act loadstatus|thunnnb|6666666|fa|01/16/2016|01:34:57|01/16/2016 |01:37:13|load|test.s please suggest depending on shell, after each command execution status of previous command available in special variable: bash family $? , csh family $status$ : #/bin/bash tail -n 2 test.s | grep -q "fa|"$(date "+%m/%d/%y") v1=$? or #/bin/csh tail -n 2 test.s | grep -q "fa|"$(date "+%m/%d/%y") set v1=$status

Getting the previous Word in VBA using selection.previous wdword, 1 bug -

i'm trying write macro type previous word @ cursor. problem when i'm using "selection.previous wdword, 1" previous character, 2 previous characters , seems bug. when press "delete" button works , strange me. i'd glad if help. ultimate goal create calendar converter inside word using code. here how test it: msgbox selection.previous(unit:=wdword, count:=1) it same using next : msgbox selection.next(unit:=wdword, count:=1) instead of next word, returns word after! for example text: during flight on 21/3/1389 if cursor right after 1389, msgbox selection.previous(1,1) show "/"; if cursor after space after 1389 shows "1389". problem is, think, space. question if there alternative read previous word instead of command (selection.previous(unit:=wdword, count:=1)) word not buggy - it's behaving designed. something has tell word words start , end. when cursor stands right of space it's (quite logically) @ begi

How to convert a loop that sometimes adds a transformed value to a Java 8 stream/lambda? -

how convert java 8 lambda expression? list<string> inputstrings = new arraylist<>(); // say, list of inputstrings arraylist<someclass> outputresultstrings = new arraylist(); for(string aninputstring : inputstrings) { someclass someresult = dosomthing(aninputstring); if (someresult != null) { outputresultstrings.add(someresult); } } your code loops on input strings, performs dosomthing on each of them ( map in java's terminology), ignores results null ( filter in java's terminology) , produces list of results ( collect in java's terminology). , when put together: list<someclass> outputresultstrings = inputstrings.stream() .map(someclass::dosomething) .filter(x -> x != null) .collect(collectors.tolist()); edit: suggested tunaki, not-null check can cleaned objects::nonnull : list<someclass> outputresultstrings = inputstrings.stream()

mysql - PHP time range validation -

i working on php page includes scheduling. planning include validation limit user input same or between time ranges other schedules under single classroom. for better understanding, if schedule present on database schedule 1 : mwf 9:00am - 10:00am; room 1 neither schedule 2 : wednesday 9:00am - 10:00am; room 1 nor schedule 3: mwf 9:30am - 10:30am; room 1 allowed entered. can give me idea make happen? assuming have start_time , end_time , whenever new item getting added should not find existing items such that: start_time between new_item_start_time , new_item_end_time or end_time between new_item_start_time , new_item_end_time

Consume only first message from Kafka Queue? -

is there way consume first message kafka queue out of 1000 messages? trying implement same in java. , not have backend db. right can't it, there kip-41 solved this. although if know size of element want, there property in consumer called fetch.message.max.bytes can set size of elements want poll, , each poll return 1 record.

c# - VisualStateManager not working when value is passed through a converter for applying a Button Bg -

Image
i applying button's background color through converter. @ first applied after hovered or pressed background color gone forever , not come back. desired behavior default state hovered after hover state my problem the orange background not appear again when hovered state over implementation button usage <button content="continue" style="{staticresource buttonanycolorstyle}"> <button.background> <solidcolorbrush color="{binding something, converter={staticresource panelbgcolorconverter}, mode=twoway}" /> </button.background> </button> button style <style x:key="buttonanycolorstyle" targettype="button"> <setter property="borderbrush" value="{staticresource phoneforegroundbrush}" /> <setter property="template"> <setter.value> <controltemplate targettype="button">

asp.net - Changing a div to Text Box? -

i have div area following in .aspx program. <div id="valueintroduction" type="text" class="labelarea" runat="server"> </div> <div class="line"></div> <asp:button id="editbutton" runat="server" text="edit" /> currently div valueintroduction getting data database. have edit button in program. when press edit button trying change div text box. try this.. 1.add textbox , make visible="false" 2.when clicking edit button copy div's contents textbox , make div invisible using visibility:"hidden" . 3.set textbox visibility true.

Image on the first line disappear in wordpress posts, but DOES NOT disappear from second line onward -

i developing wordpress theme based on roots starter theme . however, facing problem here. when insert image on first line not appear, not in html mark-up (i checked page source ensure that). however, when insert image second line onward shows (also reflected in html mark-up checked page source). i wondering if issue theme or wordpress itself. using version 3.5.1 in development environment. would highly appreciate discussion on this. well can try insert image manually begining in html code.find path of image want insert , put on <img src="" />

Google Directions API Duration In Traffic -

i noticed when using google directions api web service when request contains more 1 leg response not include duration in traffic information. 1 leg requests duration in traffic present in response. why this? https://maps.googleapis.com/maps/api/directions/json?origin=50.7963874022473,-1.12215042114258&destination=50.8525337185711,-1.17932204157114&waypoints=50.7921245679458,-1.13072438976753&mode=driving&departure_time=1452940200&traffic_model=pessimistic&units=imperial&key=mykey in above request no duration in traffic in below request https://maps.googleapis.com/maps/api/directions/json?origin=50.7963874022473,-1.12215042114258&destination=50.8525337185711,-1.17932204157114&mode=driving&departure_time=1452940200&traffic_model=pessimistic&units=imperial&key=myapi the duration in traffic present. you can prefix waypoints via: , return response 1 leg , include duration in traffic field.(so long correc parameters in

android - Counter on toolbar cart icon -

i trying add counter on cart icon public boolean oncreateoptionsmenu(final menu menu) { if (!mnavigationdrawerfragment.isdraweropen()) { menu.clear(); getmenuinflater().inflate(r.menu.main, menu); relativelayout badge =(relativelayout)menu.finditem(r.id.action_cart).getactionview(); ui_hot = (textview) badge.findviewbyid(r.id.count); } return super.oncreateoptionsmenu(menu); } but following message: java.lang.nullpointerexception: attempt invoke virtual method 'android.view.view android.widget.relativelayout.findviewbyid(int)' on null object reference following xml menu file: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".mainactivity"> <item android:id="@+id/action_cart" android

Inserting a block of JavaScript code into a PHP script -

a friend of mine wanted me gather statistics website gave him following code insert in page footers: <div> <script> var wandtopsitesuserid; match = document.cookie.match(new regexp("wandtopwildlifesites" + '=([^;]+)')); if (match) wandtopsitesuserid = match[1]; else { wandtopsitesuserid = (+new date * math.random()).tostring(36).slice(2, 12); document.cookie = 'wandtopwildlifesites=' + wandtopsitesuserid + '; expires=tue, 1 jan 2030 00:00:00 utc; path=/'; } document.write('<div style="visibility: hidden;"><a href="http://www.www.fxxxxx.com/"><img src="http://xxxxxx.azurewebsites.net/log/logvisit/?siteid=2&userid=' + wandtopsitesuserid + '&pagename=' + location.pathname + '" alt="wand top wildlife sites" /></a></div>'); </script> </div> what

jsf - Running XHTML and HTML on the same page? -

is possible run html , xhtml on same page? using jsf , need integrate in template. if need give them .html extension, you'd need change default suffix .html well. add following entry web.xml achieve that: <context-param> <param-name>javax.faces.default_suffix</param-name> <param-value>.html</param-value> </context-param>

objective c - Working with data in iOS Apps (What to choose? NSData, CoreData, sqlite, PList, NSUserDefaults) -

when develop iphone app (time tracker, todolist etc) never know whats best way deal data. once used plist, next time sqlite or coredata. how decide whats best project? (only talking data management) for example if want develop: time tracker app > plist choice? rss reader app > coredata? photo app > sqlite? email client > ? for beginner can point me proper directions? (i know depends lot on app , thought help) i'm far away developing complicated apps, still pretty simple. thanks help, marc you can use these rules of thumb decide storage model work app. if data fits in memory entirely , relatively unstructured, use plist if data fits in memory entirely , has tree-like structure, use xml if data not fit in memory , has structure of graph, , app not need extraordinary query capabilities, use core data if data not fit in memory, has complex structure, or app benefits powerful query capabilities provided relational databases, use sqlite i

ruby on rails - Nested attributes not being inserted into table -

i have situation 1 of nested fields being passed parameters not being inserted table. my model company has_one :incorporation . incorporation has, right anyway, 1 field, nested company form follows <%= simple_form_for @company, url: url_for(action: @caction, controller: 'incorporations'), html: {id:"incorporationform"}, remote: false, update: { success: "response", failure: "error"} |company| %> ... <%= company.simple_fields_for :incorporation |f| %> <div class="padded-fields"> <div class="form_subsection"> <%= f.input :trademark_search, as: :radio_buttons, label: 'would trademark search , provide advice regarding issues identify in relation name have selected?', input_html: { class: 'form-control radio radio-false' } %> </div> </div> <% end %> ... <% end %> the new , create

ggplot2 - Getting an error in R - [Error: could not find function "qplot"] -

orginal r version r version 3.2.2 (2015-08-14) -- "fire safety" copyright (c) 2015 r foundation statistical computing platform: x86_64-w64-mingw32/x64 (64-bit) > library(ggplot2) error in library.dynam(lib, package, package.lib) : dll ‘colorspace’ not found: maybe not installed architecture? in addition: warning message: package ‘ggplot2’ built under r version 3.2.3 error: package or namespace load failed ‘ggplot2’ > qplot(weights, prices, color = types) error: not find function "qplot" .... hi got issues running ggplot2 , i'm trying through basic online tutorial issue, trying run qplot in 1 of exercises got errors listed above, i've read around bit on previous lookups, went through motions of: install.packages("proto") install.packages('ggplot2', dep = true) , rebooting r - still getting error. other "answer"? @mlavoie, mike wise > install.packages('ggplot2', dependencies = true) installing

how to read browser history in android phone -

i'm working on app in android can read/view browser history date , time stamp (optional) part on thesis project. help me :( i tried code , keeps me sending errors this on main activity.java package com.example.delli5.bclean; import android.support.v7.app.appcompatactivity; import android.os.bundle; import java.util.arraylist; import android.provider.browser; import android.content.contentresolver; import android.database.cursor; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.view.menu; import android.view.menuitem; import android.widget.listview; import android.widget.toast; public class mainactivity extends appcompatactivity { private arraylist<string> titles; private arraylist<string> urls; private arraylist<bitmap> bitmaps; private contentresolver cr; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); crea

android - Fragment with Both Activity and FragmentActivity doesn't work -

i want show bar graph in activity in fragment showing inflating issue. so, changed activity fragmentactivity worked application running fragment part output not displaying. here code unable find out mistake have done: mainactivity: public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } } activity_main.xml: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <fragment andr

.net - How to add the custom attributes value from xml element in c# using linq? -

hi have xml document <task> <directory path="c:\backup\"/> <days value="2" /> </task> i want path of directory , days value in c# using linq how can achieve this? the output should c:\backup\ , 2 i have far tried below xdocument path xml file works fine var directory = xdocument.descendants("task") .elements("directory") .attributes("path"); but part not working. appreciated. you try this: var directory = xdoc.descendantsandself("task") .select(c => new { path = c.elements("directory").attributes("path").first().value, day = c.elements("days").attributes("value").first().value, }); or if want 1 string: var directory = xdoc.descendantsandself("task")

Nested items control. But child item control should display based on specific condtion in wpf -

wpf: in items control, want display items control. but, want display child items control values specific set of items of parent items control based on conditions shown in image below. please let me know, how can this. nested items control specific condition more details: i’ve items control, based on items in items control; draw rectangular boxes in ui. i.e. each item in items control represents 1 rectangular box , these rectangular boxes represented in sequence (one after other in ui). now, i’ve 1 more collection of numbers (such 10,20,30,40 etc.). these numbers want represent time scale below particular consecutive rectangular boxes. i.e. let’s say, i’ve 10 items in parent items control there 10 rectangular boxes represented in ui. now, want represent 1 time scale @ bottom of 4th , 5th rectangular box based on parent item type (i.e. 4th , 5th box have 1 common time scale 10 100 (it’s not independent time scale i.e. 1 horizontal line below 4th , 5th items i.e. horizontal line

Update query in MySQL/VB.NET -

edit (i'm sorry have misinformed guys, true problem) im using 2 textboxes btw. is there way update record in mysql without using id ? mean like, update table set name = name1, sex = male1 name=name1 i'm practicing 1 on vb.net , newbie in this, please can me? thanks! yes can try sql = "update table set name = name1, sex = male1 name=@name1" try com .connection = con .commandtext = sql .parameters.addwithvalue("@name1", your_var_name) end com.executenonquery()

java - How do I refrence a non- static method from a static context -

i have constructor function when compile main method non-static method area cannot referenced static context. know simple fix cant quite there. public class rect{ private double x, y, width, height; public rect (double x1, double newy, double newwidth, double newheight){ x = x1; y = newy; width = newwidth; height = newheight; } public double area(){ return (double) (height * width); } and main method public class testrect{ public static void main(string[] args){ double x = double.parsedouble(args[0]); double y = double.parsedouble(args[1]); double height = double.parsedouble(args[2]); double width = double.parsedouble(args[3]); rect rect = new rect (x, y, height, width); double area = rect.area(); } } you need call method on instance of class. this code: rect rect = new rect (x, y, height, width); double area = rect.area(); should be: rect

ios - self.tableView.indexPathForCell(cell) returning wrong cell? -

i have uitableview (multiple sections) custom dynamic cells. each cell has uistepper representing selected quantity. in order send selected quantity (uistepper.value) cell uitableviewcontroller , have implemented following protocol: protocol uitableviewcellupdatedelegate { func celldidchangevalue(cell: menuitemtableviewcell) } and ibaction in custom cell uistepper hooked: @ibaction func pressstepper(sender: uistepper) { quantity = int(cellquantitystepper.value) cellquantity.text = "\(quantity)" self.delegate?.celldidchangevalue(self) } and within uitableviewcontroller capture via: func celldidchangevalue(cell: menuitemtableviewcell) { guard let indexpath = self.tableview.indexpathforcell(cell) else { return } // update data source - have cell , indexpath let itemspersection = items.filter({ $0.category == self.categories[indexpath.section] }) let item = itemspersection[indexpath.row] // quantity cell i