Sunday 15 March 2015

java - RadioGroup check doesn't work for me -



java - RadioGroup check doesn't work for me -

i have such functionality - have dialog (with settings) in there radiogroup 2 radiobuttons. when close dialog "save" button not save info in info class, want dialog open saved setting next time opened. tried accomplish radigroup methods: getcheckedradiobuttonid() , .check(int), solution doesn't work , don't know why.

my code:

settingsdialogfragment.java public class settingsdialogfragment extends dialogfragment{ private boolean ifmale; private int checkedradio; private radiogroup rg; public dialog oncreatedialog(bundle savedinstancestate) { // utilize builder class convenient dialog construction alertdialog.builder builder = new alertdialog.builder(getactivity()); builder.settitle(r.string.settings); view view = layoutinflater.from(getactivity()).inflate(r.layout.settings_dialog, null); builder.setview(view); builder.setpositivebutton(r.string.save, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { data.ifmale = ifmale; checkedradio = rg.getcheckedradiobuttonid(); system.out.println("numer radio" +checkedradio); } }); builder.setnegativebutton(r.string.cancel, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { // user cancelled dialog } }); rg = (radiogroup) view.findviewbyid(r.id.radio_group); rg.setoncheckedchangelistener(new radiogroup.oncheckedchangelistener() { @override public void oncheckedchanged(radiogroup group, int checkedid) { switch(checkedid) { case r.id.radio_female: //log.v("radiogroup", "female"); ifmale = false; break; case r.id.radio_male: log.v("radiogroup","male"); ifmale = true; break; } } }); rg.check(checkedradio); homecoming builder.create(); } } settings_dialog.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <radiogroup android:id="@+id/radio_group" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center"> <radiobutton android:id="@+id/radio_female" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/female"/> <radiobutton android:id="@+id/radio_male" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/male"/> </radiogroup> </linearlayout>

you can utilize shared preference maintain track of checked radio button's information, , check next time when dialog opened.

code snippet:

sharedpreferences pref = getapplicationcontext().getsharedpreferences("radiopref", mode_private); editor editor = pref.edit(); //save info in shared preference on button click builder.setpositivebutton(r.string.save, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { data.ifmale = ifmale; checkedradio = rg.getcheckedradiobuttonid(); system.out.println("numer radio" +checkedradio); editor.putint("checkedid", checkedradio); } }); //get checkedid shared preference , check radion button. int checkedid = pref.getint("checkedid", -1); if(checkedid != -1) { //rg.check(checkedid); radiobutton rbutton =(radiobutton)findviewbyid(checkedid); rbutton.setchecked(true); }

hope helps.

java android android-dialogfragment android-radiogroup android-radiobutton

ms access - Updating table with VBA -



ms access - Updating table with VBA -

i have been struggling getting code work few days. if offer solutions appreciate it.

private sub command0_click() if isnull(newsupbox.value) or isnull(newnumberbox.value) msgbox ("all fields must filled") goto errorexit end if if not isnull(dlookup("suppliernumber", "supgeninfo ", "supgeninfo.suppliernumber =" & newsupbox)) = msgbox ("this supplier number exists. can edit current record on edit supplier page.") goto errorexit end if dim db database dim rec recordset set db = currentdb set rec = db.openrecordset("select * supgeninfo") rec.addnew rec("suppliernumber") = me.newsupbox.value rec("suppliername") = me.newnamebox.value rec.update set rec = nil set db = nil msgbox "records added successfully." errorexit: end sub

edit: forgot mention not getting error message. command not add together new record table.

edit2: code above output msg "records added successfully" when remove next block of code.

dim db database dim rec recordset set db = currentdb set rec = db.openrecordset("supgeninfo") rec.addnew rec("suppliernumber") = me.newsupbox rec("suppliername") = me.newnamebox rec.update set rec = nil set db = nil

it when code included command click becomes unresponsive.

i believe, reading table (for display purposes) select * ... statement, you're adding new record list rather actual database. when open openrecordset, supply table name, not whole sql query shebang...

i created new table, edit code match parameters/values, otherwise has been tested work:

dim db database dim rec recordset set db = currentdb set rec = db.openrecordset("table1") rec.addnew rec("field1") = 1234 rec("field2") = "blah2" rec("field3") = "blah3" rec.update set rec = nil set db = nil

hope helps.

vba ms-access

Visual Studio 2013 - c++ code map error message -



Visual Studio 2013 - c++ code map error message -

i've used visual studio's 'code maps' extensively c# projects in past. i'm working on native c++ project , running problems. when add together class or method code map next error message no context or help available. ideas cause is?

error fail symbol's namespace

i should not project compiles , runs without problem.

this msdn page on code maps notes under requirements c++ has limited support.

c++ visual-studio-2013 code-map

c# - wpf not refresh code if not focused -



c# - wpf not refresh code if not focused -

i have situation: class contains background worker thing in while cycle:

public class ccontrols { public delegate void controlchangedeventhandler(); public event controlchangedeventhandler controlchangedevent; private readonly backgroundworker worker; bool bclose = false; public ccontrols(intptr hwnd) { worker = new backgroundworker(); worker.dowork += worker_dowork; worker.runworkercompleted += worker_runworkercompleted; } void worker_runworkercompleted(object sender, runworkercompletedeventargs e) { bclose = true; } public void enable(bool benable) { if (benable && !worker.isbusy) { worker.runworkerasync(); } else { bclose = true; } } void worker_dowork(object sender, doworkeventargs e) { while (!bclose) { // job // .............................................. // if (controlchangedevent != null) { controlchangedevent(); } } } }

i have form create instance of class , set listener of controlchangedevent:

ccontrols ct = new ccontrols(); ct.controlchangedevent += ct_controlchangedevent; int changes = 0; void ct_controlchangedevent() { dispatcher.invoke(dispatcherpriority.background, (action)delegate { changes ++; infolabel.content = string.format("changes: {0}", changes); }); }

but infolabel changes if programme have focus, otherwise not fired...

any ideas? ;)

c# wpf visual-studio-2012 focus backgroundworker

Grails, Grails RabbitMQ plugin, Java ,Spring AMQP - Multiple clients -



Grails, Grails RabbitMQ plugin, Java ,Spring AMQP - Multiple clients -

i have developed simple grails rest web service uses grails rabbitmq plugin , sends message queue.

grails - config.groovy

queues = { exchange name: 'my.topic', type: topic, durable: false, { foo durable: true, binding: 'test.#' } }

on java desktop app seek hear message using spring amqp

main.java

public static void main(string[] args) { cachingconnectionfactory cf = new cachingconnectionfactory("localhost"); cf.setusername("guest"); cf.setpassword("guest"); rabbitadmin admin = new rabbitadmin(cf); simplemessagelistenercontainer container = new simplemessagelistenercontainer(cf); object listener = new object() { public void handlemessage(string foo) { system.out.println(foo); } }; messagelisteneradapter adapter = new messagelisteneradapter(listener); container.setmessagelistener(adapter); container.setqueuenames("foo"); container.start(); }

when run multiple clients (say two) 1 recive "message" , another. how can both clients recive "message" on every "send" (i send messsage index grails controller reloading page).

what prefered way ? newbie :)

each consumer needs own queue bound exchange.

multiple consumers on same queue compete messages.

java grails rabbitmq grails-plugin spring-amqp

Winforms (Horizontal) Scrollbar Unexplained Behavior -



Winforms (Horizontal) Scrollbar Unexplained Behavior -

when resize form resize handle on bottom right corner of form, fires sizechanged event of user control. within user command have code set maximum , value of horizontal scroll bar.

if resize right, code works expected. when resize left, scrolling thumb gets big , scrolling not work expected. it's if maximum got set low number, debug.writeline shows not case. actually, resize form narrower, toggles between doing right , doing wrong.

i deal scroll bars , when pain. there scrollbar guru knows why happening? googled , searched too, don't know search on.

here code. relevant part called sizechanged event handler, bottom of code.

class="lang-vb prettyprint-override">imports system.reflection public class grid public sub new() ' phone call required designer. initializecomponent() ' add together initialization after initializecomponent() call. setstyle(controlstyles.allpaintinginwmpaint or controlstyles.userpaint or controlstyles.doublebuffer, true) 'or controlstyles.resizeredraw end sub private _firstvisiblerow row private property firstvisiblerow row if _firstvisiblerow nil , rows.any _firstvisiblerow = rows.first end if homecoming _firstvisiblerow end set(value row) _firstvisiblerow = value lastvisiblerow = getlastvisiblerow() end set end property private _headerrow row public property headerrow row if _headerrow nil _headerrow = new row(me, rowheight) each column column in columns _headerrow.cells.add(new cell(column, _headerrow)) next end if homecoming _headerrow end private set(value row) _headerrow = value end set end property private _lastvisiblerow row private property lastvisiblerow row if _lastvisiblerow nil _lastvisiblerow = getlastvisiblerow() end if homecoming _lastvisiblerow end set(value row) _lastvisiblerow = value end set end property private _totalcolumnwidth integer friend property totalcolumnwidth integer if _totalcolumnwidth = nil _totalcolumnwidth = gettotalcolumnwidth() end if homecoming _totalcolumnwidth end set(value integer) _totalcolumnwidth = value setscrollbarvisibility() end set end property private _totalrowheight integer friend property totalrowheight integer if _totalrowheight = nil _totalrowheight = gettotalrowheight() end if homecoming _totalrowheight end set(value integer) _totalrowheight = value setscrollbarvisibility() end set end property private _visiblegridsize size private property visiblegridsize size if _visiblegridsize = nil _visiblegridsize = getvisiblegridsize() end if homecoming _visiblegridsize end set(value size) _visiblegridsize = value visiblerowcount = getvisiblerowcount() setscrollbarvisibility() end set end property private sub setscrollbarvisibility() vscrollbar1.bounds = new rectangle(width - vscrollbar1.width, 0, vscrollbar1.width, height - iif(hscrollbar1.visible, hscrollbar1.height, 0)) hscrollbar1.bounds = new rectangle(0, height - hscrollbar1.height, width - iif(vscrollbar1.visible, vscrollbar1.width, 0), hscrollbar1.height) vscrollbar1.maximum = math.max(0, totalrowheight - height - iif(hscrollbar1.visible, hscrollbar1.height, 0)) hscrollbar1.maximum = math.max(0, totalcolumnwidth - width + iif(vscrollbar1.visible, vscrollbar1.width, 0)) hscrollbar1.value = 0 vscrollbar1.visible = totalrowheight > visiblegridsize.height hscrollbar1.visible = totalcolumnwidth > visiblegridsize.width debug.writeline(string.format("hscrollbar1.minimum {0}, hscrollbar1.maximum {1}, hscrollbar1.value {2}", hscrollbar1.minimum, hscrollbar1.maximum, hscrollbar1.value)) end sub private _visiblerowcount integer private property visiblerowcount integer if _visiblerowcount = 0 _visiblerowcount = getvisiblerowcount() end if homecoming _visiblerowcount end set(value integer) _visiblerowcount = value lastvisiblerow = getlastvisiblerow() pageheight = getpageheight() end set end property private function getlastvisiblerow() row if not rows.any homecoming nil homecoming rows(math.min(firstvisiblerow.index + visiblerowcount - 1, rows.count - 1)) end function private function getpageheight() integer homecoming rowheight * getvisiblerowcount() end function private function getrowheight() integer homecoming textrenderer.measuretext("x", font).height + 6 end function private function getvisiblegridsize() size homecoming new size(width - iif(vscrollbar1.visible, vscrollbar1.width, 0), height - headerrow.height - iif(hscrollbar1.visible, hscrollbar1.height, 0)) 'don't count header row or horiz scroll bar end function private function getvisiblerowcount() integer homecoming math.ceiling(visiblegridsize.height / rowheight) end function public shadows sub refresh() clearselection() _headerrow = nil _rows = nil autosizecolumns() totalrowheight = gettotalrowheight() invalidate() end sub friend function gettotalcolumnwidth() integer homecoming columns.select(function(x) x.width).aggregate(0, function(x, y) x + y) end function friend function gettotalrowheight() integer homecoming rows.select(function(x) x.height).aggregate(0, function(x, y) x + y) end function private function visiblerows() list(of row) homecoming rows.where(function(x) x.index >= firstvisiblerow.index andalso x.index <= lastvisiblerow.index).tolist end function private sub grid_paint(sender object, e system.windows.forms.painteventargs) handles me.paint e.graphics.clear(backcolor) 'e.cliprectangle dim left integer = -hscrollbar1.value each column column in columns left = column.draw(e.graphics, left) next dim top integer = headerrow.draw(e.graphics) each row row in visiblerows() top = row.draw(e.graphics, top) next end sub private sub grid_scroll(sender object, e system.windows.forms.scrolleventargs) handles me.scroll if e.scrollorientation = scrollorientation.verticalscroll select case e.type case scrolleventtype.first firstvisiblerow = rows.first case scrolleventtype.last firstvisiblerow = rows(rows.last.index - visiblerowcount + 1) case scrolleventtype.smalldecrement firstvisiblerow = rows(math.max(firstvisiblerow.index - 1, 0)) case scrolleventtype.smallincrement firstvisiblerow = rows(math.min(firstvisiblerow.index + 1, rows.last.index - visiblerowcount + 1)) case scrolleventtype.largedecrement firstvisiblerow = rows(math.max(firstvisiblerow.index - visiblerowcount, 0)) case scrolleventtype.largeincrement firstvisiblerow = rows(math.min(lastvisiblerow.index, rows.last.index - visiblerowcount + 1)) end select end if invalidate() end sub private sub grid_sizechanged(sender object, e system.eventargs) handles me.sizechanged visiblegridsize = getvisiblegridsize() end sub private sub hscrollbar1_scroll(sender object, e system.windows.forms.scrolleventargs) handles hscrollbar1.scroll invalidate() end sub end class

the autoscroll property of usercontrol getting set true parent control. 1 time set false in designer, code works expected 100% of time.

winforms

java - System.out.println printing on Server -



java - System.out.println printing on Server -

using eclipse :

when sysout in java file, prints @ eclipse console when our application deployed on jboss sysout prints value @ server console , server logs. it, makes change?

for eg: in standalone normal java program

system.out.println("java wonderful") prints on eclipse console

but if write same sentence in java file i.e. part of web application , application deployed on jboss value printed on jboss console , server logs.

what know "out" refers scheme console if sysout should write system's console. why in case of web application deployed on jboss write on server console.

the value of system.out starts out "standard output" stream jvm running application.

when run application within eclipse, eclipse has used system.setout(...) stream writes eclipse console.

when launch jvm eclipse, jvm's system.out start out referring eclipse console. application in jvm could alter using system.setout(...).

when launch jvm command line, jvm's system.out start out referring shell's console.

for jboss, launch script (or native launcher) alter standard output stream before launches application. should documented somewhere ...

so find out going on, need @ how launching jboss.

but there nil particularly mysterious it.

java eclipse logging jboss

HTML/CSS: L-Shaped Cell in Table -



HTML/CSS: L-Shaped Cell in Table -

is possible, using html and/or css, create table l-shaped cell? the way i've found doesn't create cell l-shaped (though create one).

for example, in table next cells:

| 00 | 01 | 02 | 03 | | 10 | 11 | 12 | 13 | | 20 | 21 | 22 | 23 | | 30 | 31 | 32 | 33 |

the goal create cell takes place of cells 11, 12, , 21, without shifting cell 22 out of way.

no. cannot this.

however, can create look like few css styles:

jsfiddle.

css * { margin: 0; padding: 0; } table { border-collapse: collapse; border-spacing: 0; } td { border: 1px solid navy; padding: 5px; } .nobordertop { border-top: none; } .noborderbottom { border-bottom: none; } .noborderleft { border-left: none; } .noborderright { border-right: none; } html <table> <tr> <td>01</td> <td>02</td> <td>03</td> <td>04</td> </tr> <tr> <td>11</td> <td class="noborderright noborderbottom">12</td> <td class="noborderleft">13</td> <td>14</td> </tr> <tr> <td>21</td> <td class="nobordertop">22</td> <td>23</td> <td>24</td> </tr> <tr> <td>31</td> <td>32</td> <td>33</td> <td>34</td> </tr> </table> result:

html css html-table

How to pass an array to function in VBA? -



How to pass an array to function in VBA? -

i tryint write function accepts array argument. array can have number of elements.

function processarr(arr() variant) string dim n variant dim finalstr string n = lbound(arr) ubound(arr) finalstr = finalstr & arr(n) next n processarr = finalstr end function

here how seek phone call function:

sub test() dim fstring string fstring = processarr(array("foo", "bar")) end sub

i error saying:

compile error: type mismatch: array or user defined type expected.

what doing wrong?

this seems unnecessary, vba unusual place. if declare array variable, set using array() pass variable function, vba happy.

sub test() dim fstring string dim arr() variant arr = array("foo", "bar") fstring = processarr(arr) end sub

also function processarr() written as:

function processarr(arr() variant) string processarr = replace(join(arr()), " ", "") end function

if whole brevity thing.

arrays vba function ms-access access-vba

maven - How to use custom reasteasy instead of jboss standard one -



maven - How to use custom reasteasy instead of jboss standard one -

i working jboss 6.2 has resteasy standard version set 2.3.7.

i need utilize resteasy 3.0.8 , trying accomplish result using maven , specifying version in pom, right resteasy set in war seems jboss keeps on using 2.3.7.

i wondering if next right path , if can provide me web resources solve issues.

i had same issue.

this link usefull, works great me.

maven jboss resteasy

Appropriate scheduling algorithms for harvesting Facebook pages? -



Appropriate scheduling algorithms for harvesting Facebook pages? -

i want schedule harvesting facebook pages @ appropriate intervals. pages have more content (the simpsons thousands of comments , likes per post), others have less content (unsealed files, few hundred comments , likes per post), , still other pages have harvested every few minutes because real time event going on (such during hockey match, on colorado avalanche).

i'm trying find appropriate algorithms schedule these different types of pages. @ moment, utilize simplistic algorithm: harvest n pages on m hours. schedule harvest every (m * 60 * 60) / n seconds. schedule real time pages using same algorithm, except it's time shifted schedule @ origin of period, , every x minutes until end of event.

this worked until started suffering bufferbloat: queue holds requests harvest pages empties when harvester ready. don't "drop packets", hence requests queue behind other pages , prevent latest requests harvesting.

the statistics maintain track of , can utilize during scheduling decisions are:

the time scheduled each page harvest; the actual time each page started harvesting; the volume of info harvested on each page; whether or not page needed real time harvesting.

this problem seems network scheduler algorithm. on right track? other algorithms should investigate?

algorithm scheduling

c# - How radio button click if included onclick function? -



c# - How radio button click if included onclick function? -

<asp: label input name="id" value="p" onclick="form.submit(); homecoming false;" type="radio">personal / romance /label>

i trying below both code not getting solution. please if have solution it's help me.

webbrowser1.document.getelementbyid("id").setattribute("value", "p"); foreach (htmlelement el in webbrowser1.document.getelementsbytagname("label")) { if (el.innertext == ("personal romance")) { el.invokemember("click"); } }

your code looks okay, innertext of label not personal romance

try this:

string searchstring = @"personal / romance"; if(el.innertext.equals(searchstring) { el.invokemember("click"); }

check when expect element if right tag name label. can tell sure not asp:label. can check inspect elements in chrome, if tag name different utilize right 1 when taking webbrowser1.document.getelementsbytagname(correct tag)

c# asp.net radio-button webbrowser-control

php - How do I search by properties of entity which do not have @Column anotation in Doctrine2? -



php - How do I search by properties of entity which do not have @Column anotation in Doctrine2? -

/** * @orm\entity */ class order extends baseentity { // trait @id utilize identifier; /** * @orm\column(type="integer") */ protected $costperunit; /** * @orm\column(type="integer") */ protected $numberofunits; // want search property protected $totalcost; public function gettotalcost() { homecoming $this->numberofunits * $this->costperunit; } }

i have entity , i'd able example

$orderrepository->findonebytotalcost('999') $orderrepository->findby(['totalcost' => '400']);

is possible in doctrine2? or go differently?

you should write method findonebytotalcost on entity repository, like:

public function findonebytotalcost ($queryparams){ $query = 'select o <yourentity> o o.numberofunits * o.costperunit = :myparam'; $dql = $this->getentitymanager()->createquery($query); $dql->setparameter('myparam', $queryparams); homecoming $dql ->execute(); }

them, $orderrepository->findonebytotalcost('999') should work.

php orm doctrine2 doctrine entity

Compilation issues in C -



Compilation issues in C -

i have problem when compile programme , don't know why. think it's library problem i'm not sure. searched on google couldn't solve problem.

command line:

clang `pkg-config --libs opencv ` main.o image_handle.o image_detection.o neural_network.o -o main

this error message:

/usr/bin/ld: neural_network.o: undefined reference symbol 'exp@@glibc_2.2.5' //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: dso missing command line clang: error: linker command failed exit code 1 (use -v see invocation) make: *** [main] error 1

edit: makefile

#for compilation cc=clang cppflags=`pkg-config --cflags opencv` cflags= -wall -wextra -werror -std=c99 -o2 ldflags=`pkg-config --libs opencv` src= main.c image_handle.c image_detection.c neural_network.c obj= ${src:.c=.o} all: main clean main: ${obj} clean: rm -f *~ *.o #end

/lib/x86_64-linux-gnu/libm.so.6: error adding symbols: dso missing command line

that's linker telling sort of found symbol looking for, not in library asked link with. should add together library command line. flag libm -lm

clang main.o image_handle.o image_detection.o neural_network.o \ `pkg-config --libs opencv ` -lm -o main

(you set libraries after objects require them on command line.)

c compilation linker-error

php - fopen() path for private and public keys -



php - fopen() path for private and public keys -

my question in relation finding public , private key sets within file structure. quite incompetent concept, please bear me.

currently, open private , public key pairs, utilize next expression:

fopen(dirname(__file__) . '/rsa_private_key.pem', 'r');

dirname(__file__) directs /vagrant/opencart/upload/catalog/controller/payment, script gets executed resides. so, private/public key pair resides in same folder script opens it.

i doing file restructuring, , have created new folder under path : /vagrant/opencart/upload/keys, both private , public keys reside.

however, not quite sure how point fopen() it. since developing on local machine, could, say, utilize absolute path, on different servers, cannot utilize absolute path forever.

my question is, how point fopen() path: /vagrant/opencart/upload/keys?

the first thing should move private key outside of web server's document root. nature of term "private key" tells you not want able access these keys! putting them under web server's docroot exposes them unnecessarily - if set rules in place protect them (e.g., htaccess file), there's no reason set them in location - definition - intended accessible default.

depending on distribution you're going deploy on, there standard location deploying such; if not, encourage define own policy, such putting them under /etc/opencart/keys.

once know/define policy, have absolute path can use, solving original problem.

php fopen

javascript - If IE tag not working for IE11 -



javascript - If IE tag not working for IE11 -

i got script quantity box can add together or remove items.

however it's not working in ie because there button within anchor tag, wanted utilize onclick function used when user uses ie.

this it, thought found out not working of ie11.

anyone know workaround? want utilize onclick function when ie used, since quantity box works fine in other browsers.

<!--[if lt ie 11]> <![endif]-->

if helps anyone, code talking not work in ie.

<a href="?del='.$key.'" class="minus" > <input type="button" class="minus" value="-" id="min"> </a> <input type="text" class="input-text qty text" title="qty" value="'.$value.'" name="quantity" min="1" step="1"> <a href="?add='.$key.'" type="button" class="plus"> <input type="button" class="plus" value="+"> </a>

conditional comments no longer supported of ie 10.

you could utilize meta tag create ie render page in ie9 mode:

<meta http-equiv="x-ua-compatible" content="ie=emulateie9">

then, conditional statements should work again.

please have @ article linked more details.

however, big problem here wrapping inputs in <a> tags. that's invalid syntax, , reason page misbehaving.

javascript html internet-explorer

performance - Website with a lot of Images and very slow -



performance - Website with a lot of Images and very slow -

my website in general has lot of images load. homepage has few images, yet everytime test website through website speed tests, tries load images on entire website. why doesn't load images on home page? why images on subpages seek load on initial home page?

near top of style.css file, have rule apparently preloads 130 images portfolio folder:

body:after { content: url(../images/portfolio/d-b-1-h.png) url(../images/portfolio/d-b-1-bw.png) url(../images/portfolio/d-b-2-h.png) url(../images/portfolio/d-b-2-bw.png) url(../images/portfolio/d-b-3-h.png) url(../images/portfolio/d-b-3-bw.png) url(../images/portfolio/d-b-4-h.png) url(../images/portfolio/d-b-4-bw.png) url(../images/portfolio/d-b-5-h.png) url(../images/portfolio/d-b-5-bw.png) url(../images/portfolio/d-b-6-h.png) url(../images/portfolio/d-b-6-bw.png) url(../images/portfolio/d-b-7-h.png) url(../images/portfolio/d-b-7-bw.png) url(../images/portfolio/d-b-8-h.png) url(../images/portfolio/d-b-8-bw.png) url(../images/portfolio/d-c-1-h.png) url(../images/portfolio/d-c-1-bw.png) url(../images/portfolio/d-c-2-h.png) url(../images/portfolio/d-c-2-bw.png) url(../images/portfolio/d-c-3-h.png) url(../images/portfolio/d-c-3-bw.png) url(../images/portfolio/d-c-4-h.png) url(../images/portfolio/d-c-4-bw.png) url(../images/portfolio/d-c-5-h.png) url(../images/portfolio/d-c-5-bw.png) url(../images/portfolio/d-c-6-h.png) url(../images/portfolio/d-c-6-bw.png) url(../images/portfolio/d-c-7-bw.png) url(../images/portfolio/d-c-7-h.png) url(../images/portfolio/d-c-8-bw.png) url(../images/portfolio/d-c-8-h.png) url(../images/portfolio/d-c-9-bw.png) url(../images/portfolio/d-c-9-h.png) url(../images/portfolio/d-c-10-bw.png) url(../images/portfolio/d-c-10-h.png) url(../images/portfolio/d-c-11-bw.png) url(../images/portfolio/d-c-11-h.png) url(../images/portfolio/d-cs-1-h.png) url(../images/portfolio/d-cs-1-bw.png) url(../images/portfolio/d-cs-2-h.png) url(../images/portfolio/d-cs-2-bw.png) url(../images/portfolio/d-cs-3-h.png) url(../images/portfolio/d-cs-3-bw.png) url(../images/portfolio/d-cs-4-h.png) url(../images/portfolio/d-cs-4-bw.png) url(../images/portfolio/d-cs-5-h.png) url(../images/portfolio/d-cs-5-bw.png) url(../images/portfolio/d-cs-6-h.png) url(../images/portfolio/d-cs-6-bw.png) url(../images/portfolio/d-cs-7-bw.png) url(../images/portfolio/d-cs-7-h.png) url(../images/portfolio/d-p-1-h.png) url(../images/portfolio/d-p-1-bw.png) url(../images/portfolio/d-p-2-h.png) url(../images/portfolio/d-p-2-bw.png) url(../images/portfolio/d-p-3-h.png) url(../images/portfolio/d-p-3-bw.png) url(../images/portfolio/d-p-4-h.png) url(../images/portfolio/d-p-4-bw.png) url(../images/portfolio/d-p-5-h.png) url(../images/portfolio/d-p-5-bw.png) url(../images/portfolio/d-p-6-h.png) url(../images/portfolio/d-p-6-bw.png) url(../images/portfolio/d-p-7-bw.png) url(../images/portfolio/d-p-7-h.png) url(../images/portfolio/d-p-8-bw.png) url(../images/portfolio/d-p-8-h.png) url(../images/portfolio/d-p-9-bw.png) url(../images/portfolio/d-p-9-h.png) url(../images/portfolio/d-p-10-bw.png) url(../images/portfolio/d-p-10-h.png) url(../images/portfolio/d-p-11-bw.png) url(../images/portfolio/d-r-1-h.png) url(../images/portfolio/d-r-1-bw.png) url(../images/portfolio/d-r-2-h.png) url(../images/portfolio/d-r-2-bw.png) url(../images/portfolio/d-r-3-h.png) url(../images/portfolio/d-r-3-bw.png) url(../images/portfolio/d-r-4-h.png) url(../images/portfolio/d-r-4-bw.png) url(../images/portfolio/d-r-5-h.png) url(../images/portfolio/d-r-5-bw.png) url(../images/portfolio/d-r-6-h.png) url(../images/portfolio/d-r-6-bw.png) url(../images/portfolio/d-r-7-bw.png) url(../images/portfolio/d-r-7-h.png) url(../images/portfolio/d-r-8-bw.png) url(../images/portfolio/d-r-8-h.png) url(../images/portfolio/d-r-9-bw.png) url(../images/portfolio/d-r-9-h.png) url(../images/portfolio/d-r-10-bw.png) url(../images/portfolio/d-r-10-h.png) url(../images/portfolio/d-r-11-bw.png) url(../images/portfolio/d-v-1-h.png) url(../images/portfolio/d-v-1-bw.png) url(../images/portfolio/d-v-2-h.png) url(../images/portfolio/d-v-2-bw.png) url(../images/portfolio/d-v-3-h.png) url(../images/portfolio/d-v-3-bw.png) url(../images/portfolio/d-v-4-h.png) url(../images/portfolio/d-v-4-bw.png) url(../images/portfolio/d-v-5-h.png) url(../images/portfolio/d-v-5-bw.png) url(../images/portfolio/d-v-6-h.png) url(../images/portfolio/d-v-6-bw.png) url(../images/portfolio/d-v-7-bw.png) url(../images/portfolio/d-v-7-h.png) url(../images/portfolio/d-w-1-h.png) url(../images/portfolio/d-w-1-bw.png) url(../images/portfolio/d-w-2-h.png) url(../images/portfolio/d-w-2-bw.png) url(../images/portfolio/d-w-3-h.png) url(../images/portfolio/d-w-3-bw.png) url(../images/portfolio/d-w-4-h.png) url(../images/portfolio/d-w-4-bw.png) url(../images/portfolio/d-w-5-h.png) url(../images/portfolio/d-w-5-bw.png) url(../images/portfolio/d-w-6-h.png) url(../images/portfolio/d-w-6-bw.png) url(../images/portfolio/d-w-7-bw.png) url(../images/portfolio/d-w-7-h.png) url(../images/portfolio/m-b-2-bw.png) url(../images/portfolio/m-c-2-bw.png) url(../images/portfolio/m-cs-3-bw.png) url(../images/portfolio/m-cs-5-bw.png) url(../images/portfolio/m-p-3-bw.png) url(../images/portfolio/m-r-3-bw.png) url(../images/portfolio/m-v-2-bw.png) url(../images/portfolio/m-w-3-bw.png); display: none; }

seems should either remove or trim downwards or move portfolio pages isn't loaded unnecessarily.

image performance website

ios - Swift - TableViewController overwriting old data -



ios - Swift - TableViewController overwriting old data -

this situation. when press button move next screen, , @ same time set 2 parameters in tableview. must working masterdetailapplication , strive it. when press button works fine. question is, how that, when press button, info (2 parameters) save in tableview, , when again(press button , 1 time again press go button), new info overwrites old one. want new info wasn't overwrite old data, must above them. code :

parameters.swift import foundation struct parameters { allow topass : string allow topass2: string } secondviewcontroller import uikit class secondviewcontroller: uiviewcontroller { var timer = nstimer() var counter = 0 @iboutlet weak var labelcounter: uilabel! override func viewdidload() { super.viewdidload() navigationitem.hidesbackbutton = true labelcounter.text = string(counter) timer = nstimer.scheduledtimerwithtimeinterval(1,target:self, selector: selector("update"),userinfo: nil, repeats :true) } func update(){ labelcounter.text = string(++counter) if counter == 15 { timer.invalidate() } } override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject!) { allow formatter = nsdateformatter() formatter.dateformat = "yyyy-mm-dd hh:mm:ss" if (segue.identifier == "seguetest") { var transfer = segue.destinationviewcontroller tableviewcontroller transfer.topass = labelcounter.text transfer.topass2 = "\(formatter.stringfromdate(nsdate()))" } } } tableviewcontroller import uikit class tableviewcontroller: uitableviewcontroller { @iboutlet weak var label1: uilabel! var topass: string! var topass2: string! var objects = [parameters]() override func viewdidload() { super.viewdidload() self.objects = [parameters(topass: topass2, topass2: topass)] // self.view.backgroundcolor = uicolor(red :184.0, green: 219.0, blue: 243.0) // self.tableview.registerclass(uitableviewcell.self, forcellreuseidentifier: "cell") // tableview.datasource = self } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } override func numberofsectionsintableview(tableview: uitableview) -> int { homecoming 1 } override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { homecoming self.objects.count } override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { allow cell = tableview.dequeuereusablecellwithidentifier("tablecell", forindexpath: indexpath) uitableviewcell var param : parameters param = objects[indexpath.row] cell.textlabel.text = param.topass cell.detailtextlabel?.text = param.topass2 + " sec" homecoming cell } }

ios uitableview button swift

appdomain - How i can publish a openshift app in tk domain? -



appdomain - How i can publish a openshift app in tk domain? -

i trying register app in openshift, in tk domain using freenom. however, when go "url forwarding" , set url of app "xxxx-xxx.rhcloud.com" have next error:

given url returns 500

i see app running.

any idea

finnally find openshift can't utilize url forwadding.

the alternative utilize cname way. (in dot tk select default name servers , later click on "manage freenom dns"

previously need create alias in openshift, opperation can done in app console web interface, create alias alternative near app web direction.

here link more information:

https://blog.openshift.com/custom-url-names-for-your-paas-applications-host-forwarding-and-cnames-the-openshift-way/

openshift appdomain tk

java - Injected bean becomes null after using AOP -



java - Injected bean becomes null after using AOP -

i using spring4 along spring boot.

before tired utilize aop, bean(commandservice),which used in controller, auto injected well, after tired utilize aop collect debug message, bean becomes null!

here application.java

@configuration @enableautoconfiguration @componentscan({"hello","wodinow.weixin.jaskey"}) public class application extends { public static void main(string[] args) { applicationcontext ctx = springapplication.run(application.class, args); logutil.info("beans provided spring boot:"); string[] beannames = ctx.getbeandefinitionnames(); arrays.sort(beannames); (string beanname : beannames) { logutil.info(beanname); } logutil.info("application boots completes!"); } @bean public commandservice commandservice(){ logutil.debug("commandservice.getinstance()"+ commandservice.getinstance()) ;//here indeed see spring executes , returns object when application boots homecoming commandservice.getinstance();//this returns singleton instance }

}

my controller throws null pointer:

@controller public class corecontroller { @autowired commandservice commandservice;//here service null after using aop //...some request methods }

the aspect added now:

//if comment out these 2 annoations, bean auto injected @aspect @component public class logaspect { @pointcut("execution(* wodinow.weixin.jaskey..*.*(..))") private void debug_log(){}; @around("debug_log()") public void debug(proceedingjoinpoint joinpoint) throws throwable{ logutil.debug("enter "+joinpoint.getsignature()); try{ joinpoint.proceed(); logutil.debug("returns "+joinpoint.getsignature()); } catch(throwable t){ logutil.error(t.getmessage()+"occurs in "+joinpoint.getsignature(),t); throw t; } } }

i new spring, can help me this?

your @componentscan trying resolve , autowire dependencies corecontroller. when tries resolve dependency finds @bean in application class. tries resolve dependency calling application.commandservice(). when method called, sees matching @pointcut , invokes advice method. since @advice not returning anything, callers see nil returned, , that resolution of dependency returned null.

the prepare here alter @around advice homecoming value of invocation.

@around("debug_log()") public object debug(proceedingjoinpoint joinpoint) throws throwable{ logutil.debug("enter "+joinpoint.getsignature()); try{ // homecoming invocation homecoming joinpoint.proceed(); } catch(throwable t){ logutil.debug(t.getmessage()+"occurs in "+joinpoint.getsignature(),t); throw t; } }

java spring spring-mvc spring-boot spring-aop

Handling Up Navigation for an Activity which has mutiple starting point - Android -



Handling Up Navigation for an Activity which has mutiple starting point - Android -

i have 3 activities activity a, b , c. activity c can launched activity , activity b.

now, navigation button on activity c should take me activity started it. since parent activity c dynamic cannot specify parentactivity in activity tag of c within manifest file.

how can handle upnavigation activity parent activity changes ?

edit

the next question similar mine reply made me understand concept correctly. here question

android android-actionbar up-navigation

java - How to read a line of numbers and display the sum? -



java - How to read a line of numbers and display the sum? -

i'm working on programme read whole line of numbers , display sum. must written in java , must simple possible. nil much harder arrays or ever needed create work.

this illustration of want:

please come in numbers space in between each. 12 34 7 93 4 sum of numbers: 150

i have had number of attempts , have got @ moment.

public static void main(string[] args) { scanner kb = new scanner(system.in); int numbers; int total; system.out.println("please come in numbers space between each"); numbers = kb.nextint(); for(int i=args.length; i<numbers; i++) { system.out.println("the sum " + numbers); } }

scanner#nextint reads single int input stream. instead, want read bunch of numbers , start working on them.

i can think on 2 solutions this:

read whole line (using scanner#nextline), split blank space (" ") (using string#split), convert each string int , calculate sum (using integer#parseint).

int total = 0; system.out.println("please come in numbers space between each"); string linewithnumbers = kb.nexline(); string[] numbers = linewithnumbers.split(" "); (string number : numbers) { total += integer.parseint(number); }

read whole line (using scanner#nextline), utilize scanner read integers stored in string , calculate sum.

int total = 0; system.out.println("please come in numbers space between each"); string linewithnumbers = kb.nexline(); scanner linescanner = new scanner(linewithnumbers); while (linescanner.hasnext()) { total += linescanner.nextint(); }

java

elasticsearch - Cannot retrieve a document using GET API -



elasticsearch - Cannot retrieve a document using GET API -

i'm using elasticsearch version 1.2.0

i have documents indexed mass indexing.

when comes search, works fine when utilize _search endpoint document want. however, cannot same document using api.

for example, code snippet below not retrieve result.

curl -xget "http://xxx.xxx.xxx.xxx:9200/my_index/my_type/my_id?pretty"

however, when specify routing value, retrieves right result wanted get.

curl -xget "http://xxx.xxx.xxx.xxx:9200/my_index/my_type/my_id?routing=3&pretty"

here thing want know because i've never used kind of routing settings indexing operation.

and there no parent-child relations "my_type".

could recommend other possible reasons kind of problem?

thanks in advance.

elasticsearch version 1.2.0 has severe bug respect indexing. document recommends upgrade 1.2.1.i think running issue.

elasticsearch

java - Finding Minimum Distance Between Words in An Array -



java - Finding Minimum Distance Between Words in An Array -

example:

worddistancefinder finder = new worddistancefinder(arrays.aslist("the", "quick", "brown", "fox", "quick"));

assert(finder.distance("fox","the") == 3);

assert(finder.distance("quick", "fox") == 1);

i have next solution, appears o(n), i'm not sure if there improve solution out there. have ideas?

string targetstring = "fox"; string targetstring2 = "the"; double mindistance = double.positive_infinity; for(int x = 0; x < strings.length; x++){ if(strings[x].equals(targetstring)){ for(int y = x; y < strings.length; y++){ if(strings[y].equals(targetstring2)) if(mindistance > (y - x)) mindistance = y - x; } for(int y = x; y >=0; y--){ if(strings[y].equals(targetstring2)) if(mindistance > (x - y)) mindistance = x - y; } } }

you solution o(n^2) because traverse whole list when finding each word. first find first word , 1 time again traverse whole list find sec word.

what can utilize 2 variables maintain track of position of each word , calculate distance single pass through list => o(n).

int index1 = -1, index2 = -1; int mindistance = integer.max_value, tempdistance = 0; (int x = 0; x < strings.length; x++) { if (strings[x].equals(targetstring)) { index1 = x; } if (strings[x].equals(targetstring2)) { index2 = x; } if (index1 != -1 && index2 != -1) { // both words have found tempdistance = (int) math.abs(index2 - index1); if (tempdistance < mindistance) { mindistance = tempdistance; } } } system.out.println("distance:\t" + mindistance);

java algorithm

javascript - Where does jquery UI Autocomplete store the ui.conent -



javascript - Where does jquery UI Autocomplete store the ui.conent -

when menu open access ui.content array can't find in object anywhere.

i can find menu code doesn't have elements passed ui.content.

$(selector).data("ui-autocomplete").menu.element[0]

any suggestions. i'd add together items menu after menu has opened.

edit

my question equivalent of ui.content stored when menu open?

from jquery ui doc:

response( event, ui ) type: autocompleteresponse

triggered after search completes, before menu shown. useful local manipulation of suggestion data, custom source alternative callback not required. event triggered when search completes, if menu not shown because there no results or autocomplete disabled.

event type: event

ui type: object

ui.content type: array

contains response info , can modified alter results shown. info normalized, if modify data, create sure include both value , label properties each item. code examples: initialize autocomplete response callback specified:

$( ".selector" ).autocomplete({ response: function( event, ui ) {} });

bind event listener autocompleteresponse event:

$( ".selector" ).on( "autocompleteresponse", function( event, ui ) {} );

so can hold of ui.content in phone call handlers. have @ jquery ui autocomplete api.

javascript jquery jquery-ui jquery-ui-autocomplete

c# - LINQ XML file parsing -



c# - LINQ XML file parsing -

i'm trying parse below xml info values of name , total each metricresponse

<metricresponses xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/xmlschema-instance"> <metricresponse> <code>success</code> <data> <displayname>cpu time</displayname> <endtime>2013-04-16t17:10:37.6101155z</endtime> <name>cputime</name> <primaryaggregationtype>total</primaryaggregationtype> <starttime>2013-04-16t17:00:00z</starttime> <timegrain>pt1h</timegrain> <unit>milliseconds</unit> <values> <metricsample> <count>1</count> <maximum i:nil="true" /> <minimum i:nil="true" /> <timecreated>2013-04-16t17:00:00z</timecreated> <total>390</total> </metricsample> </values> </data> <message /> </metricresponse>

i have written next linq query it:

xnamespace ns = "http://schemas.microsoft.com/windowsazure"; var metrics = b in doc.root.descendants(ns + "metricresponse") select new { name=b.element(ns+"data").element(ns+"name"), total=b.element(ns+"data").element(ns+"values").element(ns+"metricsample").element(ns+"total") };

but when nullreferenceexception when looping through metrics. query works fine getting name value , exception occurs total expression.

c# xml linq

rft - Browser How to maximize the browser automatically while playback -



rft - Browser How to maximize the browser automatically while playback -

how maximize browser automatically while playback web application script in rational functional tester(rational functional tester)?

simply phone call maximize() on browsertestobject:

startapp("google"); browser_htmlbrowser().maximize();

or record click on maximize button, gives you:

browser_htmlbrowser(document_google(),default_flags).maximize();

rft

mobile - iOS app size differnce between testflight and Apple store -



mobile - iOS app size differnce between testflight and Apple store -

ios app build size drastically, when build , testflight 9mb, when approved apple in apple store showing 14mb, can 1 tell/help me, how can possible? wanted understand scene behind it.

note : there no alter in resource files in both builds.

ios mobile build size

javascript - AngularJS ui-router resolve does not return custom value -



javascript - AngularJS ui-router resolve does not return custom value -

when trying resolve info before moving page, forcefulness resolve promise, convert custom object , seek homecoming custom object resolve object.

.state("trip.detail", { url: '/:tripid', templateurl: 'partials/trip/detail.html', controller: 'tripdetailcontroller', resolve: { traindata: function (tripservice, $stateparams, $q) { homecoming tripservice.gettripbyid($stateparams.tripid,function (data) { console.log("received: " + data); homecoming { "relativetrainid": data.trainid, "from": new date(data.departure).toisostring(), "to": new date(data.arrival).toisostring(), "projectid": data.projectid, "istrip": true, "tripid": data.id, "trajectory": data.trajectory, "statistics": data.statistics } }).$promise; } } });

this works, except 'traindata' beingness injected controller actualy value 'data' , not custom 1 create.

what's going on?

extra info tripservice:

services.factory('tripservice', function ($resource) {

function tripservice() { this.tripresource = $resource('rest/trip/:tripid'); } tripservice.prototype.gettrips = function (start, end, project, trainids, callback) { homecoming this.tripsresource.query({ projectid: project, trainids: trainids, from: start, to: end }, callback) } tripservice.prototype.gettripbyid = function (tripid, callback) { homecoming this.tripresource.get({ tripid: tripid }, callback); } homecoming new tripservice();

});

you have create own promise , resolve custom object:

.state("trip.detail", { url: '/:tripid', templateurl: 'partials/trip/detail.html', controller: 'tripdetailcontroller', resolve: { traindata: function (tripservice, $stateparams, $q) { var deferred = $q.defer(); tripservice.gettripbyid($stateparams.tripid,function (data) { console.log("received: " + data); deferred.resolve({ "relativetrainid": data.trainid, "from": new date(data.departure).toisostring(), "to": new date(data.arrival).toisostring(), "projectid": data.projectid, "istrip": true, "tripid": data.id, "trajectory": data.trajectory, "statistics": data.statistics }); }); homecoming deferred.promise; } } });

javascript angularjs

Present italics font in jqgrid column -



Present italics font in jqgrid column -

i inquire you, if possible nowadays contents of specific column in jqgrid table italics font. searched couldn't find anything. there way accomplish ?

thank you.

first of need declare css rule uses class, illustration "myclass":

class="lang-css prettyprint-override">.myclass { font-style: italic; }

then need add together classes: "myclass" property column definition of specific column need have italic text. it's all.

fonts jqgrid italics

java - Representing signed byte in an unsigned byte variable -



java - Representing signed byte in an unsigned byte variable -

i apologies if title of question not clear, cannot figure out best way describe predicament in few words.

i writing communication framework between java , c# using sockets , byte byte transfer of information.

i have ran issue has been confusing me few hours now. know. java's byte base of operations type signed, meaning can store -128 +127 if represent in integer form. c# however, uses unsigned bytes, meaning store 0-255 in integer form.

this encountering issue. if need send bytes of info c# client java server, utilize next code:

c#:

memorystream stream; public void write(byte[] b, int off, int len) { stream.write(b, off, len); }

java:

datainputstream in; public int read(byte[] b, int off, int len) throws ioexception{ in.read(b, off, len)); }

as can see these very similar pieces of code when used within own languages produce predictable results. however, due differences in signing these produce unusable data.

i.e if send 255 c# client java server, receive value of -1 on java server. because both of values represented of these 8 bits: 11111111

preferably in order solve problem need utilize next code, using sbyte, c#'s signed byte.

c#:

memorystream stream; public void write(sbyte[] b, int off, int len) { //code alter sbyte byte keeping in form in java understand stream.write(b, off, len); }

i need store java's representation of signed byte within unsigned c# byte in order send byte across server. need in reverse sbyte out of byte received java server.

i have tried numerous ways in no success. if has thought how can go appreciative.

you don't need except stop thinking bytes numbers. think of them 8 bits, , java , c# identical. it's rare want consider byte magnitude - it's binary info image, or perhaps encoded text.

if want send byte 10100011 across java c# or vice versa, in natural way. bits correct, if byte values different when treat them numbers.

it's not exclusively clear info you're trying propagate, in 99.9% of cases can treat byte[] opaque binary data, , transmit without worrying.

if do need treat bytes magnitudes, need work out range want. it's easier handle java range, c# can back upwards sbyte[]... if want range 0-255, need convert byte int on java side , mask bottom 8 bits:

byte b = ...; int unsigned = b & 0xff;

if need treat byte[] sbyte[] or vice versa on c#, can utilize little secret: though c# doesn't allow convert between two, clr does. need go via conversion of reference object fool c# compiler thinking might valid - otherwise thinks knows best. executes no exceptions:

byte[] x = new byte[] { 255 }; sbyte[] y = (sbyte[]) (object) x; console.writeline(y[0]); // -1

you can convert in other direction in same way.

java c# sockets byte

android - Startactivityforresult() and Don't keep Activity option in phone settings -



android - Startactivityforresult() and Don't keep Activity option in phone settings -

i have came across weird experience , far couldn't find solution , hope here can help me..the issue is, have 2 activities(say activity , activity b) , started activity b activty using startactivityforresult() , before have checked "don't maintain activity option" in phone settings , when finish activity b app crashing , know happening because have checked alternative in settings want know how can overcome issue , best , android recommended way fixing this?

android start-activity

"error: No resource identifier found for attribute 'layout_margintop' in package 'android' " error in android eclipse -



"error: No resource identifier found for attribute 'layout_margintop' in package 'android' " error in android eclipse -

error: no resource identifier found attribute 'layout_margintop' in bundle 'android' error im getting in android eclipse in ubuntu. how prepare this?

i forgot mention have android:layout_margintop="60dp" in code on same xml file still not working

edit- fixed error getting says mpageradapter =new pageradapter(this.getsupportfragmentmanager(), fragments); pageradapter cannot initialised , pageadapter beingness underlined. quick prepare says rename in file dont think works or rename to? help appreciated!

package info.androidhive.slidingmenu; import java.util.list; import java.util.vector; import android.util.log; import android.app.fragment; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.support.v4.view.pageradapter; import android.support.v4.view.viewpager; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; public class findpeoplefragment extends fragmentactivity { private pageradapter mpageradapter; public findpeoplefragment(){} @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.order_form); initialisepaging(); homecoming ; } private void initialisepaging() { // todo auto-generated method stub list<fragment> fragments = new vector<fragment>(); fragments.add(fragment.instantiate(this,order_form2.class.getname())); mpageradapter =new pageradapter(this.getsupportfragmentmanager(), fragments); viewpager pager = (viewpager) findviewbyid(r.id.viewpager); pager.setadapter(mpageradapter); }

}

here xml file

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/list_background_pressed" > <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:layout_marginbottom="16dp" android:layout_marginleft="16dp" android:background="@drawable/layout_bg" android:orientation="vertical" > <android.support.v4.view.viewpager android:id="@+id/viewpager" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <edittext android:id="@+id/edittext1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_margintop="44dp" android:ems="10" android:inputtype="textpersonname" android:hint="@string/first_name" android:background="@drawable/edittext" > <requestfocus /> </edittext> <edittext android:id="@+id/edittext2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_below="@+id/edittext1" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_margintop="10dp" android:ems="10" android:hint="@string/last_name" android:inputtype="textpersonname" android:background="@drawable/edittext" /> <checkbox android:id="@+id/checkbox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/edittext2" android:layout_margintop="10dp" android:text="@string/malebutton" /> <checkbox android:id="@+id/checkbox2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbaseline="@+id/checkbox1" android:layout_alignbottom="@+id/checkbox1" android:layout_marginleft="14dp" android:layout_torightof="@+id/checkbox1" android:text="@string/femalebutton" /> <edittext android:id="@+id/edittext3" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignleft="@+id/edittext2" android:layout_below="@+id/checkbox1" android:layout_margintop="10dp" android:layout_marginright="10dp" android:background="@drawable/edittext" android:ems="10" android:hint="@string/phonenumber" android:inputtype="phone" /> <edittext android:id="@+id/edittext4" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignleft="@+id/edittext3" android:layout_below="@+id/edittext3" android:layout_marginright="10dp" android:layout_margintop="10dp" android:background="@drawable/edittext" android:ems="10" android:inputtype="textemailaddress" android:hint="@string/email_line" /> <edittext android:id="@+id/edittext5" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignleft="@+id/edittext4" android:layout_below="@+id/edittext4" android:layout_marginright="10dp" android:layout_margintop="10dp" android:background="@drawable/edittext" android:ems="10" android:hint="@string/affiliate_id" /> <checkbox android:id="@+id/checkbox3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/edittext5" android:layout_margintop="10dp" android:text="@string/checkbox3" /> <checkbox android:id="@+id/checkbox4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/checkbox3" android:layout_margintop="10dp" android:text="@string/checkbox4" /> </relativelayout> </relativelayout>

breakdown of available arguments android xml layouts:

in = inches on physical screen - not recommended

pt = 1/72 of inch on physical screen

mm = millimeters on physical screen

px = pixels - varies in size because of different screen densities , sizes android devices

dp = dip = density-independant-pixels - best bet cases

sp = dp depends on font size preference

your answer. create android:layout_marginleft="10dp", note number stays same. not appear much on tablet phone. advise on android developer website

for updated question, create sure android:layout_margintop="10dp", case sensitive. if not, create sure these nowadays in first line, , first tag follows

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"

android eclipse tags android-viewpager margin

Zabbix external checks -



Zabbix external checks -

i executing external check returns me: ok 1 2 0 8 (this values alter every check)

does knows how can separate values items?

example:

external check status: ok in use: 1 busy: 2 problem: 0 free: 8

as each 1 of above item.

unfortunately, not possible destructure received string value parts using standard zabbix means item types.

however, items vfs.file.regexp[] back upwards applying regular look , capturing output (see documentation details). in case, write output of script file , create 5 items, approximately follows:

vfs.file.regexp[/tmp/file.txt,^(\w+),,,,\1] vfs.file.regexp[/tmp/file.txt,^\w+ (\w+),,,,\1] vfs.file.regexp[/tmp/file.txt,^\w+ \w+ (\w+),,,,\1] vfs.file.regexp[/tmp/file.txt,^\w+ \w+ \w+ (\w+),,,,\1] vfs.file.regexp[/tmp/file.txt,^\w+ \w+ \w+ \w+ (\w+),,,,\1]

zabbix

ios - Objective-C add navigationbar to rootview -



ios - Objective-C add navigationbar to rootview -

i have simple question lib xlforms.

https://github.com/mtnbarreto/xlform

how can add together uinavigationbar viewcontroller using forms?

does have example?

here code init method of view

http://pastebin.com/p1q5qqjd

try this...

uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:<your view controller>] [self.window setrootviewcontroller:navigationcontroller];

ios objective-c uinavigationcontroller xlform

hibernate - force database connections to re-connect -



hibernate - force database connections to re-connect -

i'm using hibernate c3p0 connection pooling.

the problem we're facing periodically perform database upgrades not take effect active connections - hence running applications need purge open connections , re-connect.

i know there maxage connections in c3p0, don't think wise set value less 30 seconds.

is there mechanism can tell applications disconnect/reconnect immediately?

i'm not sure how maybe test query leveraged?

ideas welcome.

p.

c3p0 pooleddatasources offer hardreset() method , series of softreset methods, replace connections in pools new connections. see

http://www.mchange.com/projects/c3p0/apidocs/com/mchange/v2/c3p0/pooleddatasource.html

hardreset() sure , , disruptive: close() connections under clients in pools datasource manages.

softreset gentler: can reset single pool if wish, , connections aren't close()ed out beneath clients, clients may go on utilize them , quietly discarded rather returned pool.

[note 1 c3p0 datasource may manage multiple pools if have called getconnection( user, password ), getconnection(). connections authenticated different users must segregated different pools.]

in likelihood you'll want phone call softresetallusers(). cast c3p0 datasource pooleddatasource (in com.mchange.v2.c3p0) , phone call method.

hibernate c3p0

How to use SQL Server 2005 Pivot based on lookup table -



How to use SQL Server 2005 Pivot based on lookup table -

table [status] has next data:

id status 1 paymentpending 2 pending 3 paid 4 cancelled 5 error

====================================

data table has next structure:

id weeknumber statusid 1 1 1 2 1 2 3 1 3 4 2 1 5 2 2 6 2 2 7 2 3

looking pivot

week # paymentpending pending paid cancelled week 1 1 1 1 0 week 2 1 2 1 0

a pivot might this:

select * (select 'week ' + cast(d.weeknumber varchar(2)) [week #], s.status datatbl d inner bring together status s on d.statusid = s.id ) derived pivot ( count(status) status in ([paymentpending], [pending], [paid], [cancelled]) -- add together [error] if needed ) pvt

if expect number of items in thestatustable alter might want consider using dynamic pivot generate column headings. this:

declare @sql nvarchar(max) declare @cols nvarchar(max) select @cols = isnull(@cols + ',','') + quotename(status) (select id, status status) statuses order id set @sql = n'select * (select ''week '' + cast(d.weeknumber varchar(2)) [week #], s.status datatbl d inner bring together status s on d.statusid = s.id) q pivot ( count(status) status in (' + @cols + ') ) pvt' exec sp_executesql @sql;

sample sql fiddle

sql sql-server sql-server-2005 pivot

c++ - Is there a way to assign a name to a singleton in the local scope? -



c++ - Is there a way to assign a name to a singleton in the local scope? -

i have method returns singleton.

// window.h static window &getsingleton(); // window.cpp window &window::getsingleton() { static window singleton; homecoming singleton; }

coming objective-c i'm used assigning singletons local scope variable names, example.

uiapplication *application = [uiapplication sharedapplication];

but doing similar thing in c++ causes new object created.

window window = window::getsingleton();

this happens because re-create constructor called, in case window(window const &windowcopy).

is there way around this, or have phone call singleton method when need interact it?

in c++,

window window = <some expression>

means along lines of "construct object of type window value of <some expression>. window::getsingleton() evaluates lvalue reference window, , used initialize new window object (except fact window not re-create constructable.)

what need refer static object created in window::getsingleton() function. function returns reference. need utilize reference window on lhs:

window& window = window::getsingleton(); ^

c++ singleton

How to find the node that holds the minimum element in a binary tree in Haskell? -



How to find the node that holds the minimum element in a binary tree in Haskell? -

i'm trying solve similar problem (find shortest list in tree of lists) , think solving problem start.

given info type like

data (ord a, eq a) => tree = nil | node (tree a) (tree a)

how find node holds minimum element in binary tree above? please not not binary search tree.

i'm trying think recursively: minimum minimum between left, right subtrees , current value. however, i'm struggling translate haskell code. 1 of problems facing want homecoming tree , not value.

here's hint:

you can start defining, auxiliary function, minimum between 2 trees. nodes compared according ther value, ignoring subtrees, , comparing nil tree t makes t minimum (in sense, think of nil "largest" tree). coding can done cases:

binarymin :: ord => tree -> tree -> tree binarymin nil t = t binarymin t nil = t binarymin (node l1 v1 r1) (node l2 v2 r2) = ???

then, minimum subtree follows recursion, exploiting binarymin:

treemin :: ord => tree -> tree treemin nil = nil treemin (node left value right) = ??? l = treemin left r = treemin right

haskell tree

mongodb - How to properly build a query that filters what I need in mongo -



mongodb - How to properly build a query that filters what I need in mongo -

i tried understand syntax of mongo commands.

i have arrays this:

class="lang-js prettyprint-override">{ "_id" : objectid("5404506df59600af7d285692"), "leagues" : [{ "name" : "nami's marksmen", "tier" : "platinum", "queue" : "ranked_solo_5x5", "entries" : [{ "playerorteamid" : "23712130", "playerorteamname" : "woodyx", "division" : "v", "leaguepoints" : numberlong(56), "wins" : numberlong(83), "ishotstreak" : false, "isveteran" : false, "isfreshblood" : false, "isinactive" : false, "miniseries" : false }], "id" : numberlong(23712130) }, { "name" : "ziggs's redeemers", "tier" : "silver", "queue" : "ranked_team_5x5", "entries" : [{ "playerorteamid" : "team-24f25974-63de-402a-a78f-bb7811f3b362", "playerorteamname" : "ragedeinstall", "division" : "ii", "leaguepoints" : numberlong(58), "wins" : numberlong(7), "ishotstreak" : false, "isveteran" : false, "isfreshblood" : false, "isinactive" : true, "miniseries" : false }], "id" : numberlong(23712130) }, { "name" : "heimerdinger's archons", "tier" : "bronze", "queue" : "ranked_team_3x3", "entries" : [{ "playerorteamid" : "team-b8dbeb70-83b0-11e3-b41c-782bcb497d6f", "playerorteamname" : "h fettarme vollmilch", "division" : "i", "leaguepoints" : numberlong(75), "wins" : numberlong(4), "ishotstreak" : false, "isveteran" : false, "isfreshblood" : false, "isinactive" : true, "miniseries" : false }], "id" : numberlong(23712130) }], "summonerid" : numberlong(23712130), "region" : "euw", "updatedat" : numberlong(1413521614) }

thats first document database. collection contains 100k documents these. these documents want next documents return: leagues.tier : platinum, master, diamond , challenger (there no or involved, and). , leagues.queue : ranked_solo_5x5. documents match query should returned front end end of client (i utilize mongovue). tried utilize didnt work.

class="lang-js prettyprint-override">{ leagues: { $elemmatch: { tier: "platinum", queue: "ranked_solo_5x5"}}}

because returning other 'league.queue' values too, while should returning platinum , ranked_solo_5x5. new criteria is: leagues.tier : "challenger", "master", "diamond", "platinum" , leagues.queue : "ranked_solo_5x5".

wanted illustration output:

class="lang-js prettyprint-override">{ "_id" : objectid("5404506df59600af7d285692"), "leagues" : [{ "name" : "nami's marksmen", "tier" : "platinum", "queue" : "ranked_solo_5x5", "entries" : [{ "playerorteamid" : "23712130", "playerorteamname" : "woodyx", "division" : "v", "leaguepoints" : numberlong(56), "wins" : numberlong(83), "ishotstreak" : false, "isveteran" : false, "isfreshblood" : false, "isinactive" : false, "miniseries" : false }], "id" : numberlong(23712130) }

to retrieve first matched element within array, can utilize $ positional operator in projection document of find query. example:

class="lang-js prettyprint-override">db.collection.find( // query criteria { leagues: { $elemmatch: { tier: "platinum", queue: "ranked_solo_5x5"}}}, // projection - first matching element within 'leagues' {"leagues.$": 1} )

however, if multiple elements within array satisfy query criteria, above query not help. in such cases, you'll want explore aggregation framework, provides way de-normalize array using $unwind operator, handy. example:

class="lang-js prettyprint-override">db.collection.aggregate([ // split array elements separate documents {"$unwind": "$leagues"}, // specify query criteria {"$match": {"leagues.tier": "platinum", "leagues.queue": "ranked_solo_5x5"}}, // grouping id , reconstruct array {"$group": {"_id": "$_id", "leagues": {"$push":"$leagues"}}} ])

mongodb aggregation-framework

html5 - stop keyboard from shifting app up and enabling scroll in IOS 7/8 -



html5 - stop keyboard from shifting app up and enabling scroll in IOS 7/8 -

we have app fixed width , height , not allow user scroll. part of app have navbar fixed screen under status area. works great.

the problem when keyboard shown, shifts our app window create room keyboard. @ point possible scroll our app , titlebar should fixed top no longer on screen.

ideally keyboard still show, our app window resize not tall, items fixed top still fixed top. also, should not able scroll window @ point.

so sani mentioned in comment iconic keyboard plugin in fact i'm looking for:

https://github.com/driftyco/ionic-plugins-keyboard

using:

cordova.plugins.keyboard.disablescroll(true); cordova.plugins.keyboard.hidekeyboardaccessorybar(true);

ios html5 cordova keyboard

java - Why is this jump() method for a sprite not working? -



java - Why is this jump() method for a sprite not working? -

my game has 2 classes right now, "mygdxgame" , "player". i've added method jump() player class , overridden touchdown() method phone call jump every time screen tapped:

public void jump() { starttime = timeutils.nanotime(); elapsedtime = timeutils.timesincenanos(starttime); boolean jumptime = elapsedtime < 2000000001; while (jumptime) { moveby(xspeed, yspeed); } moveby(xspeed, -yspeed); } @override public boolean touchdown(int screenx, int screeny, int pointer, int button) { //moveby(xspeed, yspeed); jump(); homecoming true; }

right when screen tapped sprite goes doesn't come down. before screen tapped sprite moving left right @ constant speed xspeed. ideas?

edit: built project ran again. freezes when tap screen crashes lol

the boolean jumptime never getting updated within while loop in jump() method.

try:

starttime = timeutils.nanotime(); long jumptime= 2000000001; while (timeutils.timesincenanos(starttime) < jumptime) { moveby(xspeed, yspeed); } moveby(xspeed, -yspeed);

java android libgdx sprite

VBA code to copy a file n number of times -



VBA code to copy a file n number of times -

i want re-create file , write usb 30 times. code follows

sub test() dim fso object set fso = createobject("scripting.filesystemobject") = 1 30 fso.copyfile "system_path", "usb_path", false next end sub

my problem if set overwrite field false, error 'file exists'. if set true(or leave field blank), file copied once. how can re-create , write same file n number of times. in advance.

vba copy-paste

Method calculations/arguments in Java -



Method calculations/arguments in Java -

i have create virtual coffee shop user enters order number, how many of order want, calculate subtotal , discount, etc. whole point of process's divided various methods. of methods pretty simple, i'm having problem computesubtotal method. have initialize subtotal in main method create work, when subtotal's calculated in computesubtotal, ends beingness zero. sorry if seems stupid, have no thought i'm doing wrong, help?

import java.util.scanner; public class coffeeshopwithmethods { public static void main(string[] args) { scanner user_input = new scanner (system.in); string user_name; system.out.print("\nplease come in name: "); user_name = user_input.next(); system.out.println("\nwelcome java byte code coffee shop, " + user_name + "!"); int ordernumber = 0; int orderquan = 0; double subtotal = 0.0; //beginning of calls methods displaymenu(); getitemnumber(ordernumber); getquantity(orderquan); computesubtotal(ordernumber, orderquan, subtotal); discountcheck(subtotal); } public static void displaymenu() { system.out.println("\nhere our menu: \n" + "\n 1. coffee $1.50" + "\n 2. latte $3.50" + "\n 3. cappuccino $3.25" + "\n 4. espresso $2.00"); } public static int getitemnumber(int ordernumber) //prompts user item number (1 coffee, 2 latte, etc...) { scanner user_input = new scanner(system.in); system.out.print("\nplease come in item number: "); ordernumber = user_input.nextint(); final double coffee = 1.50; final double latte = 3.50; final double cappuccino = 3.25; final double espresso = 2.00; double cost = 0; if (ordernumber == 1) cost = coffee; if (ordernumber == 2) cost = latte; if (ordernumber == 3) cost = cappuccino; if (ordernumber == 4) cost = espresso; homecoming ordernumber; } public static int getquantity(int orderquan) { scanner user_input = new scanner(system.in); system.out.print("\nplease come in quantity: "); orderquan = user_input.nextint(); homecoming orderquan; } public static double computesubtotal(int ordernumber, int orderquan, double subtotal) { subtotal = (ordernumber * orderquan); system.out.print("your total before discount , taxation is: $" + subtotal); homecoming subtotal; } public static boolean discountcheck(double subtotal) //takes subtotal , returns true if user earned discount (over $10) { if (subtotal >= 10.00) homecoming true; else homecoming false; } }

your methods getitemnumber, getquantity, computesubtotal , discountcheck homecoming value, not storing homecoming value in main method.

in add-on that, getitemnumber() method storing cost locally, discarded when method finished - cost should returned (and method renamed).

you should have this:

//beginning of calls methods displaymenu(); double itemcost = getitemcost(); // getitemnumber() orderquan = getquantity(orderquan); subtotal = computesubtotal(itemcost, orderquan); boolean shoulddiscount = discountcheck(subtotal);

of course, utilize object-oriented approach, variables should members of class, wouldn't need pass or homecoming values - accessible methods in class.

java methods

ios - Force autocorrect on a UITextField -



ios - Force autocorrect on a UITextField -

i have specific uitextfield have autocorrect in though user's default off.

is possible? or user's setting wins on control?

ios uitextfield autocorrect

java - WebApplicationInitializer not reached -



java - WebApplicationInitializer not reached -

i'm building blogpost school project spring. can reach index.jsp when map other controllers 404. when set breakpoint in webapplicationinitializer in @onstartup method never gets reached. know i'm missing here? thanks!

here's code:

webapplicationinitializer:

public class initializer implements webapplicationinitializer{ @override public void onstartup(servletcontext servletcontext) throws servletexception { webapplicationcontext dispatchercontext = getcontext(); servletcontext.addlistener(new contextloaderlistener(dispatchercontext)); servletregistration.dynamic servlet = servletcontext.addservlet("dispatcher", new dispatcherservlet(dispatchercontext)); servlet.addmapping("/"); servlet.setloadonstartup(1); } private webapplicationcontext getcontext(){ annotationconfigwebapplicationcontext context = new annotationconfigwebapplicationcontext(); context.setconfiglocation("be.kdg.blogpostspringmvc.configuration"); homecoming context; } }

pom.xml:

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>be.kdg.blogpostwebapp</groupid> <artifactid>blogpostwebapp</artifactid> <version>1.0-snapshot</version> <dependencies> <dependency> <groupid>be.kdg.spring.blogpost</groupid> <artifactid>blogpost</artifactid> <version>1.0-snapshot</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> <version>4.1.1.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-webmvc</artifactid> <version>4.1.1.release</version> </dependency> <dependency> <groupid>javax</groupid> <artifactid>javaee-web-api</artifactid> <version>7.0</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>javax.servlet-api</artifactid> <version>3.1.0</version> </dependency> </dependencies>

and pom.xml of injected blogpost:

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>be.kdg.spring.blogpost</groupid> <artifactid>blogpost</artifactid> <version>1.0-snapshot</version> <dependencies> <dependency> <groupid>cglib</groupid> <artifactid>cglib</artifactid> <version>3.1</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>4.1.1.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>4.1.1.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-test</artifactid> <version>4.1.1.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-beans</artifactid> <version>4.1.1.release</version> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.11</version> </dependency> </dependencies>

change context.setconfiglocation("be.kdg.blogpostspringmvc.configuration") context.scan("be.kdg.blogpostspringmvc.configuration").

setconfiglocation() used specify location of spring configuration file.

java spring maven spring-mvc

mysql - How to optmize query with subqueries,WHERE IN and varchar comparison fields? -



mysql - How to optmize query with subqueries,WHERE IN and varchar comparison fields? -

i working on scraping project crawl items , view counts on different schedules.schedule user defined period (date) when script intended run.

table construction follows:

create table if not exists `stats` ( `id` int(11) not null auto_increment, `schedule_id` smallint(11) not null, `type` smallint(11) not null, `name` varchar(250) collate utf8_unicode_ci not null, `views` int(11) not null, `updated_time` timestamp not null default current_timestamp on update current_timestamp, primary key (`id`) ) engine=myisam default charset=utf8 collate=utf8_unicode_ci ;

all info stored in table stats , later analyzed see type wise growth in views.

the info like:

sample set

the scraping done on periods , each schedule expected have 20k entries.the schedules made in daily or weekly basis,hence info grow be around 2-3 1000000 in 5-6 months.

over info need perform queries aggregate same name come across selected range of schedules.

for example:

i need aggregate same items(name) come across multiple schedules. if schedule 1 , 2 selected,items come under both of schedules selected.so here itema , itemb.

the type-wise sum of views should calculated here.

hence schedule 1:(updated)

select count(t.`type`) count, sum(t.views) view_count `stats` t inner bring together ( select name,count(name) c `stats` `schedule_id` in (1,2) grouping name having c=2 ) t2 on t2.`name` = t.`name` `schedule_id`=2 grouping type

this expected result.

but have read using sub queries,where in, varchar comparing fields won't help in having optimized query.how optimized improve performance.

the rules same type aggregator follows:

1.under schedule id, there same names different type value.combination of schedule_id,name , type won't duplicated.

2.type wise aggregator -which sums values under each type made.

i doing project in python -mysql scraping purpose , php listing results.i know how organize table query improve performance. please advice.

varchar column

as said in comment, practice store varchars in dictionary table. why? require more space illustration int4 , having larger , larger table take more space, while each name can stored 1 time in table.

query performance

where in means planner compare schedule_id any'{1,2}' converted integer[] type can notice downwards below.

subqueries

you can not avoid subqueries, if need aggregate data. having in mind, please remember not queries consist of 1 select statement. in reality, (unless have application has it's tiny part connected database, illustration simple game need store info containing users , points)

query

your query plan on given sample data:

select count(type), sum(views) tmp_test8 bring together (select name,count(1) tmp_test8 schedule_id in (1,2) grouping 1 having count(1) = 2) b on a.name = b.name schedule_id = 1; query plan ------------------------------------------------------------------------------ aggregate (cost=23.59..23.60 rows=1 width=8) -> nested loop (cost=11.77..23.59 rows=1 width=8) bring together filter: ((a.name)::text = (tmp_test8.name)::text) -> seq scan on tmp_test8 (cost=0.00..11.75 rows=1 width=524) filter: (schedule_id = 1) -> hashaggregate (cost=11.77..11.79 rows=2 width=516) filter: (count(1) = 2) -> seq scan on tmp_test8 (cost=0.00..11.75 rows=2 width=516) filter: (schedule_id = ('{1,2}'::integer[]))

though, query rewritten without joins , scan table once. suggestion:

select count, sum(view_count) from( select name, count(1) count, sum(case when schedule_id = 1 views end) view_count tmp_test8 schedule_id in (1,2) grouping 1 having count(1) = 2 ) foo grouping 1 query plan ------------------------------------------------------------------------ hashaggregate (cost=11.83..11.85 rows=2 width=16) -> hashaggregate (cost=11.78..11.80 rows=2 width=524) filter: (count(1) = 2) -> seq scan on tmp_test8 (cost=0.00..11.75 rows=2 width=524) filter: (schedule_id = ('{1,2}'::integer[]))

both queries produce same result.

mysql sql subquery query-optimization

html - how to Load CSS dynamically -



html - how to Load CSS dynamically -

in mvc application want apply themes. so, trying load css files bundleconfig beingness initialized in global.asax on app.start method() like

bundleconfig.registerbundles(bundletable.bundles);

however, want load css dynamically alter display style(theme) of page on drop downwards list or link button.

how can ? have tried write in basecontroller , there phone call 'registerbundles' method not working.

any help on appreciated.

a solution dynamic css link theme css entry in markup mvc controller action, passing in theme/customer id, e.q.:

<link rel="stylesheet/less" type="text/css" href='@url.action("themecss","render", new { id = model.accountid})' />

and themecss action method homecoming content so:

[httpget] [outputcache(nostore = true, duration = 0, varybyparam = "none")] public actionresult themecss(int id) //accountid { business relationship account = db.getinstance().accounts.firstordefault(a => a.accountid == id); accountsite site = account.accountsite; string col1, col2, col3, col4; if (site.theme == null) //custom colour theme { col1 = site.themecolour1; col2 = site.themecolour2; col3 = site.themecolour3; col4 = site.themecolour4; } else { col1 = site.theme.primarycolour.substring(1); col2 = site.theme.secondarycolour.substring(1); col3 = site.theme.othercolours.split(',')[0].substring(1); col4 = site.theme.othercolours.split(',')[1].substring(1); } string lessfile = "custom"; string less = system.io.file.readalltext(server.mappath("~/content/render/themes/" + lessfile + ".less")); less = regex.replace(less, @"(\d){6}", delegate(match match) { switch (match.groups[1].value) { case "1": homecoming col1 ?? "e6e6e6"; case "2": homecoming col2 ?? "b1b1b1"; case "3": homecoming col3 ?? "333333"; default: //case "4": homecoming col4 ?? "ffffff"; } }); homecoming new contentresult() { content = less, contenttype = "text/css" }; }

the downside of solution compared bundling lose out on css minification. if theme going fixed per accountid optimise caching changing outputcache attribute vary id parameter.

html css asp.net-mvc