Posts

Showing posts from June, 2015

css - What goes wrong when a display:inline custom element contains display:block elements? -

i'm building custom element mark examples (play @ http://jsbin.com/kiboxuca/1/edit ): <script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.2.0/platform.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.2.0/polymer.js"></script> <polymer-element name="my-example" noscript> <template> <style> :host { display: inline } </style> [ <em>example:</em> <content></content> — <em>end example</em> ] </template> </polymer-element> <div> text <my-example>introduction <pre>some code here</pre> more example</my-example> </div> this produces appearance want: some text [ example: introduction some code here more example — end example ] however, because makes <my-example> element display:inline i'm worried block-level <pre> element going

Can programs be written with JavaScript that run Windows 8 terminal commands when a gui button is clicked? -

i know windows 8 'apps' can developed using web technologies haven't been able find out if terminal commands can run in background using web technologies interface. have mongodb on computer , takes 2 terminal windows open run it. thought might neat project see if write little app nothing more button launches both commands behind scenes saving me hassle of going directories , running commands manually both terminal windows. you won't able client-side javascript. browsers put lot of effort not offering facilities arbitrary code execution. have simple problem outside domain of expertise; rather shoehorning you're more comfortable with, try looking other people in similar circumstances. check mongodb documentation. without knowing running mongodb on windows, 1 approach write batch file containing commands need execute (if take ownership of terminal , don't give back, see if accept "server" or "daemon" option). if you're dead

annotations - Auto Increment A Column With Hibernate -

i have situation need increment non primary key column upon insert of every new record. column not primary key. has unique constraint. how can use hibernate annotations accomplish auto increment of particular column? know can done quite primary keys, want same thing done non primary key column (meaning without using @id annotation?) --thanks as far can see, can use hibernate specific annotation @generated . field this: @generated(value="generationtime.insert") @genericgenerator(name="fieldgenerator", strategy="sequence") private x field; you can read different types of strategies here . i'm 90% sure should work. if doesn't let me know.

javascript - How to use a multi-variable string in the name of a variable in pure js -

i'm huge js nub , still getting used syntactical nuances. essentially, i'm looking reduce following single line: if (player==1) {variable1[arrayposition] = thisvalue;} if (player==2) {variable2[arrayposition] = thisvalue;} you can use ternary operator define "variable" use and, assuming array position , value same use on 1 line: (player === 1 ? variable1 : variable2)[arrayposition] = thisvalue; i assuming player can equal 1 or 2 . if have to, should null check or check other values, should elsewhere or additionally.

load - shift register in vhdl -

i trying take 18 bit parallel load , change 9 2 bit outputs using shift register in vhdl. have come following code unsure of if thinking correctly. architecture rtl of x signal two_shifter : std_logic_vector(1 downto 0); signal load_data : std_logic; signal shift_enable : std_logic; begin --parallel serial shifter-- shifter: process(clk, reset) begin if (reset = '1') two_shifter <= "00"; elsif rising_edge(clk) if (load_data = '1') two_shifter <= data_in; elsif (shift_enable = '1') two_shifter <= '0' & two_shifter(1); end if; end if; end process shifter; output_reg: process(clk, reset) begin if (reset = '1') data_out <= '0'; elsif rising_edge(clk) data_out <= two_shifter(0); end if; end process output_reg; --serial parallel shifter-- input_reg: process(clk, reset) begin if (reset = '1') two_shifter <= &qu

objective c - Does userInteractionEnabled property work correctly on SpriteKit nodes? -

i have following simple code: // // bgmyscene.m // test1 // // created andrewshmig on 3/10/14. // copyright (c) 2014 bleeding games. rights reserved. // #import "bgmyscene.h" @implementation bgmyscene - (id)initwithsize:(cgsize)size { if (self = [super initwithsize:size]) { /* setup scene here */ self.backgroundcolor = [skcolor colorwithred:0.15 green:0.15 blue:0.3 alpha:1.0]; // first label sklabelnode *mylabel = [sklabelnode labelnodewithfontnamed:@"chalkduster"]; // mylabel.userinteractionenabled = yes; mylabel.text = @"hello, world!"; mylabel.fontsize = 30; mylabel.position = cgpointmake(cgrectgetmidx(self.frame), cgrectgetmidy(self.frame)); [self addchild:mylabel]; // second label

Start jenkins in the background -

i'm using .war file run jenkins on server. use java -jar jenkins.war (source: https://wiki.jenkins-ci.org/display/jenkins/starting+and+accessing+jenkins ) start server. starts server , shows log on screen , ready use. the problem when "ctrl+c" stops server. want should start in background though exit putty should running. know if use native package ".deb" installed service want using ".war" file , not native package ".deb". possible? just put process in background suggested @keepcalmandcarryon. nohup java -jar jenkins.war & i hope helps.

Python: Multithreading using join and Queue sometimes blocks forever -

my code follows: def predutycyclesolve(self, proccount): z = self.crystal.z #d1 = np.empty(len(z)) #d2 = np.empty(len(z)) d1d2q = multiprocessing.queue() procs = [] proc in range(proccount): p = multiprocessing.process(target=self.dutycyclesolve, args=(proc, z[proc::proccount], d1d2q)) procs.append(p) proc in procs: proc.start() proc in procs: proc.join() while d1d2q.empty() false: x = d1d2q.get() print x i have function, dutycyclesolve , divided , run (in case, 4 processes). issue is, depending on length of array, z, sometimes, code gets stuck , never proceeds past proc.join . i've verified (by printing text in self.dutycyclesolve self.dutycyclesolve returns , process exits function. it appears exits function, , (sometimes) gets stuck @ join . any ideas why?

Calculating factorials in Java and printing the steps -

the following java code calculates factorial of given number , prints intermediate steps. public class factorial { public static int getfactorial(int number) { int n = number; int factorial = 1; while(n > 1) { factorial *= n; n--; system.out.println(factorial + " * " + n + " = " + factorial); } return factorial; } } when method called: factorial.getfactorial(4); should print console following: 4 * 3 = 12 12 * 2 = 24 24 * 1 = 24 but instead prints following: 4 * 3 = 4 12 * 2 = 12 24 * 1 = 24 what doing wrong? that happening because you're printing factorial variable only. replace: system.out.println(factorial + " * " + n + " = " + factorial); with: system.out.println(factorial + " * " + n + " = " + factorial * n);

jquery - How to know whether solr server is running or not -

i've got problem can't solve. partly because can't explain right terms. i'm new sorry clumsy question. below can see overview of goal. i'm using magento ce 1.7.0.2 & solr 4.6.0. var url1 ="http://127.0.0.1:8080/solr/select?q=iphon&wt=json&json.wrf=?"; $.getjson(url1,function(result){ // logic }); when solr server running means script working fine.but if solr server not running means it'll not work. but goal write script this... if( solr server running){ var url1 ="http://127.0.0.1:8080/solr/select?q=iphon&wt=json&json.wrf=?"; $.getjson(url1,function(result){ // logic-1 }); }else{ // logic-2 } so how know whether solr server running or not ? & know duplicate question never find solution please ignore it. any ideas ? don't know how solr works, proper jquery be: $.ajax({ type: "get", url: "http://127.0.0.1:8080/solr/select?q=iphon&wt=jso

javascript - Change jQuery elements into div? -

how change window in window.changecolour call division id instead of window? thanks window.changecolour = function(value) { switch(value) { case 'b': color = "#ff0000"; break; case 'r': color = "#0000ff"; break; case 'p': color = "#ff00ff"; break; } document.body.style.backgroundcolor = color; } here html: <div id= "genre"> <br><br> <p> <input type="radio" name="music" value="radio" onclick="changecolour('b')">blues <br> <input type="radio" name="music" value="radio" onclick="changecolour('r')">rock <br> <input type="radio" name="music" value="radio" onclick="changecolour('p')&quo

python - wxpython can't capture EVT_KEY_DOWN enent -

i can't capture evt_key_down event. can capture evt_key_up. python version : 2.7.3 wxpython version : 2.8.12.1 (gtk2-unicode) system info: mint 14 nadia , linux 3.5.0-17-generic(x86_64) following code #!/usr/bin/env python import sys, os import wx class winframe(wx.frame): def __init__(self, parent, title): super(winframe, self).__init__(parent, title=title, size=(400,400)) self.panel = wx.panel(self,-1, size=(400,400)) self.panel.bind(wx.evt_key_down, self.onkeydown) self.panel.bind(wx.evt_key_up, self.onkeyup) def onkeyup(self, event): print 'up' def onkeydown(self, event): print 'down' class picsampleapp(wx.app): def __init__(self): super(picsampleapp, self).__init__(0) def createframe(self): self.frame = winframe(none, "test") self.frame.show(true) self.se

PHP/SQL cannot get the value of a field name containing a forward slash -

i have field named role/position problem cannot call using code: $sqlposition = "select distinct `role/position` document `typeid`='$row2->typeid' , `appid`='$id1' "; $resultposition = mysql_query($sqlposition, $con); while ($rowposition = mysql_fetch_object($resultposition)){ echo $rowposition->role/position; } i error dividing zero. if use backticks, curly brackets, or combination thereof, still not work. should use call field? you can use mysql_fetch_array instead of mysql_fetch_object like while ($rowposition = mysql_fetch_array($resultposition)){ echo $rowposition['role/position']; } and please follow mysql rules while creating fields.look link

android - Gridview adapter from custom folder in sdcard -

i m currenly using nhaarman gridview , want bitmap custom folder. gridview in fragment , pull image "test" folder , show it. emulator able run code, not in real phone. please help. thanks. @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.activity_home_fragment_month, container, false); gridview gridview = (gridview) view.findviewbyid(r.id.activity_gridview_gv); //--------------------------------------------------------------------------- file = new file(environment.getexternalstoragedirectory() + file.separator + "test"); // check sd card if (!environment.getexternalstoragestate().equals( environment.media_mounted)) { toast.maketext(getactivity(), "error! no sdcard found!", toast.length_long) .show(); } else { if(file.exists()==false){ // locate image f

android - Is there any way to send some data from my application e.g. quiz results -

for example application contains quiz , want know results each user installed app. there way collect these stats? yes. use example parse library. https://parse.com/docs/android_guide . it's easy set up. when have set , read guide, you'll able save data easily. had mine in five, ten minutes , can save complex data. the upside of using cloud based solution (parse cloud based) of course won't need own backend (server , database). won't have code backend script/servlet either.

c# - Serialise JSON color hex without quotes -

so sending values javascript array. array called data, has 2 elements, value , color, example: var data = [{value:226,color:&quot;#fffff&quot;},{value:257,color:&quot;#fffff&quot;}]; the problem color should color: #fffff without &quot surrounding. c# follows: [jsonobject(memberserialization.optin)] public class statsvalues { [jsonproperty] public int value { get; set; } [jsonproperty] public string color { get; set; } } var values = new list<studentbrandsapp.models.statsvalues>(); foreach (datarow dr in statsdatatable.rows) { values.add(new studentbrandsapp.models.statsvalues() { value = convert.toint32(dr.itemarray[1].tostring()), color = "#fffff" }); } var serializer = new jsonserializer(); var stringwriter = new stringwriter(); var writer = new jsontextwriter(stringwriter); writer.quotename = false; serializer.serialize(writer, values); writer.close(); var jso

html - input type range css - background color -

Image
this question has answer here: how style html5 range input have different color before , after slider? 6 answers i want customize <input type="range"> using css. result want achieve this: but following code gives me this this code: input[type='range'] { border-radius: 5px; height: 6px; vertical-align: middle; -webkit-appearance: none; } input[type="range"]::-moz-focus-inner:focus{ border : 0px; outline: 0; } input[type='range']::-moz-range-track { border-radius: 5px; background-color: #e71d49; height: 6px; border: 1px dotted transparent !important; } input[type='range']::-webkit-slider-thumb { border-radius: 20px; background-color: #fff; border:none; box-shadow: 0 5px #000; height: 5px; width: 5px; } input[type='range']::-moz-range-

java - getDeclaredConstructors() lists 2 constructors but there is only one -

given little pice of code: import java.util.arrays; public class sample { private final int test; private sample(int test) { this.test = test; } public static void main(string[] args) { system.out.println(arrays.tostring(hello.class.getdeclaredconstructors())); } public static class hello { private final int i; private hello(int i) { this.i = i; } public int geti() { return i; } public static class builder { private int i; private builder() { } public static builder builder() { return new builder(); } public void add(int i) { this.i = i; } public hello build() { return new hello(i); } } } } i don't understand output shown: [private sample$hello(int), sample$hello(int,sample$1)] what

jquery - No place enough for my popup -

Image
i have popup works except pointer not point @ location: it seems due lack of place. know workaround ? pointer @ middle of popup side ? don't want change placement of popup ( data-placement="bottom" ). >>jsfiddle<< : <table style="width:300px"> <tr> <td><a href="#" data-toggle="popover" data-content="jill kiwi<img src='http://s.cdpn.io/3/kiwi.svg'>" data-html="true" data-animation="true" data-placement="bottom" data-trigger="hover" title="who jill?">jill</a></td> <td>smith</td> <td>50</td> </tr> <tr> <td>eve</td> <td>jackson</td> <td>94</td> </tr> </table> you'll need override bootstrap css; following seems work in context of fiddle. td { position: relative; } .popover.bottom { top:

java - Compare the values in two tables and insert into the second table the value fetched from the first table -

pls help! i've 2 tables: info , message info has columns : id name location description 1 abc def ghijg 123 2 xyz wqk fdgbf 234 3 tuv ghn hndbd 345 message had columns : id text created_at 1 hi 123 12345 1 hey 123 12345 2 hello 234 98765 i want insert new values message , set value of id(in message) corresponding value of id of info. example shows id 1 in message tells row corresponds info table's id 1. i'm writing java code insert new values message. my tables huge i'm storing id , name info arraylist , comparing id arraylist , name values null. im using loop iterating through arraylist , compare name value name value im calling twitter , insert message. code is: for(bank v: bankid){ if(v.getname()== null || v.getname().equals(name)){ if(v.getname().equals(name)){ system.out.println(v.ge

c# - How to show a comma separated number with StringFormat in XAML? -

my code shows this: 43521 reviews , want this: 43,521 reviews . how can that? , there full reference possible formats in stringformat ? couldn't find anything. thanks. <textblock text="{binding reviews,stringformat='{}{0} reviews'}"/> just change string format this: <textblock text="{binding reviews,stringformat='{}{0:0,0} reviews'}"/>

c++ - How to use the GNU scientific library (gsl) in nvidia Nsight eclipse -

i use gsl functions in cuda code. (in nsight eclipse on linux) have installed gsl , should setup linker setting in eclipse. i have tried follow steps outlined here , have issues. in project properties there no "c/c++ build" menu "build" , not able find setting mentioned in above blog post. how can setup linker settings ? thanks in advance! you won't able use gsl routines directly in cuda device code. gsl libraries ( -lgsl ) compiled x86 usage , not run on gpu. if want use gsl routines in host code, should sufficient specify include file , path, linker path, , linker library: -i/usr/local/include/gsl -l/usr/local/lib (or /usr/local/lib64) -lgsl here's a question/answer discussing how make these kind of additions in nsight eclipse

asp.net mvc - MVC4 Jquery Popup -

i'm hoping advice on how best achieve following in .net mvc 4. i have view list of companies on it, simple each through enumeration building html table. each row has button or link, when pressed button / link opens pop-up window. inside pop-up window partial view, containing form add new user posts own method on controller. what happen form self contained within pop-up , not affect main window until close pop-up , refresh parent window, still able submit new user , persisted within pop-up. can 1 offer advice. thanks i think posting form within dialog using ajax solution. you take benefits of serialize data of form values next javascript in jquery: $("#submit-button").click(function (e) { e.preventdefault(); var form = $("#dialog-form"); var form_collection = form.serialize(); $.post("/controller/action/", form_collection, function (data) { if (data) { $("#dialog").close(); }

c# - Disabling Toggle Button Throws External Exception -

private async void addvoice_unchecked(object sender, routedeventargs e) { addvoice.isenabled = false; await task.delay(100); addvoice.isenabled = true; } this simpler snippet actual code, found these 3 lines problem is. it throws @ second line: await task.delay(100). exception external code , i'm not sure how catch it. i found if disable button in non-async method (constructor example), doesn't throw. disabling in other async methods throw. i'm able modify other controls' properties in method.

python - Matplotlib does not work with Canopy 1.3 on Linux Mint Debian Edition -

i upgraded canopy 1.3 on linux computer, , since experiencing problems when trying use matplotlib. did not have these problems canopy 1.1. invoking matplotlib spawn error this: >>> import matplotlib.pyplot plt >>> import numpy np >>> plt.plot(np.array([1,2,3])) *** libmkl_p4m.so *** failed error : /home/richard/canopy/appdata/canopy-1.3.0.1715.rh5-x86/lib/libmkl_p4m.so: undefined symbol: i_free *** libmkl_def.so *** failed error : /home/richard/canopy/appdata/canopy-1.3.0.1715.rh5-x86/lib/libmkl_def.so: undefined symbol: i_free mkl fatal error: cannot load neither libmkl_p4m.so nor libmkl_def.so apart that, canopy python seems functioning normally. this on linux mint debian edition (lmde) i386, distribution based on debian testing. $ uname -a linux lmde-i386 3.11-2-486 #1 debian 3.11.8-1 (2013-11-13) i686 gnu/linux i have searched canopy/epd support forums, no avail. ( this issue @ first sight seemed related; proposed fixed not help.) find

Plot the trajectory of vectors in MATLAB -

Image
i have created following data in matlab example, using x , y axes: t = 1:5 % time in seconds dxx = [10,8,6,5,4] % speed in x direction w = trapz(t,dxx) % distance object in x direction (numerical integration) dyy = [9,7,6,5,3] % speed in y direction c = trapz(t,dyy) % distance of object in y direction (numerical integration) how can plot vectors dxx(t) vs dyy(t) (the net trajectory @ time t), using data? first assume need cumtrapz instead of trapz . plotting can use quiver t = 1:5 % time in seconds dxx = [10,8,6,5,4] % speed in x direction w = cumtrapz(t,dxx) % distance object in x direction (numerical integration) dyy = [9,7,6,5,3] % speed in y direction c = cumtrapz(t,dyy) % distance of object in y direction (numerical integration) quiver(w,c,dxx,dyy) resulting in: is looking for?

Error 1004 when clearing a row in excel using vba -

i'm building macro excel , when try , run it randomly breaks on lines when try clear column. throws error 1004 , don't know how fix since i'm quite new excel vba. this code breaks on (with varying columns): worksheets(sheet).range("a3", range("a3").end(xldown)).clear is wrong way of doing it? should use function clear columns? in advance. each time don't specify worksheet range refers to, refered active worksheet. try worksheets(sheet).range("a3", worksheets(sheet).range("a3").end(xldown)).clear

css - Responsive Div Resize -

i'm new in coding , i'm stucked resize problem. my header image 2 buttons on top (which menu). want build responsive template. when resize window 2 buttons doesn't entirelly follow image , stays below image. how can fix it? <!doctype html> <head> <meta charset="utf-8" /> <title>my website</title> <script src="js/jquery-2.1.0.min.js"></script> <script src="js/flowtype.js"></script> <style type="text/css"> body { overflow-x: hidden; } .image-banners { position: absolute; z-index: -1; max-width: 100%; height: auto; width: auto\9; /* ie8 */ top: 0em; left: 0em; } .banner-title { position: relative; font-family: 'segoe ui', sans-serif; font-size: 2em; text-shadow: 0.05em 0.05em black; color: rgba(255, 255, 255, 1)

javascript - Protect Directories with Login NodeJS -

(a "follow up" of nodejs session authentication ) using node, i'm using app.get(...) authenticate() http requests, works nicely, however, work-around end-user inputs url browser. so i'm sending request app.get("/oneplayer",authenticate ... ) , if you're logged in, redirect /one-player/index.html so put /one-player/index.html browser , suddenly, they've gotten around login check. no big deal, can app.get("/one-player/index.html" ... ) ? sure.. works, means have app.get every file login protected. how can login protect files, option exclude specific files/http requests (example: login.html , createaccount.html don't need account access)? app.get('/oneplayer', authenticate, function(req, res) { fs.readfile('one-player/index.html', function(err, content) { res.render(content); }); }); or similar. don't statically serve html files, serve them after checking. ps: there no err

vb.net - .net - Sorting a Data Table -

how sort datatable using vb.net? i've read thread having same output. sorting data table how sort datatable also, i've tried sample in microsoft still it's not sorting. dim locationtable new datatable("location") ' add 2 columns locationtable.columns.add("state") locationtable.columns.add("zipcode") ' add data locationtable.rows.add("washington", "1") locationtable.rows.add("california", "2") locationtable.rows.add("hawaii", "3") locationtable.rows.add("hawaii", "4") locationtable.rows.add("hawaii", "5") locationtable.rows.add("hawaii", "6") locationtable.rows.add("hawaii", "7") locationtable.rows.add("hawaii", "8") locationtable.rows.add("hawaii", "9") locationtable.rows.add("haw

Custom Google Maps Markers and Infowindow -

i want create google map in markers want show coming database , infowindow data comes database different each marker obviously. code using is: <script type="text/javascript"> var delay = 100; var infowindow = new google.maps.infowindow(); var latlng = new google.maps.latlng(21.0000, 78.0000); var mapoptions = { zoom: 5, center: latlng, maptypeid: google.maps.maptypeid.roadmap } var geocoder = new google.maps.geocoder(); var map = new google.maps.map(document.getelementbyid("map_canvas"), mapoptions); var bounds = new google.maps.latlngbounds(); function geocodeaddress(address, next) { geocoder.geocode({address:address}, function (results,status){ if (status == google.maps.geocoderstatus.ok) { var p = results[0].geometry.location; var lat=p.lat(); var lng=p

c# - Using Nunit with TestCaseSource - running multiple times changes results -

i writing unit tests using nunit c# project. i trying run single test multiple times different data using testcasesource attribute. i doing elsewhere without problems, finding first time run tests, code passes. next time, doesn't. using console.writeline statements, can see test data different each time. the method used generate data internal test class, not static , generates required dependencies scratch each test. -- i have fake class holds queue of values return when given function called. new class created each test. however, if first time test run, exhausts queue, next time run, no data found. surely should regenerated every time? -- it if nunit not calling method specified testcasesource attribute every time test run - when project first loaded. is expected? there workaround? edit: ok, here basic example, below: [testfixture] public class tests { public interface ientry { object read(); } [testcasesource("testdata&

html - Import single element from different website by ID -

i import specific element website website. example, i'd import this: <div id="mainbar-full"> ... </div> from this website foo.stackoverflow.com/bar . should iframe, not showing whole page part of it. is possible this? -cerdo you can iframe, not particularly clean solution cannot think of other way of doing it. you wont able use stackoverflow page stackoverflow have website set allow same domain iframe requests, understand use in example. here example using id , url mentioned: <iframe src="http://stackoverflow.com/tour/#mainbar-full" scrolling="no" class="iframe"></iframe> you need set following css whole contents: .iframe { height: 4555px; width: 980px; overflow: none; } this show entire contents of element on page. as said above, not feel clean solution can think of @ moment. here working example buzzfeed: http://jsfiddle.net/kyzzk/ cheers.

Java > PHP Socket - trash at start of message -

i have java server communicating php script called apache. aiming send json java server php client when requested, there stuff getting prefixed when received on client. java in = new bufferedreader(new inputstreamreader (socket.getinputstream())); out= new dataoutputstream(socket.getoutputstream()); //the server receives json php script , replies. recives , converts gson json no problem. string reply = "{\"status\":\"reg\",\"token\":\""+client.gettoken()+"\"}\r\n"; //reply = "hello\r"; out.writeutf(reply); php $rec = socket_read($socket, 2048,php_normal_read); echo "receiving... "; echo $rec; the issue message received pre-fixed crap. output php receiving... 1{"status":"reg","token":"qopipcndi4k97qp0naqf"} if send "hello\r" receiving... >hello you shouldn't use dataoutputstream.writeutf()

url - how to monitor the web traffic from any browser in a PC using a Java App -

i working on java application monitor urls requested any browser on pc . i need in how monitor http request url transmitted browser ( firefox , chrome or internet explorer ). thanks guys a proxy indeed easiest because high level information back. wrote java-based proxy server intended authenticate against ntlm proxy git. https://github.com/nablex/proxy

asp.net mvc - How to display the text in MVC? -

i want display error message in textbox in mvc. used following code not displaying. userprogram.compileoutput = "line number " + comperr.line + ", error number: " + comperr.errornumber + ", '" + comperr.errortext + ";" + environment.newline + environment.newline; @html.editorfor(up => up.compileoutput) return view(userprogram); in above code userprogram returns value compileoutput. not displaying in textbox. just try it, modelstate.clear();

codeigniter - Returning null from model function -

i want select records database function returns null. model function pub_article() { $where=array('public'=>'1'); $query=$this->db->get_where('article',$where); if($query->num_rows() > 0) return $query->result(); else return false; } what wrong code?

listview - Android: Get multiple images from Gallery and Populate them in a list view in android -

i want multiple images gallery , populate images in listview. first of all, possible without using third party libraries? this doing currently.... using universal_image_loader multiple images gallery, not able populate them in listview. "main.xml" - imagelist list containing images gallery <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.85" android:orientation="horizontal" > <imageview android:id="@+id/image1" android:layout_width="100dp" android:layout_height="match_parent" android:layo

iPhone/iOS Status bar not hiding in Xcode project -

Image
hi have tried following unable remove status bar application: set status bar hidden yes in plist 'hide during application launch' ticked in project general settings set status bar 'none' in interface builder file controlling view controllers set [uiapplication sharedapplication].statusbarhidden = yes; in app delegate. all these used work fine in 100 applications did before made recent xcode upgrade.. is there other secret way of getting rid of status bar in app? need journey apple headquarters , slay red dragon ? found solution in apps plist file add row call "view controller-based status bar appearance" , set no source - openfl

java - Ejb, Error in second method rolls back first method -

i have poller scheduled this @schedule(minute = "*/5", hour = "*", persistent = false) public void polltimer() { startfirstpoller(); startsecondpoller(); } @transactionattribute(transactionattributetype.requires_new) private void startfirstpoller() { // find booking database , update bokingfacade.findall(); bokingfacade.update(booking); } @transactionattribute(transactionattributetype.requires_new) private void startsecondpoller() { // find booking updated database , update bokingfacade.findall(); bokingfacade.update(booking); } the first method update bookings, save them database , second method use updated information process further , again update database. problem changes doesn't reflect in database until , unless second executes successfully. moreover, exception in second method rollback successful changes made first method. please let me know happening , how make 2 method independent of each other. i assume because don&#

java - How to insert icon for the pop up menu items -

i using popup menu inflater view menu items, not getting icons in menu list..here code please me.. <item android:id="@+id/menu_messages" android:title="messages" android:icon="@drawable/mail" /> <item android:id="@+id/menu_settings" android:title="settings" android:icon="@drawable/setting" /> <item android:id="@+id/menu_logout" android:title="logout" android:icon="@drawable/lock1" /> final imageview iv = (imageview) findviewbyid(r.id.imageview2); /** * step 1: create new instance of popup menu */ final popupmenu popupmenu = new popupmenu(this, iv); /** * step 2: inflate menu resource. here menu resource * defined in res/menu project folder */ // popupmenu.inflate(r.layout.listview_menu); popupmenu.inflate(r.menu.example); /** * step 3: call show() method on popup menu display * menu when button clicked. */ iv.setonclicklist

OpenERP: css class not recognized -

please tell me what's wrong code. have developed module on openerp7, , i'am trying use css class existing in base.css file gave me error : invalid xml view architecture! i've updated module , web module contains base.css file. checked web module installed.i have restarted server. here's how i've added class: <field name="production" class="oe_edit_only"/> here's full form view: <record model="ir.ui.view" id="view_ordres_fabrication_form"> <field name="name">ordres_fabrication.form</field> <field name="model">ordres_fabrication</field> <field name="type">form</field> <field name="arch" type="xml"> <form string="ordres de fabrication"> <field name="numero"/> <field name="commande_id" on_change="onchang

How to make two images with same dimensions to be same size in matlab -

i have 2 images same dimensions different sizes. want bigger image's size changed match smaller image's size. example, have image size 300x400x3 , image b size 600x800x3 . want change size of image b 300x400x3 . help. just one-liner suggested andrey - b = imresize( b,[size(a,1) size(a,2)]); for accessing more options resizing, use resource .

ios - Can I figure out the numberOfLines of NSString without creating UILabel? -

i want know number of lines, given font, constraints, , text. can figure out without creating uilabel ? + (int)numberoflines:(nsdictionary *)data{ nsstring *mystring = [some string calculation]; cgsize sizeconstrain = cgsizemake(some constrain calculation); cgsize stringsize = [mystring sizewithfont:somefont constrainedtosize:sizeconstrain]; cgrect labelframe = cgrectmake(0, 0, stringsize.width, stringsize.height + 2); uilabel *label = [[uilabel alloc]initwithframe:labelframe]; label.text = mystring; return label.numberoflines; } yes + (int)numberoflines:(nsdictionary *)data{ nsstring *mystring = [some string calculation]; cgsize sizeconstrain = cgsizemake(some constrain calculation); cgsize stringsize = [mystring sizewithfont:somefont constrainedtosize:sizeconstrain]; return (stringsize.height/somefon

javascript - To drag shapes drawn on canvas same as paint -

Image
i have tool similar paint allow user draw different shapes on canvas using mouse events.i want allow user drag shapes(same paint) once drawn on canvas. did done before? have tried using oopdragging didn't work in case.also tool include kind of shapes line,elbow connector,oval,text,image , not circles , rectangles. can please suggest easy achieve solution need asap. in advance. a demo: http://jsfiddle.net/m1erickson/jrzm2/ assume you've created triangle in paint program and points triangle in array this: [{x:0,y:20},{x:30,y:0},{x:70,y:45}] to move triangle [20,35], need first offset triangle x:20 & y:35 var mytriangle={ x:20, y:35, points:[{x:0,y:20},{x:30,y:0},{x:70,y:45}] } then can draw triangle @ [20,35] this: note offsets (20,35) added each point in triangle's position function draw(mytriangle){ var x=mytriangle.x; var y=mytriangle.y; var points=mytriangle.points; ctx.beginpath(); ctx.moveto( x+points

widget - Extjs add listener after page load -

i'm documentum xcp developer, xcp ui developed in extjs , have tool create ui. in ui have 1 option set initial value widget. can call function set initial value my requirement restrict user entering hyphen in number field , numeric values in text field. on page have menubar , items linked page. want added "afterrender" listener page. var page = ext.componentquery.query('panel[title=document search]')[0]; page.on("afterrender", function(){ alert('after render called ...'); }); thanks in advance have tried use vtype in textfield? more informations here : http://docs.sencha.com/extjs/4.2.2/#!/api/ext.form.field.vtypes for example : { xtype: 'textfield', name: 'email', fieldlabel: 'email address', vtype: 'email' // requires value valid email address format } in example, creating textfield allows email address. have 4 types of "vtype" : alpha alphanum email