Posts

Showing posts from July, 2014

How to pass arguments from an Access form to SQL Query with "IN" clause? -

i'm having trouble getting query display results. select evaluation_table.* evaluation_table (evaluation_table.test_id in ([forms]![test data]![group_test_ids])); the control, [group_test_ids] textbox contains string of ids. example contains numbers separated commas: 1,2,3,4,5. while debugging, if changed query this, returns records: select evaluation_table.* evaluation_table (evaluation_table.test_id in (1,2,3,4,5)); i can't seem find proper syntax. sql in access can weird. i can't seem find proper syntax. that's because there none. the in selection cannot dynamic; option rewrite sql via vba.

vb6 - add a child to an xml file using vb 6.0 -

this source code generates xml each new node attached root want nodes nested. rem-add info child node ver 1a 6/24/15-next sample code 5/29/15 private sub form_load() dim dom, node, attr on error goto errorhandler set dom = createdom set node = nothing ' create comment document. set node = dom.createcomment("sample xml file need child , sub child.") dom.appendchild node set node = nothing ' create root element. dim root set root = dom.createelement("returnstate") ' create "created" attribute root element , ' assign "using dom" character data attribute value. set attr = dom.createattribute("stateschemaversion") attr.value = "fsetv5.0" root.setattributenode attr set attr = nothing ' add root element dom instance. dom.appendchild root ' insert newline + tab. root.appendchild dom.createtextnode(vbnewline) ' create , add more nodes root element created. ' create text element. set

image - Android Crash when ImageButton Src Added -

i have 3 imagebuttons in view. 1 of them has drawable in src works. when add src other 2 app crashes when tap same button had image @ first. here code below: <relativelayout 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:paddingleft="0px" android:paddingright="0px" android:paddingtop="0px" android:paddingbottom="0px" tools:context=".mainactivity"> <relativelayout android:layout_width="match_parent" android:layout_height="400px" android:id="@+id/relativelayout"> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="large t

bash - Difference between UserData and cfn-helper with CloudFormation AWS -

i starting use cloudformation orchestration/provisioning , see there 2 ways install packages: first way bash script in userdata section, example: "userdata": { "fn::base64": { "fn::join": [ "\n", [ "#!/bin/bash", "apt-get update", "apt-get upgrade -y", "apt-get install apache2 -y", "echo \"<html><body><h1>welcome</h1>\" > /var/www/index.html", another way use cfn-init: "userdata" : { "fn::base64" : { "fn::join" : ["", [ "yum update -y aws-cfn-bootstrap\n", "# install files , packages metadata\n", "/opt/aws/bin/cfn-init -v ", " --stack ", { "ref" : "aws::stacknam

windows installer - Applying an updated MST to an msi for REINSTALL? -

i have created in past msi have used deploy application. now, want distribute new update of product mst msi (since have changed msi , want transformation applied). problem transform file applied on new installations, seems not applied on installed places. in order fix this, way have found going hklm\software\classes\installer\<gid> , add mst there in transform key. requires lot of manual work, finding actual productcode add key to, copying mst somewhere permanent, etc. can think on other way done? what's update product? if build major upgrade apply new transform when install new upgrade msi file. you shouldn't expect hack system enough think there's transform present isn't! far easier change 1 file in product , create patch include changes in transform 1 new file. patch isn't new file - it's changes between 2 msi files, , doing safer , more reliable.

php - PHPStorm: Set Number of Spaces per Tab by Directory? -

the coding standards @ current company requires 2 spaces per tab php code (drupal 6). i'm in process of adding autoloading (psr-4) can start using classes , oop. new namespace points classes/src directory wish psr-2 compliant. developers here use phpstorm. there way set phpstorm use 4 spaces classes/src directory (and subdirectories) , 2 spaces rest of project? i'd avoid having developers hit tab twice effect of 4 spaces. i'd avoid converting rest of codebase 4 spaces mess our git history , have name plastered everywhere. i use sublime text 3 , possible directory settings package. no, there no way - current platform implementation not allow storing code style settings per scope or per file/directory. please follow idea-69685 updates

python - why I cannot import the class in SimPy -

learning simpy right now. using first example code, link https://simpy.readthedocs.org/en/latest/topical_guides/process_interaction.html this part of code written in interactive mode. want put class ev individual python file named ev.py (shown below). ev.py class ev: def __init__(self, env): self.env = env self.drive_proc = env.process(self.drive(env)) self.bat_ctrl_proc = env.process(self.bat_ctrl(env)) self.bat_ctrl_reactivate = env.event() def drive(self, env): while true: # drive 20-40 min yield env.timeout(randint(20, 40)) # park 1–6 hours print('start parking at', env.now) self.bat_ctrl_reactivate.succeed() # "reactivate" self.bat_ctrl_reactivate = env.event() yield env.timeout(randint(60, 360)) print('stop parking at', env.now) def

Loop through a string in PowerBuilder -

first of all, i'm noob @ powerbuilder , can't seem find how anywhere. i have been give task of rewriting application @ work. boss wants new application mimic old 1 as possible, leads question. there date field allow date input separated tilde (01/01/15~01/31/15) , uses beginning date , end date between sql statement. with being said, trying same thing in powerbuilder 12.6 classic. know can accomplish same thing using 2 date pickers (begin date , end date), boss wants transition seamless possible end users. i have sle_date_shipped on form takes in date format of mm/dd/yy , process it, want allow mm/dd/yy~mm/dd/yy , parse out begin , end date. pseudo code this: int string s string start_date string end_date if this.textsize > 8 s = this.text(value of position in string) start_date = s + s if this.text = "~" s = s + 1 s = this.text(value of position in string) end_date = s + s end if this.textsize + 1 else start_da

Google Maps and java.net.SocketTimeoutException: Read timed out -

the code below has few issues. first, it's giving me sockettimeoutexception. working fine few days ago, it's throwing error. i'm not sure how trace problem source. tried increasing timeout (which don't think work in end), times out after 18 seconds. what's more strange url works when try getting json file else (such http://mysafeinfo.com/api/data?list=englishmonarchs&format=json ). i've waited day , issue still there. there resolve issue? import java.io.bufferedreader; import java.io.inputstreamreader; import java.net.url; import java.net.urlconnection; import java.util.timer; import java.util.timertask; import org.json.simple.jsonobject; import org.json.simple.parser.jsonparser; public class sockettimeouterror { public static void main(string args[]) { url myurl; timertask task = null; try { myurl = new url( "https://maps.googleapis.com/maps/api/geocode/json?address=chicago+illinois&q

ubuntu - How to install Wireshak on Linux and capture USB traffic? -

i have encountered numerous problems in installation of wireshark, , capture of usb traffic, due user permissions. in answer, describe full workflow doing that. answers each individual problems given on different forums, thought i'd bring in 1 answer, avoid future users google every single issue encounter. tested on ubuntu 14.04, works on other distributions since none of steps specific ubuntu. the first time follow tutorial, steps 1 -> 7. when restart computer, have repeat steps 6 , 7 see usb interfaces in wireshark. install wireshark , libpcap: sudo apt-get install wireshark libpcap0.8 for debian, ubuntu , other debian derivatives, continue step 3. for other linux based systems or other installation methods, see wireshark wiki , go step 6. reconfigure wireshark allow non-superusers track packets: sudo dpkg-reconfigure wireshark-common select <yes> in prompt add username "wireshark" usergroup: sudo usermod -a -g wireshark <

magento - Sales Representative -

i have question magento. making webstore , getting 1 difficulty. have created attribute called salesrep. example if register frontend. in customer section @ backend. @ backend admin able select me sales rep or customer. if admin select me salesrep become sales rep. want shop frontend on behalf of customer. should have facility search customer name frontend. @ frontend should able shop using customer details. logged in , can select customer want shop. , shop customer. i hope explain in full details if looking more information please let me know. is there help. in advance magento doesn't provide such functionality. try free plugin . installed able find customer in backend, click "login customer" button on customer view page , directly login customer in frontend. can whatever need on behalf of customer, including shopping. plugin won't allow customers pre-select admins may login on behalf, i.e. admin able login cusomer. p.s.: not connected plugin deve

How can I parse an XML document into a Python object? -

i'm trying consume xml api. i'd have python objects represent xml data. have several xsd , example api responses documentation. http://www.isan.org/schema/v1.11/common/common.xsd http://www.isan.org/schema/v1.21/common/serial.xsd http://www.isan.org/schema/v1.11/common/version.xsd http://www.isan.org/isan/isan.xsd http://www.isan.org/schema/v1.11/common/title.xsd http://www.isan.org/schema/v1.11/common/externalid.xsd http://www.isan.org/schema/v1.11/common/participant.xsd http://www.isan.org/schema/v1.11/common/language.xsd http://www.isan.org/schema/v1.11/common/country.xsd here's 1 example xml response: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <serial:serialheadertype xmlns:isan="http://www.isan.org/isan/isan" xmlns:title="http://www.isan.org/schema/v1.11/common/title" xmlns:serial="http://www.isan.org/schema/v1.21/common/ser

javascript - Node JS event not firing -

this question has answer here: how access correct `this` inside callback? 5 answers i trying make event fire in node js code cannot work out why isn't. i have module follows: var zookeeper = require('node-zookeeper-client'), events = require('events'), util = require('util'); var client; var kafkazookeepermonitor = function(){ events.eventemitter.call(this); } util.inherits(kafkazookeepermonitor, events.eventemitter); kafkazookeepermonitor.prototype.connecttozk = function(zookeepers){ client = zookeeper.createclient(zookeepers); client.connect(); client.once('connected', function () { console.log('connected zookeeper'); this.emit('connected'); }); } module.exports = kafkazookeepermonitor; and call index.js file follows: var kafkazookeepermonitor = require(&#

django - Display full names in Form ChoiceField but saving ID's -

i have model person - database copied person_id custom_id . models.py class employee(models.model): custom_id = models.charfield(max_length=20, unique=true) @property def person(self): return person.objects.get(person_id='%s' % self.custom_id) def __str__(self): return '%s' % self.custom_id class task(models.model): employee = models.manytomanyfield(employee, blank=true, null=true) task = models.charfield(max_length=100) comment = models.charfield(max_length=200) def __str__(self): return '%s' % self.task i add method person() employee allow me access other objects model in database: so when type in shell: employee.objects.get(custom_id='123').person.full_name u'adam dylan' i have modelform use modelmultiplechoicefield forms.py class taskcreateform(forms.modelform): employee = forms.modelmultiplechoicefield(queryset=employee.objects.all()) class meta:

python - Accessing class variables from a list comprehension in the class definition -

how access other class variables list comprehension within class definition? following works in python 2 fails in python 3: class foo: x = 5 y = [x in range(1)] python 3.2 gives error: nameerror: global name 'x' not defined trying foo.x doesn't work either. ideas on how in python 3? a more complicated motivating example: from collections import namedtuple class statedatabase: state = namedtuple('state', ['name', 'capital']) db = [state(*args) args in [ ['alabama', 'montgomery'], ['alaska', 'juneau'], # ... ]] in example, apply() have been decent workaround, sadly removed python 3. class scope , list, set or dictionary comprehensions, generator expressions not mix. the why; or, official word on this in python 3, list comprehensions given proper scope (local namespace) of own, prevent local variables bleeding on surrounding scope (see python l

Rails - passing an id for a checkbox -

so have button: <button class="btn btn-success" id="btn_renew" onclick="lo_items_navigate('<%= renew_account_lo_item_path(@account, :id => 0) %>');"><i class="fa fa-refresh"></i> <%= t('toolbar.renew_label') %></button> i have checkbox each row in table. user can choose 1 checkbox (i have use checkboxes). if user checks checkbox, button becomes visible , can click it. how , pass id item in table rails url? for part: onclick="loa_items_navigate('<%= renew_account_loa_item_path(@account, :id => 0) %>') my id listed in checkboxes this: <input class="select" type="checkbox" data_value="<%= lo_item.id %>" /> how populate id>? ideas? i add data-url attribute, , write simple js plugin, listen click event, , make ajax request url data-url attribute if have data-id attribute (should dash actuall

Perl cgi string to float number -

this have in html file <form action="drinks.cgi" method="post" target="re"> ... quantity:<input name="quan" type="number" step="any"> (ml) <input style="margin-left:20px" type="submit" value="submit"/> ... ... </form> and in cgi file my $quan = $conn->quote($cgi->param(quan)); printf $quan; let's type 222 in input i expected printed out 222 printed out '222' instead... how can rid of 2 ' in cgi file can use variable other calculations. if calculations done in perl, use my $quan = $cgi->param('quan'); if calculations done in sql, start above , follow with die if $quan !~ /^[0-9]+\z/; $quan_sqllit = $quan; or # quotes aren't problem. $quan_sqllit = $conn->quote($quan); or my $quan_sqllit = "cast(".$conn->quote($quan)." int)"; or # maybe. depends on implementation of $con

android - Icons in TabLayout -

i have simple appcompatactivity 1 simple toolbar (android.support.v7.widget.toolbar), 1 design-library tablayout , 1 viewpager . now have in case 4 fragments inside viewpager , can swiped sides. works fine. use mtablayout.setupwithviewpager(mviewpager); , icons disappear can tab on empty spaces works fine. if remove line, icons visible again, "swipe" works if tab icon, nothing happens. my code mainactivity public class mainactivity extends appcompatactivity { private toolbar mtoolbar; private tablayout mtablayout; private viewpager mviewpager; private viewpageradapter madapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); inittoolbar(); inittablayout(); initviewpager(); mtablayout.setupwithviewpager(mviewpager);//here code above mviewpager.addonpagechangelistener(new tablayout.tablayou

java - Undesrstanding clone method for arrays -

i've learnt arrays clone method well-behaved , can use it. thought type of elemetns arrays hold should have implemented cloneable interface. let me provide example: public class test { public static void main(string[] args){ test[] arr_t = new test[1]; arr_t[0] = new test(10); test[] an_arr = arr_t.clone(); an_arr[0]= new test(5); system.out.println(an_arr[0].test); //5 system.out.println(arr_t[0].test); //10 } public static class test{ public int test; public test(int test) { this.test = test; } } } demo i thought 5 should have been printed twice. reason clonning arrays we're creating new arrays containing references objects first array holded (because type of elemnts not implement cloneable ). couldn't straighten things out? it's not clear if it's neccesary array element's type implements cloneable . it's simple concept, seems hard

Matlab text (with background) in front of axis of a plot -

i'm using text function add labels in matlab chart, when in front of axis can't bring text (that has background) front. tried use uistack(h, 'top') o success. the code i'm using is: texto_last=strcat(num2str(yy(end-i,1),'%.2f')); hhhh=text(2*xx(end-i,1)-xx(end-i-2,1),yy(end-i,1),texto_last,'verticalalignment'‌​,'bottom',... 'fontsize',8, 'background', 'y','color','r'); uistack(hhhh, 'top') and result postimg.org/image/dnsn96yrd any suggestion? thank you edit (2): here code: load('test_error.mat') %% plota hfig=figure('color',[1 1 1],'units','centimeters','position', [2 2 28.7+2 21+2]); [ax,h1,h2] =plotyy(xx,yy,xx,yy); %% muda cor set(h1,'color','k'); set(h2,'color','k'); set(ax,{'ycolor'},{'k';'k'}) ; set(ax,'position',[0.07 0.1 0.86 0.8]) ; %% grid grid minor grid on %%

json - Serializing .MinValue of value types (C#) in ASP.NET Web API 2 to null -

i serialize .minvalue of value types (c#) in asp.net web api 2 null when passing client. when client sends value null .minvalue value types on server. i using json.net json serialization , deserialization. further need same uri parameters , maybe formdata. following types need: short, int, long, float, double, decimal, datetime things tried: one solution work nullable types. on server prefer work not nullable types because business logic layer working value types , in data access layer converted dbnull if .minvalue. i wrote jsonconverter datetime (derived isodatetimeconverter) handle datetime.minvalue null , vice versa. works fine, not sure how numbers because don't have jsonconverter implementations in json.net or can't find them. for uri-parameters try implementation of imodelbinder is there built in way in json.net handle needs have not found? how can overwrite number-serialization (int, decimal, ..) in json.net? any other idea satisfy needs... y

javascript - ngResource route not formatted as expected -

i have service uses ngresource talk rest api: 'use strict'; angular.module('accountmanagement').factory('accounts', ['$resource', function($resource) { return $resource('api/accounts/:accountid', { accountid: '@_id' }, { update: { method: 'put' } }); }]); and have update function looks this: $scope.update = function() { // alert($scope.editaccount); var $aid = $scope.editaccount._id; var acc = $scope.editaccount.tostring(); accounts.update({id:$aid}, acc); }; the problem restapi expects route formatted like: /api/accounts/account_id but instead being formatted like: /api/accounts?id=account_id giving me 400 error. i'm pretty new angular haven't managed find problem in documentation.

Invalid Escape sequence java -

this question has answer here: java doesn't work regex \s, says: invalid escape sequence 3 answers i trying keeps give me error invalid escape format. trying remove backslash didn't work private string chars = "(lp+" (\\w+)/\\d{3} \\d+ \\w+ \\s+\\s?\"?($|-|[\\w\\\\\.@]+)\"?")"; string should have capital 's' you've missed esacaping couple of quotation marks. you have run of 5 backslashes, should either 4 or 6. you probably want instead... private string chars = "(lp+\" (\\w+)/\\d{3} \\d+ \\w+ \\s+\\s?\"?($|-|[\\w\\\\\\.@]+)\"?\")";

Editting a bigbluebutton's video -

i want delete part of bigbluebutton's video or download editting. have use api? i'm project manager bigbluebutton. playback format bigbluebutton html5 web page uses popcorn.js synchronize playback of vp8 encoded video (audio track + webcams + desktop sharing) , slides (png images + svg graphics) , chat (html text area). we support marking segments during session playback using start/stop record button. there no api edit recording, modify events.xml (the events file generated session) add more start/stop recording marks , submit recording re-processing. again, there no api this, , needed understand how events.xml formatted, pieces there build interface enable editing , re-processing. for more information, see http://docs.bigbluebutton.org/dev/recording.html

cron - Running a PHP file from Crontab that includes require_once() -

i'm trying run php file crontab. aim of php send email user. including header files of php framework. crontab seems having problem paths. i've tried changing absolute path.. see test cases below. using require_once(http://www.test.com/inc/header.php) , running php -f test.php command line results in: php warning: require_once(): http:// wrapper disabled in server configuration allow_url_include=0 in /home/user/public/test.com/public/deploy/cron/test.php on line 3 php warning: require_once(http://www.test.com/inc/header.php): failed open stream: no suitable wrapper found in /home/user/public/trybe-ing.com/public/deploy/cron/test.php on line 3 php fatal error: require_once(): failed opening required 'http://www.test.com/inc/header.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/user/public/test.com/public/deploy/cron/test.php on line 3 using require_once('../../inc/header.php'); , running php -f test.php command line result

java - Why am I unable to select all the text when clicking a button? -

i new gui based java programming , query. import java.awt.*; import java.awt.event.*; class panels { static frame f; static textarea t; public static void main(string...xyxxcxcx) { f=new frame(); f.setlayout(new flowlayout()); f.setsize(400,300); t=new textarea(); button b=new button("select all"); f.add(b); f.add(t); t.settext("step ring game"); b.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { t.selectall(); } } ); f.setvisible(true); } } when click "select all" button, expect text present in text area selected. not happening. please advise. it is happening, textareabut button has focus, never see it. if tabbed on textarea, you'd see text selected. what if called public void actionperformed(actionevent e) { t.selectall(); t.requestfocus

html - tag with <br> count as empty? -

does tag count empty when forexample doing this? html <p> </br> </p> css p:empty {display:none} no. p:empty {display:none} to apply p must empty. <p></p> is empty , take style. <p> </p> is not empty , not take style. in code below border added illustration purposes only. p { border: 1px solid red; } p:empty { display:none } <p></p> <p> </p>

Relating Constructor of Super Class in java -

if create object of sub-class no constructors, know compiler implicitly provide default constructor. if create constructor in sub-class , try access super class constructor using super keyword, and, now, super class has no constructor in it. compiler provide default constructor super class well? yes, if there no specified constructor, there default empty constructor

javascript - Spectrum color picker: the original input field is showing -

Image
i'm using following code: <script src="/js/spectrum.js" type="text/javascript"></script> <link rel="stylesheet" href="/css/spectrum.css" /> <script type="text/javascript"> jquery(function() { var opts = { showinput: true, classname: "full-spectrum", showinitial: true, showpalette: true, showselectionpalette: true, maxselectionsize: 20, preferredformat: "hex" }; jquery( '#drivercolor' ).spectrum( opts ); } ); </script> ... <input type="text" name="drivercolor" value="#ff0000" id="drivercolor" /> when hit color picker, original input field appearing: how can fix it? tia this may little late but, in older rails app (2.3.4), able force original input field not show adding width, height, border , padding style of input eg: <input id=&qu

angularjs - Manage multi-level Ionic ionSideMenus -

i need manage sidemenu ( http://ionicframework.com/docs/api/directive/ionsidemenus/ ) multi-level hierarchy. nice solution can use multiple views manage $stateprovider.state , change content change content inside of <ion-side-menu> , not know how do. option |_ sub-option 1 |_ sub-option 2 option b |_ sub-option 1

vb.net - HRESULT: 0x800A03EC VB -

obook.worksheets(1).range("$d$1:$d$4000").autofilter(field:=4, criteria:="#n/a") running code following error: unhandled exception of type 'system.runtime.interopservices.comexception' occurred in mscorlib.dll additional information: exception hresult: 0x800a03ec after looking around internet , trying work, struggling find answers. i code filter out of #n/a entries in column d. you can't use field:=4 1 column range. field parameter index range's columns, not actual column number (eg. 4 col d). second parameter criteria1 , not criteria : obook.worksheets(1).range("$d$1:$d$4000").autofilter(field:=1, criteria1:="<>#n/a")

java - Error importing XML file into MS Project -

i have programmatically created xml file in java jdom2 library. when try import file ms project, error (we're sorry seems ther problem in file doesn't allow open. try use backup if available) but when copy content of xml file, in new file , save xml, when try import in project works perfectly. why possible, , how can solve it? edit: put code element e = new element("project"); document doc = new document(e); e.addcontent(new element("saveversion").settext("14")); e.addcontent(new element("name").settext(nomfichero)); e.addcontent(new element("creationdate").settext(fecha)); e.addcontent(new element("lastsaved").settext(fecha2)); e.addcontent(new element("schedulefromstart").settext("1")); e.addcontent(new element("startdate").settext(fecha)); e.addcontent(new element("finishdate").settext(fecha)

asp.net - IIS Default website throws error with .CLR 4.0 System.OutOfMemoryException. 2.0 works fine -

Image
i have windows 8.1 machine (2gb ram + 32-bit os, x64-based processor) , have configured iis on it. when try launch default website (localhost) default on port 80, throws following error: configuration error description: error occurred during processing of configuration file required service request. please review specific error details below , modify configuration file appropriately. parser error message: exception of type ' system.outofmemoryexception ' thrown. source error: line 109: source file: c:\windows\microsoft.net\framework\v4.0.30319\config\web.config line: 109 version information: microsoft .net framework version:4.0.30319; asp.net version:4.0.30319.34248 this happens right after os installed, updated windows update , iis configured. machine clean , there no other app, not anti-virus installed. same happening other websites well. 1 page 'hello world' asp.net page. what works: when change application pool 2.0, works fine . so far: ha

c# - NetworkStream class: Read Issue -

i making server client program in core c#./net in send data serialised 1 client server there 2 exceptions occur when data large. works fine throws exception. ioexception or serialisation exception thrown. here code receive , deserialise data: memorystream mst = new memorystream(); strread.readtimeout = 250; try { int b = strread.read(outstream, 0, outstream.length); while (b > 0) { console.writeline("recieving data " + b); mst.write(outstream, 0, b); try { b = strread.read(outstream, 0, outstream.length); } catch (ioexception ioex) { console.writeline(ioex.targetsite); b = 0; } } console.writeline("size of recieved bytes " + b); } catch (exception except) { console.writeline(except.stacktrace + "\r\n" + except.targetsite); } //int bcount = strread.read(outstream, 0, outstream.length); mst.read(outstream, 0, outstream.le

java - A guaranteed way to get source-order of member fields at runtime? -

i'm looking way retrieve (at runtime) fields of class in source-order, can perform own "initialization processing" based on order of declaration. know javadoc class.getdeclaredfields() explicitly states no order guaranteed. some answers on point javassist can find no evidence javassist has such guarantee in absence of line number information. yet "source-order" used java compiler, code not compile: private int = 10 * b; private int b = 5; clearly, value of b isn't known @ moment a being declared. this initialization order must present in bytecode since @ runtime initialization must happen in same order (granted, requirement these edge cases :-( yet leads me think natural thing store source order inside .class file. questions: how jvm/byte code go initializing member fields in declared order, , can information perhaps used reconstruct source-order of fields? is there other guaranteed way of achieving same. third-party tools javassist

Implement "Add to favourites" from icon in cardview android -

in app, add favourites icon inside cardview. on clicking icon, card should added my favorites list , icon should toggle different colour. on clicking again should removed favourites . want accomplish task through sharedpreference. how should proceed sequentially accomplish task? hope have layouts done. if not - create them. make sure favourites togglebutton create adapter listview or recyclerview inside adapter, when binding views, call: findviewbyid(r.id.btn_favourite).setonclicklistener(new view.onclicklistener() { public void onclick(view view) { if(view.isselected) { markasfavourite(item); } else { removefromfavourites(item); } } }); where item object representing data list implement markasfavourite(item) ; , removefromfavourites(item); methods. here rough example of markasfavourite(item) using sharedpreferences. set itemids = msharedpreferences.edit().getstringset(key, new set()

git - How to reset the origin/master ref locally -

i have following scenario: i have 3 commits in local repo, this: initial -- -- b where both master , origin/master point @ b . after that, fetch origin, , repo looks this: initial -- -- b -- c -- d where master points @ b , origin/master point @ d . after that, merge , master points @ d . i can reset master branch doing git reset --hard b . what reset origin/master ref commit b . and, not mean want reset remote repository state - want locally only. no pushing. want remote remain unchanged. want change knowledge of local repo regard state of remote repo. how can that? i can change files in .git directory, files? or there maybe git command it? why need that? because want able replay scenario, test git-based project management i'm working on. replay same situation, in order see how behaves if change conditions slightly. the safest way git update-ref refs/remotes/origin/master <sha> . cause change recorded in reflog, should ever ne

php - Why isn't $_SESSION data being preserved across pages? -

why $_session data not being preserved across pages? can access $_session data on , on over same page, not page other 1 set on. index.php (set attempt): <?php session_start(); $_session['test'] = '1'; ?> <!doctype html> <html lang="en"> <head> <title>title</title> </head> <body> <h1>heading</h1> <a href="pagetwo.php">page two</a> </body> </html> pagetwo.php (get attempt): <?php session_start(); ?> <!doctype html> <html lang="en-us"> <head> <title>title</title> </head> <body> <? echo $_session['test']; ?> </body> </html> problem in php tag. your tag should be <?php echo $_session['test']; ?>