Posts

Showing posts from June, 2010

php - cURL+redirect with cookie -

php - cURL+redirect with cookie - how can redirect user web site cookie? im using code <?php $fields_string = 'client_login=jadro&client_pass=jadro&client_remember=on&action=client_login'; $options = array( curlopt_returntransfer => true, curlopt_header => true, curlopt_followlocation => true, curlopt_useragent => "mozilla/5.0 (windows; u; windows nt 6.1; ru; rv:1.9.1.7) gecko/20091221 firefox/3.5.7 firephp/0.3", curlopt_autoreferer => false, curlopt_connecttimeout => 120, curlopt_timeout => 120, curlopt_maxredirs => 10, ); $ch = curl_init(); curl_setopt_array( $ch, $options ); curl_setopt($ch,curlopt_url,'http://orion10.ru'); //curl_setopt($ch,curlopt_post,count(explode('&',$fields))); curl_setopt($ch,curlopt_postfields,$fields_string); //curl_setopt($ch,curlopt_cookiejar, 'cooc.txt&#

arrays - PHP Error "Trying to get property of non-object" -

arrays - PHP Error "Trying to get property of non-object" - ok, have been having problem week error, , i've found think understand when alter it doesn't work. if help me understand little improve , tell me why not working. the rundown- trying display list of different product families on table. ok. here class <?php class mclean { public $product_id, $catalog_number, $model_code, $caterogry, $product_family, $product_sub_family, $product_name, $img; function __construct($caterogry){ // $db defined in config.inc.php global $db; // sanitize input $caterogry = $db->real_escape_string($caterogry); // sql query $sql = "select * mclean_products_info caterogry = '". $caterogry . "'"; // if there result... if($result = $db->query($sql)){ // $row contains object $row = $result->fetch_object(); // set class attributes $this->prod

struts2 - Struts 2.3.16.3 upgrade - modal dialog (popup) not opening -

struts2 - Struts 2.3.16.3 upgrade - modal dialog (popup) not opening - i upgraded struts 2.3.15.3 2.3.16.3. struts jquery plugin - 3.7.1 struts jquery tree plugin - 3.7.1 java servlet api - 2.4 jquery-ui.js - 1.10.4 i have done above changes! css working , jquery working fine. none of modal dialogs (popups) opening up. have missed anything? can help me in this? i utilize tiles in app. modallayout not working.. how open popup <s:url var="editurl" action="edit" namespace="/app/edit" method="load" escapeamp="false"/> <td onclick="openedit('<s:property value="#editurl"/>','<s:property value="id" escape="false"/>')"> <sj:a id="editcplink" button="true" href="#" > edit </sj:a> </td> function openedit(modalurl,id) { var options_modaldialog = {}; winopen(options_modaldialog); options_modaldia

android - SQLite query using CursorLoader -

android - SQLite query using CursorLoader - i trying unique column values in loader. code :- public loader oncreateloader(int id, bundle args) { if (mselectedspinneroption == 1) { homecoming new cursorloader(this, suggestion.content_uri, suggestion.projection, badbehaviourcolumns.packagename="distinct", null, badbehaviourcolumns.timestamp + " asc "); } } i want values distinct bundle name values. how accomplish using above code? i writing reply because faced exact same issue while querying cursorloader , got answers related database.query(). there simple trick can used on lines of sql injection. instead of using distinct, here grouping has been used works faster unless low on memory (ref: huge performance difference when using grouping vs distinct). following query have execute distinct column1 items table_name. select column1 table_name grouping column1; with technique query end executing. se

image - Python Imaging Library fails to grab whole screen -

image - Python Imaging Library fails to grab whole screen - i using pil grab screen shot, capturing part of screen. here screen shot of desktop and programme captures as can see, screen has amount of space chopped off on side , along bottom. tried right adjusting size of capture zone, resulted in areas filled black i'm thinking there limit maximum resolution library can capture, cant find documentation saying so. below code import imagegrab import os import time def screengrab(): box = (0, 0, 1920, 1080) im = imagegrab.grab(box) im.save(os.getcwd() + '\\screenshot_' + str(int(time.time())) + '.png', 'png') def main(): screengrab() if __name__ == '__main__': main() dose know how prepare issue or know why happening? i having problem before today. script capture pixels 0,0 - 1536,864. switched windows 8 , noticed programs seemed displayed @ wrong resolution. after searching found fix. go pytho

Issue in comparison different list in Scala -

Issue in comparison different list in Scala - i'm looking way compare different list types: val = list(event1, event2, event3) val b = list(list(event1, event2, event3)) how can compare these 2 lists equality? trying nesting loop, don't think work. you can flatten events list, so: scala> list("e1", "e2", "e3") res0: list[string] = list(e1, e2, e3) scala> list(list("e1", "e2", "e3")) res1: list[list[string]] = list(list(e1, e2, e3)) scala> res1.flatten res2: list[string] = list(e1, e2, e3) scala> res0 == res2 res3: boolean = true scala

ruby on rails - Linking models created using Devise + Activeadmin -

ruby on rails - Linking models created using Devise + Activeadmin - i have 2 models listing , profile configured active admin. model profile generated using devise. have established has 1 relationship between them. want create scheme in each new listing, profile automatically created , linked. (imagine airbnb in seller can have 1 listing , cannot rent) linking should both valid in activeadmin , when user logins app. how should approach this. side note: model profile not registerable. using through activeadmin of import 1 time listing , profile created superuser, can send login details person , can login view listing. ps: rails newbie here! easier methods,tutorials or directions appreciated , if in or near london thanked beer. for has_one relationship please see: http://guides.rubyonrails.org/association_basics.html#the-has-one-association if want create profile when creating listing, can activeadmin's create controller of listing: the code should this: (put i

Set initial value for bootstrap checkbox button -

Set initial value for bootstrap checkbox button - i'm using code below set middle checkbox true it's not working. missing? for demo go http://jsfiddle.net/5sq7v/ <div class="btn-group" data-toggle="buttons"> <label class="btn btn-default"> <input type="checkbox">hello 1 </label> <label class="btn btn-default"> <input type="checkbox" checked="checked">hello 2 </label> <label class="btn btn-default"> <input type="checkbox">hello 3 </label> </div> looks missing 'active' class in sec label. looking for? <div class="btn-group" data-toggle="buttons"> <label class="btn btn-default"> <input type="checkbox">hello 1 </label> <label class="btn btn-default active">

sql - Send mail automatically near MySQL datetime -

sql - Send mail automatically near MySQL datetime - in mysql database have table containing datetime column. i'd send emails whenever current time 30 minutes before 1 of datetime values. e.g. datetime value '20140623180000' server should send mail service @ 17:30 on 23rd june 2014. values in datetime column aren't regular. knows how in easy way? (linux running on server) so need cron run every min looks records datetime < currenttime then loop through results , send necessary email. i.e. #!/usr/bin/php <?php $db = new pdo($dsn); $stmt = $db->query("select * table datetime > ?"); $stmt->execute(array(date("y-m-d h:i:s", strtotime("-30 minutes"))); $r = $stmt->fetchall(pdo::fetch_assoc); foreach($r $res){ mail($to, $subject, $message, $headers); } ?> not tested mysql sql email datetime

javascript - How to adjust asp placeholder size according to content -

javascript - How to adjust asp placeholder size according to content - i have placeholder holds few elements, 1 of them tgl div, clicking on opentime button tgl div visible or hidden. problem placeholder opentime size static, when tgl visibility hidden, placeholder takes unnecessary space. possible alter placeholder size according content ? must utilize placeholder. //html <asp:placeholder runat="server" id="opentime" > <input type="button" id="open" onclick="togglediv()" value="edit time" style="width:130px"/> <div id="tgl" style="visibility:hidden;overflow:hidden;min-height:1px"> <div id="majindiv" style="width: 600px"; ></div> </div><br /> use display: none; css instead of visibility:hidden; display: block; show element back. visibility controls visibility space s

java - I am stumped by a seemingly simple syntax error -

java - I am stumped by a seemingly simple syntax error - i creating hangman game in java, , running problem. in if statement on line 8, checking see if of characters in apple match char user inputs. error showing (unexpected type required: variable, found: value scanner input = new scanner(system.in); string word1 = "apple"; system.out.print("guess letter: "); char guess = input.next().charat(0); for(int = 0; <= word1.length(); i++) { //check see if char @ position equals guess if(word1.charat(i) = guess) { //code logic inserted } } if(word1.charat(i) == guess)// utilize "==" instead of "=" { //code logic inserted } "=" means assigning value variable. "==" means comparing.. also, if you, utilize i < word1.length(); instead of i <= word1.length(); . potential arrayindexoutofboundsexception screaming behind line... java

python - Links in Google App Engine are prepended with the site URL -

python - Links in Google App Engine are prepended with the site URL - i've had weird issue that's been stumping me days, , need working tonight. wrote app in python on google app engine (i'm assuming relevant issue), , whenever include link tag, link on live site prepended own site's url. for example, if placed link in home page html to, say, youtube, so: <a href="www.youtube.com">clicky here</a> ...then on live website, it'll link www.mysitedomain.com/www.youtube.com needless say, 404 every time. hope simple issue resolve, i'm on time crunch tonight. give thanks , help! put http:// before link, otherwise taken relative link. <a href="http://www.youtube.com">clicky here</a> python html google-app-engine hyperlink jinja2

mysql - How to Find ALL Most Common Values in SQL? -

mysql - How to Find ALL Most Common Values in SQL? - how go showing all mutual values in sql? so have query show mutual value here bellow. select name, count(*) popularity cattwo grouping name order popularity desc limit 1; +----------+------------+ | name | popularity | +----------+------------+ | cat22610 | 7 | +----------+------------+ however, when display top 10 mutual value result ... select name, count(*) popularity cattwo grouping name order popularity desc limit 10; +----------+------------+ | name | popularity | +----------+------------+ | cat22610 | 7 | | cat68704 | 7 | | cat14153 | 7 | | cat52476 | 7 | | cat4556 | 7 | | cat64173 | 7 | | cat5586 | 7 | | cat89302 | 6 | | cat97131 | 6 | | cat42010 | 6 | +----------+------------+ the goal display cats highest popu

javascript - While MouseDown, first slowly decrease number, then increase decreasing speed (jQuery) -

javascript - While MouseDown, first slowly decrease number, then increase decreasing speed (jQuery) - as title suggests i'm stuck mousedown problem. want in "pseudocode" while ("#arrowup").mousedown(function() { counter++; //one time straight when pressed if(mousedowntime > 500){ //500ms settimeout({counter++}, 75); //meaning, every 75ms counter++ } } i have been looking around @ stack overflow on 2 days now. , succeeded increment every 75ms, couldn't build in if(mousedowntime > 500) -statement, while still beingness able increment counter every 75ms after 500ms. $("#tempup").mousedown(function() { //when longer pressed, automatically faster increment temperature int = setinterval(edittemp(currtemp+1), 250); }) .mouseup(function() { clearinterval(int); numberofrepeats = 0; }); this code have of of function far. help me out? or asking question in wrong

python - Why does the ";" exist when it goes against formatting standards? -

python - Why does the ";" exist when it goes against formatting standards? - as know, ; symbol used separate lines this: print "hai"; print "bai" from i've heard, goes against formatting standards python. so, if goes against formatting standards, why implemented? how used properly? ";" used in cases, have no other choice. e.g. when calling python command line , willing execute 2 statements. $ python -c "print 'hai'; print 'bai'" hai bai or more complex cases: $ python -c 'a=1; b=2; print "a + b = {a} + {b} = {res}".format(a=a, b=b, res=a+b)' + b = 1 + 2 = 3 note: not take "no other choice" literally, find nice alternatives cases in comments. python python-2.7

java - Need the JAR file for a javax.servlet.http.HttpServletRequest -

java - Need the JAR file for a javax.servlet.http.HttpServletRequest - i modifying behavior of web-app(server & client) running on web-sphere. have de-compiled code , need create minor changes , redeploy code. for made simple java project eclipse ee , loaded de-compiled code. need *.class files convert jar , place them @ proper place. thing there dependency not beingness resolved javax.servlet.http.httpservletrequest project not building how resolve dependency? if dependency cannot resolved guess jar file javax.servlet.http.httpservletrequest , add together project's build path external jar. where can find jar javax.servlet.http.httpservletrequest p.s. new java don't know much httpservletrequest using java 1.6 jre. you'll want add together servlet api "provided" dependency. is, utilize compile code, don't need bundle web application since web container contain re-create of it. java eclipse servlets jar

javascript - jQuery dialog doesn't work inside if condition -

javascript - jQuery dialog doesn't work inside if condition - this jquery function followed html code. $(document).ready(function() { $('#submit').click( function() { var size = $('#file')[0].files[0].size; if(size > 100000) { alert("filesize larger. please seek again."); } }); }); <div id="dialog" title="message" style="display: none"> <p>file size larger.</p> </div> if replace alert() $( "#dialog" ).dialog(); doesn't work. if place $( "#dialog" ).dialog(); outside if() works. there workaround problem i'm facing? any form of help appreciated. give thanks you. try : $(document).ready(function() { $('#submit').click( function() { var size = $('#file')[0].files[0].size; if(size > 100000) { document.getelementbyid("dialog").innerhtml = "filesi

java - using same thread variable in different functions -

java - using same thread variable in different functions - i have java lib specific printer , write printer need run in thread, have different function in printer class, 1 align text 1 print barcode, etc... able print have port printer , utilize port different functions. here code: port = starioport.getport(portname,portsettings, 10000,null); in diffrent functions utilize port this: try { starprinterstatus status = null; status = port.begincheckedblock(); port.writeport(text,0,text.length); status = port.endcheckedblock(); grab (starioportexception e) { } and when finish print job. if(port != null){ seek { starioport.releaseport(port); } grab (starioportexception e) {} } how can create thread , utilize same "port" in functions? java android multithreading printing

Angular UI Bootstrap pagination not working -

Angular UI Bootstrap pagination not working - i using ui-bootstrap pagination not working expected refer next post not working me. how tell ui-bootstrap content paginate? my code follows. <div> <ul> <li ng-repeat= "payment in paymenthistory"> <div > <div > <p >payment.status</p> </div> <div> <p >payment.cost</p> </div> </div> </li> </ul> </div> <div ng-show="pagination"> <pagination total-items="totalitems" items-per-page="itemsperpage" ng-model="currentpage" ng-change="pagechanged()"></pagination></div> my controller code: paymentfactory.getpaymenthistory( ) .success(function (paymenthisinfo) { for(var = 0; i< paymenthisinfo.list.length; i++){ $scope.paymenthistory.push

storing the data entered in a text file using perl cgi? -

storing the data entered in a text file using perl cgi? - i have installed boa server on arm. , writing cgi script can info user( on other pc on same network ) , save in text file in arm. here cgi file, store info in text file need utilize "use cgi" info entered when uncomment on code error 502 bad gateway cgi not cgi/1.1 compliant. need help! #!/usr/bin/perl utilize strict; utilize warnings; #use cgi; print "content-type: text/html\n\n"; #open (myfile, '>>guestbook.txt'); # print myfile "1111111\n"; # close (myfile); print <<"eof"; <html> <head> <title>hello, world!</title> <p id="demo"></p> <script type="text/javascript"> function copytext() { document.getelementbyid("field2").value=document.getelementbyid("field1").value; document.getelementbyid("demo").innerhtml = date(); } </script> </head> <bod

c - Array inside struct filled with garbage after initialization -

c - Array inside struct filled with garbage after initialization - i defined info construction ( foo ) contains array of 25 pointers ( members ) itself. want initialize each of pointers null , init function isn't working correctly. when foo f returns foo_init() , of members null , others populated random values. //in foo.h #include <stdio.h> #include <stdlib.h> typedef struct foo { struct foo * members[25] ; } foo ; void foo_init(foo * f) ; //in foo.c void foo_init(foo * f) { f = (foo*)malloc(sizeof(foo)); (size_t = 0 ; < 25 ; i++) { f->members[i] = null ; } /* ok here, members null */ } //in main.c #include "foo.h" int main(int argc, const char * argv[]) { foo f ; foo_init(&f) ; /* why isn't every index of f.members null? */ /* ... */ homecoming 0; } i ran code through lldb. within foo_init(), members null . after returning foo_init(), f.members total of random garbag

embedded - Different ways of addressing pointers C/C++ -

embedded - Different ways of addressing pointers C/C++ - i'm little confused accessing specific addresses using c style pointers. i have 32 bit chip i'm tryin program. need flip bits or whatever in ram. next solution works fine. uint32 strbase = 0x00168380; volatile uint32 *ram = (uint32*)0x03000000; ram[(strbase+0x48)/4] = 0x10000000; ram[(strbase+0x4c)/4] = 0x10000000; ram[(strbase+0x50)/4] = 0x10000000; ram[(strbase+0x54)/4] = 0x10000000; ram[(strbase+0x58)/4] = 0x10000000; ram[(strbase+0x5c)/4] = 0x10000000; ram += (strbase+0x60)/4; however, i'm bit confused. tried writing few different subroutines thought equivalent didn't work. next method kinda works. uint32 strbase = 0x00168380; volatile uint32 *ram = (uint32*)0x03000000; *(uint32*)(0x03000000 + 0x001683c8) = 0x10000000; *(uint32*)(0x03000000 + 0x001683cc) = 0x10000000; *(uint32*)(0x03000000 + 0x001683d0) = 0x10000000; *(uint32*)(0x03000000 + 0x001683d4) = 0x10000000; *(uint32*)(0x

android - How to detect GPS being enabled -

android - How to detect GPS being enabled - i'm making app uses gps. problem comes when open app without having gps enabled, nil (obviously) if enable gps without exiting app app still doing nothing. need disable , enable gps in app need know problem comes from, i'll leave here code: public class escuchalocalizacion implements locationlistener { private locationmanager gestor; private textview view1; private textview view2; private boolean registrado; private static final float mindistance = 10.0f; private static final long mintime = 300; public double _long; public double _lat; escuchalocalizacion (context c, textview t1, textview t2) { log.v("escuchalocalizacion", "construyendo el objeto"); gestor = (locationmanager) c.getsystemservice(context.location_service); registrado = false; view1 = t1; view2 = t2; log.v("escuchalocalizacion", "he term

pass image from one view controller to another in swift -

pass image from one view controller to another in swift - i seek utilize segue pass image 1 view controller another, image null , cannot used. here mainviewcontroller.swift, logs show right value. func imagepickercontroller(picker:uiimagepickercontroller!,didfinishpickingmediawithinfo info: nsdictionary!){ var i:uiimage = info.objectforkey(uiimagepickercontrolleroriginalimage) uiimage nslog("%f, %f", i.size.width, i.size.height); orignal = nslog("iamge %@", orignal) performseguewithidentifier("showphoto", sender: self) dismissmodalviewcontrolleranimated(false) } override func prepareforsegue(segue: uistoryboardsegue!, sender: anyobject!) { var imageeditcontroller:imageeditviewcontroller = segue.destinationviewcontroller imageeditviewcontroller imageeditcontroller.editimage = orignal nslog("iamge %@", imageeditcontroller.editimage) } here view controller "imageeditviewcontroller.swift"

jquery - Maintain a stack for content of div tag -

jquery - Maintain a stack for content of div tag - i working datatable. on row click, able open details page in same div of datatable using divname.load(@url.action('') . now want provide close button on details page , load previous info table div using jquery. can done maintaining stack of div tags somehow? please help me out. just idea create different div time when load page. hide old 1 when load new page. while closing current 1 hide current , show 1 opened. you can give id each div in sequence showing , hiding simpler. like first div gets id div_0 , sec div id div_1 , on. when closing div having id div_1 know have show div_0 jquery asp.net asp.net-mvc-4 datatables

JavaScript search function is also searching html code -

JavaScript search function is also searching html code - i want utilize html tags within answers section when code pulling through when using search. have little experience javascript advice helpful javascript $('h3.topic').click(function () { $(this).next().toggle(300); }); $('h4.question').click(function () { $(this).next().toggle(300); }); $('#expandall').click(function () { $('#faq').children('div.topiccontents').show(300).children('div.answer').show(300); }); $('#collapseall').click(function () { $('#faq').children('div.topiccontents').hide(300).children('div.answer').hide(); }); jquery.expr[':'].contains = function (a, i, m) { homecoming jquery(a).text().touppercase().indexof(m[3].touppercase()) >= 0; }; $('#searchfaq').click(function () { $('#faq').children('div.topiccontents').hide().children('div.answer').hide(); i

android - how to control ImageView Gravity Dynamically -

android - how to control ImageView Gravity Dynamically - i have listview this: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > <linearlayout android:id="@+id/wrapper" android:layout_width="fill_parent" android:layout_height="wrap_content" > <imageview android:id="@+id/msgimage" android:layout_width="50dp" android:layout_height="50dp" android:src="@drawable/abc_ab_bottom_solid_dark_holo" /> <textview android:id="@+id/msgname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview" /> <textview android:id="@+id/comment"

sql - Replace Single Quotes in PowerShell Or Excel CSV -

sql - Replace Single Quotes in PowerShell Or Excel CSV - i'm wrapping script gets software versions , puts them csv, powershell sql. of software names have single quotes in them not allowed import sql. i'm trying find , replace these single quotes ticks @ point before final sql export. first instinct operate find , replace function in excel via powershell replace, i'm not sure how go or if best way. any advice appreciated. i'm new this. thanks edit: advice far alroc. i'm working next piece: ##sql part## $csv = import-csv -path $updatepath\$($todaydate).csv import-module sqlps foreach ($item in $csv){ $csvappid = $($item.appid) $csvappname = $($item.appname) $csvversion = $($item.version) $sqlserver = "redacted" $sqldb = "redacted" $softwaretable = "redacted" invoke-sqlcmd -serverinstance "$sqlserver" -database "$sqldb" -query "insert dbo.ecca_sw_standard_2 (name, version, product_id) values (n

Does Enterprise Library 6 work with Visual Studio 2013 and/or 2015? -

Does Enterprise Library 6 work with Visual Studio 2013 and/or 2015? - it seems not , planning utilize (logging, exception etc..) future projects. still supported ? not see lot of activity around tool there used be. we have new relic helpful know if new relic can logging/exception handling already.. illustration can create custom logs or exceptions , see them in new relic dashboard? it does. may add together enterprise library 6 project via nuget here sample application. class="lang-c# prettyprint-override"> using system; using system.diagnostics; using microsoft.practices.enterpriselibrary.logging; using microsoft.practices.enterpriselibrary.logging.formatters; using microsoft.practices.enterpriselibrary.logging.tracelisteners; namespace practice.logging { internal class programme { public static void main(string[] args) { loggingconfiguration loggingconfiguration = buildprogrammaticconfig(); var defa

javascript - input text required patter a href -

javascript - input text required patter a href - i'm new html5 , angularjs, here's problem have, have couple of input text field on applied required , pattern , utilize ng-click save changes, styling works on ui, when input value not meet requirements element becomes red, user still able click on . want able 1 of 2 things, either disable when input elements not valid or in saveinfo() function want able validate input values without having repeat pattern , or required. here's html looks like: <input type="text" ng-model="name" required pattern="[a-za-z -]+" /> <input type="text" ng-model="description" required /> <a ng-click="saveinfo()"><img src="./img/save.svg" /></a> thanks in advance. javascript html5 angularjs

grid - ExtJS 5 Menu Widget -

grid - ExtJS 5 Menu Widget - is there xtype menu widget in sencha 5? want popup menu on click of icon in column of ext.grid.panel. belo. or, have create custom widget? { text: 'menu', width: 105, xtype: 'widgetcolumn', dataindex: 'menu', widget: { width: 90, xtype: 'menu', items: [{ text: 'regular item 1' },{ text: 'regular item 2' },{ text: 'regular item 3' }, handler: function(btn) { var rec = menu.getwidgetrecord(); ///... } } } different approach needed: configure widget button menu config option. way button displayed in grid column , clicking on open menu. extjs grid widget

scope - Holding an experience variable to be read/written to throughout a program (python 3) -

scope - Holding an experience variable to be read/written to throughout a program (python 3) - i've been stuck trying way have experience variable in "game" trying work. have found out able import different python files i've created, makes much neater files instead of having in 1 file. think i'm having problem figuring out how global variables work though. if can give me solution without using external module, or creating separate file great. variables remain within .py files. here's thought work. maybe work, don't know how correctly. want there 3 (or more) files. file 1 main file. have main menu , allow player go other events. file 2 contain variable player_experience , equal 0 (but added on throughout game). file 3+ events can done , in return, give experience. need experience variable able read throughout files, , can added onto whenever needed. thought using "global player_experience" @ top of files create work, not able work.

swing - TreeTableRender for JXTreeTable -

swing - TreeTableRender for JXTreeTable - how can assign different renderers different column in jxtreetable. jxtreetable has different column types (like currency, date,...etc.). in jxtable used getcolumn(identifier).setcellrender(tablecellrender) method. should jxtreetable? as long columns of same type handled equally, can assign default renderer class. instance, table has 2 columns java.util.date values , want them both handled in same way: mytreetable.setdefaultrenderer(java.util.date.class, new defaulttablerenderer(stringvalues.date_to_string)); first argument type of object want renderer handle. sec argument cell renderer. swingx comes simple rendering mechanism called defaulttablerenderer. takes number of possible arguments, simplest 1 provide stringvalue instance. that's interface that, when implemented, takes arbitrary object , converts string in manner. stringvalues class contains few predefined implementations. in illustration above, utilize stringv

get frame rate of saved video file programatically android -

get frame rate of saved video file programatically android - i using media codec , saving video fine when tried encode video dont know on frame rate frames , while converting images video. android video video-processing frame-rate

javascript - Obtaining Upper level li text -

javascript - Obtaining Upper level li text - so have list on page <li class="head"> <b>introduction</b> <ul> <li class="sub">somethingsomething</li> </ul> </li> this list beingness used sortable, user can decide on order, , passing info grails controller utilize in application logic. so, trying read in, , place text contained in "head" , "sub" classes in 2 different arrays. however, when utilize jquery selector obtain head elements, , obtain text attribute of element, contains within list well. $('#divname').find("ul > li.head").each(function() { var current = $(this); console.log(current.text()); }); results in introductionsomethingsomething is there way obtain 'introduction' text list, , ignore text in n

javascript - AngularJS - inject string from model to HTML's tag name -

javascript - AngularJS - inject string from model to HTML's tag name - is possible inject string html's tag name angular? something this: <div ng-repeat="type in types"> <bettype-{{type.id}}></bettype-{{type.id}}> </div> the output need is: <bettype-1></bettype-1> <bettype-2></bettype-2> i using polymer (this way creating custom html tags). i think best solution create directive creates custom elements, like: .directive('bettype', function($compile) { homecoming { restrict: 'e', compile: function($element, $attr) { homecoming function($scope, $element, $attr) { // create new element here $attr.number var number = $attr.number, element = angular.element('<bettype-'+number+'></bettype-'+number+'>'); // replace newly created el

ruby on rails - Cucumber capybara stubbing -

ruby on rails - Cucumber capybara stubbing - i have index action in rails controller called images_controller.rb fetches images external service. trying write cucumber scenarios , struggling how write/stub out visit index page step. how stub out images fetches without making request? feature: scenario: image index given image exists on image server when on images page should see images steps far: given(/^an image exists on image server$/) image_server_url = image_server['base_url'] + "/all_images" image = "image.png" image_path = "development_can/image.png" response = [{image_path => [image]}].to_json stub_request(:get, image_server_url).to_return(json.parse(response)) end when(/^i on images page$/) body = "[{\"image/development_app\":[\"the_pistol.jpeg\"]},{\"image/development_can\":[\"kaepernick.jpg\"]}]" @images = json.parse(body) end then(/^i should see i

angularjs - Angular Directive Does Not Load From JS FIle -

angularjs - Angular Directive Does Not Load From JS FIle - my directive not loading .js file. can tell next info why directive not loading file? my app.js file has var app = angular.module('app', ['mydirectives']); i have directive .js file called mydirective.js inside file have (function () { 'use strict'; var app = angular.module('mydirectives', []); app.directive('mymonth', function () { homecoming { restrict: 'ae', transclude: true, //priority: 1000, //scope: { // month: '=month' //}, template: '<select class="input-large" ng-model="month">' + '<option value="1">january</option>' + '<option value="2">february</option>' + '<option value="3">m

java - Install Application on Tomcat7 -

java - Install Application on Tomcat7 - i wrote java application in intellij thought 13 , can start application on tomcat 7 server. want test application on windows xp pc. installed tomcat 7 , xampp(for database) on windows xp pc. got files in .../target folder "projectname-snapshot" folder, "projectname.war", "generated-sources" folder , on. have set these files windows xp pc webapp folder tomcat , start tomcat? when seek way, can't open application when go "localhost:8080". files missing start application? or have compile java files 1 time again on xp pc? if things built correctly , there no external dependences (such database jdni resource), should able set "projectname.war" in /webapps folder, start tomcat, , browse http://localhost:8080/projectname . java tomcat

c# - Fixed Object to ByteArray -

c# - Fixed Object to ByteArray - i have simple object looks this public class foo { public uint32 1 { get; set; } public uint32 2 { get; set; } public uint32 3 { get; set; } public uint32 4 { get; set; } } i tried code i've found somewhere on net public byte[] objecttobytearray(object obj) { memorystream fs = new memorystream(); binaryformatter formatter = new binaryformatter(); formatter.serialize(fs, obj); byte[] rval = fs.toarray(); fs.close(); homecoming rval; } but somehow returning bytearray 248 bytes size, expected 4 bytes x 4 fields = 16 bytes. question: what's cleanest way convert bytearray? , should resulting bytearray 16 bytes size? thanks in advanced. binaryformatter saves lot of type info able deserialize properly. if want compact serialization or comunicate via strict protocol, have explictly this: public byte[] tobytearray() { list<byte> result = new list<byte>(); result.ad

JAVA Execute powershell script from linux -

JAVA Execute powershell script from linux - i want execute powershell script linux using java. the powershell script in windows system. have phone call linux scheme using java bu passing 2 arguments. is possible?? thanks got solution... 1st download freesshd http://www.freesshd.com/?ctt=download in windows(server). create sure run administrator. for setup freesshd follow url http://www.techrepublic.com/blog/tr-dojo/set-up-a-free-ssh-server-on-windows-7-with-freesshd/ after setup can ssh windows scheme linux or using putty. to execute powershell script linux remote windows scheme using java class="lang-java prettyprint-override"> package com.sysvana.router.config; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import ch.ethz.ssh2.connection; import ch.ethz.ssh2.session; import ch.ethz.ssh2.streamgobbler; public class test { static string hostname = "10.1.10.60&

Puzzle: using only 2 variables find which element is most frequent in an array -

Puzzle: using only 2 variables find which element is most frequent in an array - you have stream can contain n integers. can contain 2 various values not know upfront ones are. ex: (7,7,4,4,7,7,4), (-1, 6, -1, -1, -1), (0,1,0,0,1,0,1). using only 2 named variables (the problem limited in memory space), can find of 2 numbers repeated (that means n = m, n > m or viceversa)? suppose have api hasnext() homecoming true if there more elements in array , next() move on next element, , inspect() returns current element in array. there no way go or rewind stream. yes. 1 variable records number in lead, , other records size of lead: leading = stream.inspect() lead = 0 while stream.hasnext(): stream.next() if leading == stream.inspect(): lead += 1 elif lead > 0: lead -= 1 else: leading = stream.inspect() lead = 1 arrays puzzle

sql server - Can the WHERE conditions affect specific columns? -

sql server - Can the WHERE conditions affect specific columns? - i creating procedure , have encountered next problem. (i using microsoft sql server 2008) i have 1 table contained info spread on month (let's 1st 30th). each day of month contains same amount of info (so each day of month has same number of rows in table). have 1 column info of pertaining start date , 1 info end date (i don't want info in between shown). i have tried using bring together this: create procedure afficherconsompools @start date, @end date select datecollecte, pool, capacityinkb, freecapacityinkb, endusedcapacityinkb = capacityinkb - freecapacityinkb vsp_pool datecollecte = @end bring together select startusedcapacityinkb = capacityinkb - freecapacityinkb vsp_pool datecollecte = @start but didn't worked (i don't think can have bring together statement after where). i tried using case don't think it's need here. i'm looking way apply stat

cocoa - Prototype dataCell for view based tables -

cocoa - Prototype dataCell for view based tables - for view based tables cells this: nsstring *identifier = [tablecolumn identifier]; nstablecellview *cell = [tableview makeviewwithidentifier:identifier owner:self]; however there settings "editable" want set cells of specific column. not want clutter cell configuration code setting value every time retrieve cell. instead mutual configuration awakefromnib function , mutual manipulations every cell of column. can visually in xcode my first approach this: nstablecolumn *column = [[self tablecolumns] objectatindex:0]; nstextfieldcell *cell = [column datacell]; [cell seteditable:@yes]; however datacell works cell based tables. there equivalent prototype cell of column view based tables? cocoa nstableview

android - Alarm when device hasn't been touched by user in x hours? -

android - Alarm when device hasn't been touched by user in x hours? - is there way alarm fire time after user has lastly touched device? i.e. when device has been in users pocket while, or when user sleeping. i need db-locking update 2 minutes every few days, preferably when user doesn't want utilize app. edit: have no clue when user not using app, since it's used anytime during day, before going bed , after waking up. currently i'm picking random time between 07:00 , 08:00 every 3 days (using alarmmanager, restarting on boot, etc), hoping user doesn't need feature @ time of day, i'm pretty sure will. android android-alarms

php - Codeigniter ion auth forgot password not sending email -

php - Codeigniter ion auth forgot password not sending email - if submit reset new password email, codeigniter not sending mail. it's returning message 'password reset email sent' doesnt have error. btw, i'm using codeigniter 2.1.4 , ion_auth 2.5.2 $config['use_ci_email'] = true; i set code true, , still not sending mail i utilize config in codeigniter application/config/email.php $config['protocol'] = 'mail'; $config['wordwrap'] = false; $config['mailtype'] = 'html'; application/config/autoload.php $autoload['libraries'] = array('lang','template', 'email','form_validation','session','encrypt','pagination','upload','database' ); in controller $this->email->from(mail,mail); $this->email->to($mailto); $this->email->subject($text_subject); $this->email->message($this->load->view('

c++ - Get real margins of image label in Qt -

c++ - Get real margins of image label in Qt - my application has custom qss, , have qlabel image. image has big margins, however, come style. this how label looks, qpixmap solid reddish show actual contents, white parts margins: the margins 11 pixels top , bottom, 7 pixels left part, , 45 pixels right. measured them image editor, , counted border part of margins. i tried these functions: qdebug() << label->contentsmargins() << label->margin(); but output qmargins(0, 0, 0, 0) 0 , though there (big) margins. how calculate real/actual margins of image label? finally managed real margins after looking qlabel::paintevent() source code. way: qrect cr = label->contentsrect(); cr.adjust(label->margin(), label->margin(), -label->margin(), -label->margin()); edit: in specific case seems label getting padding parent's style sheet, label->contentsmargins() returning zeroes because calling before showing. that is, code:

numpy - User defined filter for pandas dataframe -

numpy - User defined filter for pandas dataframe - iam writing qt based application showing tabular data. app uses pandas dataframes store information. user should able filter dataframes, e.x.: df = pandas.dataframe({ 'elevation': [10, 20, 15, 12, 100, 150, 200, 200], 'name': ['tree', 'tree', 'house', 'tree', 'house'] }) df[(elevation > 10) & (elevation < 200)] df[(elevation > 10) & (elevation < 200) & (name == 'tree')] how build such filter functions text input? tried utilize sympy convert function text input , lambdify later. expr = sympify("(x > 10) & (x < 200)") f = lambdify(x, expr, "numpy") f(df) if utilize dataframe input got error "the truth value of series ambiguous. utilize a.empty, a.bool(), a.item(), a.any() or a.all()". if utilize df.any() got true or false back, no index series... simple x > 10 expressions i

grails Command Object deep data binding -

grails Command Object deep data binding - i have 2 domain objects , 1 command looks like class vendor { string phonenumber public string tostring() { """[phonenumber: "${phonenumber ?: ''}"]""" } } class product { string productnumber vendor vendor public string tostring() { """[productnumber: "${productnumber ?: ''}", vendor: "${vendor}"]""" } } class saveproductcommand { product product } i have form looks like: <g:formremote> <input type="text" name="product.productnumber" value="12345" /> <input type="text" name="product.vendor.phonenumber" value="18005551212" /> </g:formremote> my controller phone call looks like: def save(saveproductcommand cmd) { // stuff } when examine product see like: [productnumber:

javascript - jQuery this.remove() -vs.- $('#id').remove() in Internet Explorer (IE 9+) -

javascript - jQuery this.remove() -vs.- $('#id').remove() in Internet Explorer (IE 9+) - why this.remove() doesn't work in ie9+? <input type="button" value="next1" id="nextbutton1"> <br> <input type="button" value="next2" id="nextbutton2"> $('#nextbutton1').on('click', function() { this.remove(); // works in browsers ie9+ }); $('#nextbutton2').on('click', function() { $('#nextbutton2').remove(); //works in browsers }); jsfiddle live version that's because you're using childnode.remove() method not supported browsers. this ---> refers node. //warning: experimental technology jquery's .remove() method, cross-browser , utilize have wrap this in $(...) this: $(this).remove(); childnode.remove() browser compatibility this.remove() supported next desktop browsers: - chrome 23+ - firefox 23+ - opera

linux - Why does specifying my shell change the EUID of root? -

linux - Why does specifying my shell change the EUID of root? - if specify shell /bin/bash in script, euid of root 0. if don't, , script runs in default shell (also /bin/bash), euid of root empty string! i'm new scripting , thought there no difference long bash ran show. the code i'm running checks if programme run root, , restarts programme sudo if not. #!/bin/bash echo euid = $euid echo shell = $shell if [ $euid -ne 0 ]; sudo "$0" exit $? fi when run, see euid = 1000 shell = /bin/bash euid = 0 shell = /bin/bash but if remove she-bang line, euid = 1000 shell = /bin/bash euid = shell = /bin/bash ./test.sh: 4: [: -ne: unexpected operator the script runs in same shell 4 times, why deed differently when sudo calls without specifying /bin/bash? i'm running ubuntu 14.04 if matters. thanks in advance! by removing shebang line, calling ubuntu default shell, dash, not bash. dash not define $euid , leading empty assig

Google GeoChart with province map for germany -

Google GeoChart with province map for germany - is possible utilize googles geochart api map specific high german province? create map options works fine. var options = { region: 'de', resolution:'provinces', }; but if seek utilize de-be instead of de, requested map not exist. because made error or map not exist? thanks robert yes, there no geochart province map federal republic of germany now. but, @asgallant says you can request additional maps making feature request. as per experience feature requests should seek vectorworkz.com feature within short period of time. vectorworkz geochart can create high german province map you can show in geochart. google-visualization

opencv - How to find the rotation between two binary images -

opencv - How to find the rotation between two binary images - i need find rotation angle between 2 binary images. can right rotation rotating images specified angle. can help please? i tried principle axis rotation angle doesn't give accurate result. can 1 suggest me improve method. , image anything. need not image uploaded here. images binary. for each image threshold image object pixels non-zero , background pixels zero find convexhull of non-zero pixels (you may utilize method cut down number of points utilize calculate convexhull, such first finding contours. main thought find convexhull) calculate minimum-area-rectangle using minarearect , it'll homecoming rotatedrect object (in c++). object contains rotation angle take difference note: approach not work if somehow resulting min-area-rect returns same angle though object rotation different. therefore, sense it's improve utilize other measures such moments of filled convexhull calculate ro

Edit DNS records with gcloud by reading/piping from file -

Edit DNS records with gcloud by reading/piping from file - i able edit dns records gcloud tool interactively editing json file vi/mate using command: gcloud dns records --zone=myzone edit however, able mass updates, this: gcloud dns records --zone=myzone edit < my-additional-records.txt ...where my-additional-records.txt contain dns records want add. i think not simple json file edit contains both add-on , deletion of dns records. so, tips appreciated. i think seek using linux line editor 'ed' this: editor=ed gcloud dns records --zone=myzone edit <<-eof 12i , { "kind": "dns#resourcerecordset", "name": "a.mydomain.org.", "rrdatas": [ "111.222.111.222" ], "ttl": 21600, "type": "a" } . ,wq eof this assumes top of edit file looks (so append add-on 12th line) { "additions":

AngularJs Directive to simplify form inputs -

AngularJs Directive to simplify form inputs - my company has theme requirements , has asked me research on angularjs. end, i'd show how angular can used implement our theme. here plunk of have far. here html of have works great. <form name="frmlogin" ng-submit="submit()" novalidate> <div class="form-field" data-ng-class="{'error': frmlogin.txtlastname.$invalid && frmlogin.txtlastname.$dirty && !frmlogin.txtlastname.$focused}"> <label for="txtlastname" class="required">email</label> <input id="txtlastname" name="txtlastname" type="text" data-ng-model="user.lastname" required autofocus ng-focus /> <div class="inline-validation" data-ng-show="frmlogin.txtlastname.$invalid && frmlogin.txtlastname.$dirty && !frmlogin.txtlastname.$focused"> {{geterror(frmlogin.tx

c++ - Remove stdc++ library dependency -

c++ - Remove stdc++ library dependency - i have library written in c++ isn't using stdc++ library because not available in platforms. however, still have stdc++ library dependency in libsmartrest.la makes libraries depending on library fail link. here configure.ac , makefile.am: # process file autoreconf produce configure script. # see http://www.openismus.com/documents/linux/building_libraries/building_libraries introduction. ac_init([cumulocity smartrest c++ library], [1.0.0], [support@cumulocity.com], [libsmartrest], [https://bitbucket.org/m2m/cumulocity-clients-c/]) # must come before am_init_automake. ac_config_macro_dir([m4]) # these automake arguments, not compiler arguments. am_init_automake([-wall foreign subdir-objects]) ac_prog_cxx am_prog_ar([act-if-fail]) lt_init # checks typedefs, structures, , compiler characteristics. ac_type_size_t # checks library functions. ac_check_funcs([strerror]) ac_func_malloc ac_config_headers([config.h]) ac_config_files(

c# - Added Comma when Printing DataTable as String -

c# - Added Comma when Printing DataTable as String - in next code passing through every element of datatable , adding string. foreach(datacolumn column in table.columns) { if (firstpass) { firstpass = false; continue; } toreturn += column.columnname + ","; } toreturn += ";"; firstpass = true; foreach (datarow row in table.rows) { foreach (datacolumn column in table.columns) { if (firstpass) { firstpass = false; continue; } toreturn += row[column].tostring() + " "; } firstpass = true; } homecoming toreturn; result: "cad,celiac,hypertension,anticoagulates,ace inhibitors,insulin,;176 25 296 109 73 " + "353 195 18 300 92 73 377 " can explain why string returned function has concatenation operator (plus sign)? trying create co

javascript - Asynchronous Kitten Issue -

javascript - Asynchronous Kitten Issue - i've been using mongoose query mongodb during web request like: kittens.find() .where('born') .gt(startdate) .lt(enddate) .exec(function (err, kittens) { if (err) { // bad kitty } // fun kittens res.jsonp(kittendata); }); unfortunately, if have many kittens this happens so need cut down amount of info pull back: get real start date , real end date create temp start date , temp end date 1 days worth of kittens increment temp dates 1 until temp end date past real end date the problem tried declare: var allkittens = []; and within loop query days worth of kittens: allkittens.concat(todayskittens); but allkittens tends still empty array. i'm not javascript ninja, don't know how run async kitten query numerous times , concatenate kittens need single array can utilize when send response. pwease help me javascript node.js mongodb

php - Array search dont know search -

php - Array search dont know search - i have array: include("config.php"); $start = "2014-06-20 08:00:00"; $data = mysql_query ("select * evenement start = '$start'"); $zaznam = mysql_fetch_array ($data); while($zaznam = mysql_fetch_array ($data)) { $arr2[] = $zaznam["resourceid"]; //store query values in sec array } if echo $arr2 this: array ( [0] => stk1 ) now create status array_search: if (array_search('stk1', $arr2)) { echo "arr2 contains stk1 <br>"; } else { echo "arr2 not contains stk1 <br>"; } but arr2 not contains stk1 how possible? im doing wrong? that totally right behaviour php. the documention homecoming value says: returns key needle if found in array, false otherwise. in case getting 0 evaluates false in if. you have check if value not false using !== operator. if (array_search('stk1', $arr2) !== false) { echo

c - Undefined elements in struct array -

c - Undefined elements in struct array - i creating client/server application , want phone call functions dynamically. have create next struct: typedef struct _cmd cmd; struct _cmd { const char *name; void (*func)(int s,int ac, char **av); }; when client send command server server browse through array of commands: cmd cmds[] = { { "create", cmd_create }, { "exit" , cmd_exit }, { "list", cmd_list }, { "read", cmd_read }, { "delete", cmd_delete }, { "update", cmd_update } }; cmd *find_cmd(const char *name) { cmd *c; (c = cmds; c->name; c++) { if (stricmp(name, c->name) == 0) homecoming c; } homecoming null; } please not stricmp() is not typo, case-insensitive version of strcmp. i next problem. when phone call find_cmd() , pass invalid commmand, application crashes. debugging messages showed foll