Posts

Showing posts from February, 2014

php - All my links showing just home page, htaccess issue -

i unable visit page, menu link redirect me same home page. here htacess file, didn't understand after lot of googling even. kind regards options +followsymlinks rewriteengine on rewritebase / #redirect 301 /?action=main.cancel_newsletter http://www.mysite.us/cancel rewritecond %{query_string} ^action=main.cancel\_newsletter$ rewriterule ^/*$ http://www.mysite.us/cancel? [l,r=301] rewritecond %{query_string} ^action=main.market\_news$ rewriterule ^/*$ http://www.mysite.us/news? [l,r=301] rewritecond %{query_string} ^action=main.profiled\_companies$ rewriterule ^/*$ http://www.mysite.us/profiledcompanies? [l,r=301] rewritecond %{query_string} ^action=main.adregister$ rewriterule ^/*$ http://www.mysite.us/register? [l,r=301] rewritecond %{query_string} ^action=main.register$ rewriterule ^/*$ http://www.mysite.us/register? [l,r=301] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* /index.php [l] <ifmodule mod_security

json - wpf databinding to downloaded data -

i having bit of trouble understanding correct way following: the data binding exists on internet json file. on timer tick, download , using javascriptserializer, deserialize class. now, want bind data when deserialize, creates new class, binding breaks (meaning have set itemssource or datacontext again). does know way around this? thanks! what control trying bind data to? if can bind observable collection data source, need clear observable collection before fetching data, , add fetched record collection post deserialization. if not use observablecollection, can add public properties viewmodel , refresh when data back. ensure refresh happens becuase view bound public properties of view model , not aware of object returned call.

How to insert JSON values into MySQL using PHP for an API creation? -

i have following json values: [newcomposemail={"msg":"test mail","senderuserid":"1006","subject":"test","to":"10002"}, composemail] my query is: insert `push_msg_table`(`pid`, `subject`, `msg`, `sentuserid`, `sent_time`, `upload_path`, `status`) values() i need insert these values mysql table. new json. try use in php json_decode(newcomposeemail,true); adding true proper array else return object in php if there multiple entries in json , have loop through json array, in order insert multiple entries in db

c# - Using Double datatype for if Statement -

double similarity = matcher.match(features1, features2); if (similarity== ?? ) // sould write here { application.exit(); } if feature1 , feature2 matches application should exit please me since double floating point type compare double using tolerance , e.g. double tolerance = 0.001; // instead of features1 == features2 if (math.abs(features1 - features2) <= tolerance) { application.exit(); }

javascript - Validation Twitter Bootstrap with Django -

i using django , twitter bootstrap. using following code validation. add more validations. example if variable django false return 'owner not exist'. tried following not working. <script type="text/javascript"> var test = {msg_owner|safe} $(document).ready(function() { $('#frm').bootstrapvalidator({ message: 'this value not valid', feedbackicons: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { 'owner': { validators: { notempty: { message: 'please enter owner' } test==false: { message: 'owner not exist' } } } }); }); </script> in server side

node.js - req param returns an empty array -

i using node.js , mongodb geolocation app , req param returns empty array exports.findpressure = function(req, res) { var queryobject = req.param('q'); console.log(queryobject); db.collection('pressure', function(err, collection) { collection.find( { loc: { $near :[ req.param('q') ] , $maxdistance : 5 }},{"value" : 1, _id : 0}) .sort({_id : -1}).limit(1).toarray(function(err, items) { res.send(items); }); }); }; the longitude , latitude values displayed in console listening on port 3000... connected 'weather' database 8.9068256,52.019347499999995 /pressure?q=8.9068256,52.019347499999995 200 27ms - 2b the url follows http://localhost:3000/pressure?q=8.9068256,52.019347499999995 if use values 8.9068256,52.019347499999995 getting value database if use req.param('q') returning empty array you seem passing values part of query string. req.query.q should contain comma-s

c# - Parsing Tab delimited text files -

i have tab delimited file columns , rows example: rows might not have value columns. know "order" doesn't change third tab delimited thing column3 , on. column1 column2 column3 .... column12 .... column34 ... column50 123 34 abc 234 def as@ddd.com true 45 nyc wwe@dsds.com false now need read file not of columns important program. example need stuff values in column2, column12,column45 what approach suggest? try following approach static void main(string[] args) { datatable datatable = new datatable(); streamreader streamreader = new streamreader(@"c:\temp\txt.txt"); char[] delimiter = new char[] { '\t' }; string[] columnheaders = streamreader.readline().split(delimiter); foreach (string columnheader in columnheaders) { datatable.columns.add(columnheader); // i've added column headers here. } while (

javascript - Js RegExp split every other line -

i'm new @ using regex , can't figure out how this. i have grouped data separated every other line, so: liste #1 val 1; val2; val3 liste #2 ... and output should : array( "liste #1 val 1; val2; val3", "liste #2 val 1; val2; val3" ) how acheive this? i split result again, forming structure : array(0 => ['title' =>, 'values' => array()]) assumed require 3 splits. why use regex, read 2 lines @ time? var lines = data.split('\n'); (var = 0; < lines.length ; = + 2) { var myarray = []; myarray.push(lines[i]); //this doesn't strip '\n' myarray.push(lines[i+1]); //this doesn't strip '\n' }

HTML/CSS Menu Active Link Background Not Aligned -

i have html menu uses class show page active within website. <div id="menu"> <ul> <li class="activelink"><a href="index.html">home</a></li> <li><a href="early.html">growing , school</a></li> <li><a href="career.html">films</a></li> <li><a href="jamesbond.html">james bond</a></li> <li><a href="gallery.html">pictures</a></li> </ul> </div> when i've been designing menu, have used firefox preview local files , looked fine. however, when viewed menu in chrome , ie, background shows menu item active out of line vertically within menu. please see http://jsfiddle.net/c9mzg/ in fact, when i've copied code jsfiddle , viewed in firefox, same problem chrome , ie shows reason, menu on local file still looks absolutely fin

php - Laravel update controller with many inputs -

i have resource , i'm trying set update controller. in case edit form has many inputs , need update database them there might columns in database not changed edit form. have controller this: public function update($id) { $hostess = hostess::find($id); $inputs=input::all(); foreach ($inputs $key => $value) { $hostess->$key= $value; } if ($hostess->save()) { return redirect::route('hostesses.show', $hostess->id); } return redirect::back()->withinput()->witherrors($hostess->geterrors()); } this gives me error because using put in view , column not found: 1054 unknown column '_method' in 'field list' because input::all() getting hidden inputs put method. can use input::except() that, proper way of updating laravel? you can this: $hostess = hostess::find($id) $post_data = input::all(); // or $post_data = input::except('_method'); // warning untested if bl

html - MySQL database to .TXT using PHP -

i have form in html5 , on submit runs php script connects mysql database, insert table , write down lines in table .txt file. for reason gives following warnings: 1 record added warning: fopen(c:/xampp2/htdocs/bap000/opdr002_config.txt): failed open stream: no error in c:\xampp2\htdocs\bap000\opdr002_input.php on line 25 warning: mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given in c:\xampp2\htdocs\bap000\opdr002_input.php on line 28 warning: fclose() expects parameter 1 resource, boolean given in c:\xampp2\htdocs\bap000\opdr002_input.php on line 33 the form: <html> <head> <title>bap les</title> </head> <body> <form name="formone" method="post" action="opdr002_input.php"> color: <select name="color"> <option value="blue">blue</option> <option value="red">red</option> </select> <br /> x: <input type="nu

python 3.x - redis-py and hgetall behavior -

i played around flask microframework, , wanted cache stats in redis. let's have dict: mydict = {} mydict["test"] = "test11" i saved redis with redis.hmset("test:key", mydict) however after restore stored = redis.hgetall("test:key") print(str(stored)) i see weird {b'test': b'test11'} stored.get("test") gives me none mydict str method result looks fine {'test': 'test11'} . so, why binary marker added restored data? checked in redis-cli , don't see explicit b markers there. wrong hgetall? this intended behavior. default, strings coming out of redis don't decoded. have couple options: decode data yourself. create client instance decode_responses argument, e.g., strictredis(decode_responses=true) . decode strings come redis based on charset argument (which defaults utf-8). you're sure every response redis has string data want decoded utf-8.

android - Corona SDK - Create Health Bar with different HP value -

i have rectangle image use health bar fill. health goes down, width of bar decreases until 0. part of code works fine, bar's width goes down , stays in same x position width being changed. my problem when create monster different hp value, different width of health bar. how can create same size rectangle different hp value? thank much. -- create health bar monsterbar = display.newrect( 20, 160, 26, 10 ) monsterbar:setreferencepoint(display.bottomleftreferencepoint) monsterbar:setfillcolor( 80,150, 0 ) -- monster hit monsterbar.width = monsterbar.width - scorehud.text monsterbar:setreferencepoint(display.bottomleftreferencepoint) you need use percentile intermediate value, can use in progress bar. for example, compute monster health percent that, making sure hp current <= hp max: local nmonsterhppercentile = (nmonsterhpcurrent / nmonsterhpmax) * 100 once have percentile value, adapt rectangle created max size of "100" example (or 200, 300 etc

c - char * to ASN1_INTEGER -

for pki certificate generation , , setting serial number , used rand_bytes 20 bytes of random serial number, wanted char * set serial number of certificate , seems of type asn1_integer * tried asn1_type_set_octetstring(asn1_type *, unsigned char *, len) since takes asn1_type * , not asn1_integer* gave crash how convert between unsigned char * asn1_integer ? thanks, i'm sure you're looking for, wrong. if want have 20-byte asn1_integer 1 way sending through bignum library first : unsigned char data[20] = {0}; rand_bytes(data, sizeof(data)); data[0] &= 0x7f; // build big number our bytes bignum* bn = bn_new(); bn_bin2bn(data, sizeof(data), bn); // build asn1_integer our bignum asn1_integer* asnint = asn1_integer_new(); bn_to_asn1_integer(bn, asnint); // todo: use asn1_integer // cleanup asn1_integer_free(asnint); bn_free(bn);

php - Looping through the arrays -

this original code [width] => array ( [0] => 400px [1] => 323a ) [height] => array ( [0] => 244px [1] => 244px ) [captions] => array ( [0] => [{ "captionid": 1,"caption": "learning clock face fun - learn importance of time.","xycordinates": "40px-250px","dimension": "70%-20%"},{"captionid": 2,"caption": "12 or 12 pm","xycordinates": "40px-250px","dimension": "70%-20%"}] [1] => [{ "captionid": 1,"caption": "learning clock face fun - learn importance of time.","xycordinates": "40px-250px","dimension": "70%-20%"},{"captionid": 2,"caption": "12 or 12 pm","xycordinates": "40px-250px&q

java - -accountId cannot be resolved or is not a field -

i can't figure out what's problem method, have arraylist named accounts i'm trying implement other class' method. i'm getting errormessage: "multiple markers @ line -accountid cannot resolved or not field -accountid cannot resolved or not field" why doesn't work? public boolean deposit(long pnr, int accountid, double amount){ for(int = 0; < customerlist.size(); i++) { if(this.pnr == pnr) { for(int j = 0; j < accounts.size(); j++) { if(accountid == accounts.accountid)//problem seem here { balance = balance + amount; } } } else return false; } return true; } accounts seems list, should try access field of item of list instead of accessing item of list itself. if(accountid == accounts.get(j).accountid

sql - MySQL Query help - Grouping and count problems -

i have mysql database trying specific count of data catch. best way explain showing you. i have table has username , id_no, id not going unique there circumstances show duplication of (which expected), table might this username id_no user1 1111111 user1 1111111 user1 1111111 user1 1111111 user1 2222222 user1 3333333 user1 3333333 user1 444444 user1 444444 user1 444444 user1 555555 user1 666666 i need unique count of piece of cake select username, count(distinct id_no) cases group username that gives me count of 6. gets interesting need join table add category table might username cat id_no user1 category1 1111111 user1 category2 1111111 user1 category2 1111111 user1 category2 1111111 user1 category5 2222222 user1 category6 3333333 user1 category7 3333333 user1 category8 444444 user1 category8 444444 user1 category8 444444 user1 category11 555555 user1 category12 666666 with need unqu

php - How to add a class to Composer for autoloading? -

i have class called class.feed.php , how include composer such when 'vendor/autoload.php' included or required in example index.php , class included? note, still php newbie. here's example of using composer. { "autoload": { "psr-0": {"appname": "src/"} } } set structure follows: src/ - appname/ vendor/ composer.json index.php place classes inside appname folder, use namespace class relative src folder. classes should have same filename class name starting capital, example class called demo in appname: <?php namespace appname; class demo { public function __construct(){ echo 'hi'; } } then in root create index.php include autoload vendor once composer has been installed. to use class call namespace followed class name <?php require('vendor/autoload.php'); $demo = new \appname\demo();

javascript - Destroying object -

there nice rich text editor scribe . in app have multiple editable divs on page, , on every focus event on particular div want turn div editable mode scribe. on blur event destroy instance of scribe, due fact having seperate instance every div high memory consuming. this amd module attaches scribe instance given dom element: define(['scribe'], function (scribe) { 'use strict'; function init(element) { var scribe = new scribe(element, { allowblockelements: true }); //... } return { attacheditor: init }; }); this piece of code makes use of module above: $('.editable').focus(function(e) { editormodule.attacheditor(e.target); }); and can't figure out how detach or destroy existing scribe instance. tried code: define(['scribe'], function (scribe) { 'use strict'; var scribe; function init(element) { scribe = new scribe(element, { allowblockelements: true });

java - Short filename causing issues with two otherwise identical Paths -

i used files.createtempfile("hello", "txt"); to create temporary file , stored returned path . i have eclipse ifile resource linked temporary file created: linkedfile.createlink(tempfile.touri(), iresource.none, null); if want path resource, call linkedfile.getlocation().tofile().topath() on local machine, works 100% fine. on remote test machine, 2 different paths: from files.createtempfile: c:\users\userna~1\appdata\local\temp\hello3606197456871226795txt from getlocation().tofile().topath() c:\users\username_testing\appdata\local\temp\hello3606197456871226795txt the folder username_testing , folder gets turned short filename, , direct creation of temporary. these 2 paths not considered equal path.equals(...) , causing failing of tests on remote machine. in general, makes me bit nervous using path.equals(...) though in actual real operation of application haven't had issues yet. there way can force system always use long filena

enthought - quit() function not working in Canopy, but works using terminal -

i'm learning python online @ moment , using (macos) canopy install of python. lesson how use quit() function try except. error in canopy: ---> 11 quit() 13 print 'your number is:', number nameerror: name 'quit' not defined ----------------- here code: try: inpt = raw_input('enter number: ') number = float(inpt) except: print 'error, please enter numeric number' quit() print 'your number is:', number all code print out number if put in that's not number, says 'error, please enter numeric number', instead of throwing error. same code works fine using terminal. i'm wondering, should using canopy or missing something? thanks canopy's python shell ipython's qtconsole. ipython has taken scientific python world storm in recent years power , convenience, , in respects proper superset of standard python, few of small convenience changes can confusing beginners. quit 1 of sma

powershell - Confirming an IP before starting an executable in winxp32 -

windows question y'all. have powershell v1.0 , that's making more difficult, first foray powershell. i'm linux/osx guy. to make matters worse on managed system, if didn't come winxp base install can't install it. i need basic while loop pings server1, , once has successful ping start task.exe all can find on technet , othe ms sites , web @ large powershell v3 or v4. sorry noob :( i don't remember v1 , wouldn't support anymore, , don't have system can test on think should work: do { $result = ping server1 } until ( $result -match 'received = [1-4]' ) & task.exe

javascript - Ajax call of php function does not send json array -

this javascript calls php function through ajax json datatype. data returned php should json array 3 items: html, todays_events, debug_text. on linux json returned isn't array. last item, debug_text returned, response['html'] null. this ajax call. $.ajax({ url: "get_events.php", type: "post", data: { user_id: user_id, todays_only: todays_only }, datatype: 'json', cache: false, async: false, success: function (response) { if (response != '') { if ( trim(response["html"]) != "" ) { var scroll_5_html = response["html"]; $("#scroll_5").html(scroll_5_html); } else { var filter_select = document.getelementbyid("filter_today").checked; if ( filter_select == true ) { noevents_text += "<br/>for today"; }

weblogic - SSL debug tracing may be required to determine the exact reason the certificate was rejected -

found below error in logs after starting weblogic. how solve issue? nothing have deployed here, new environment have installed recently. error message: apr 23, 2014 10:40:37 pm utc warning security bea-090482 bad_certificate alert received mt-dcs2-admin.com - 60.5.100.20. check peer determine why rejected certificate chain (trusted ca configuration, hostname verification). ssl debug tracing may required determine exact reason certificate rejected. enter code here < as error says, try enable debug mode see cause of problem. try this: http://docs.oracle.com/cd/e23943_01/web.1111/e13707/ssl.htm#autoid12 -dssl.debug=true -dweblogic.stdoutdebugenabled=true edit (first comment): you must add these arguments start of weblogic. depending on how run server, you'll have edit run script file. the standard startup script named startweblogic.cmd if you're running windows , startweblogic.sh if you're running unix (weblogic8). contents of windows , unix s

php - Get Last row value and N row value before last row -

how read , echo n rows before last row in text file using php? example in file.txt test1 test2 test3 test4 test5 test6 test7 i want last row value , 3 row before last row. result : test4 test7 here code far (just show last row) $line = ''; $f = fopen('\\\\192.168.183.28\\wk$\\sbin\\file.txt', 'r'); $cursor = -1; fseek($f, $cursor, seek_end); $char = fgetc($f); while ($char === "\n" || $char === "\r") { fseek($f, $cursor--, seek_end); $char = fgetc($f); } while ($char !== false && $char !== "\n" && $char !== "\r") { $line = $char . $line; fseek($f, $cursor--, seek_end); $char = fgetc($f); } $future_sn = substr($line, 28, 36); any advice? try $array = explode("\n", file_get_contents

php - array to string conversion return error of stdClass -

if($stmt->execute()){ $user = $stmt->get_result(); while ($obj = $user->fetch_object()) { $result[] = $obj; } } $result1encoded = json_encode($result); echo $result1encoded; // [{"uid":"1","firstname":"john"}] i used implode : echo $result1encoded = implode(' ',$result1); // expecting '[{"uid":"1","firstname":"john"}]' but says object of class stdclass not converted string you can use array_map("json_encode", $your_array) first convert each element of array string, , use implode glue together. see https://eval.in/141541 <?php $a = array(); $a[0] = new stdclass(); $a[0]->uid = "1"; $a[0]->firstname = "john"; $a[1] = new stdclass(); $a[1]->uid = "2"; $a[1]->firstname = "albert"; $b = array_map("json_encode", $a); echo implode(&#

java - What is JBPM? Why use it? -

i java developer. develop new application framework. in application going integrate jbpm, spring , hibernate also. so please, answer below questions, what jbpm? why use it? what workflow engine? please give example. thanks answer. quoting wikipedia : jbpm open-source workflow engine written in java can execute business processes described in bpmn 2.0 (or own process definition language jpdl in earlier versions). released under asl (or lgpl in earlier versions) jboss community. for complete information can check this out. quoting wikipedia : a workflow engine software application defines process, rules governing process decisions, , routes information. key component in workflow technology , typically makes use of database server. the relationship: jbpm flexible, extensible workflow management system. business processes , expressed in simple , powerfull language , packaged in process archives, serve input jbpm runtime server. jbpm bridges gap

cocoa - How to prevent logout from app running as agent -

the sample menu bar app agent lsuielement true. want prevent logout on conditions. i tried - (nsapplicationterminatereply)applicationshouldterminate:(nsapplication *)sender. never receive message when user logs out. but without , able prevent logout well. need alternative solution prevent logout. do not use lsuielement in plist. instead on launch use: [nsapp setactivationpolicy:nsapplicationactivationpolicyaccessory]; i verified applicationshouldterminate: in fact called when done way.

gwt - Multiple Click handlers -

i have different 3 different buttons different onclick events : add.addclickhandler(new clickhandler() { @override public void onclick(clickevent event) { add(); } }); set.addclickhandler(new clickhandler() { @override public void onclick(clickevent event) { set(); } }); get.addclickhandler(new clickhandler() { @override public void onclick(clickevent event) { get(); } }); so if extend 10 buttons script far long, there way pass methode or seperate handlers? suppose have view: customview.ui.xml <g:verticalpanel> <style:button ui:field="addbutton" text="add"/> <style:button ui:field="setbutton" text="set"/> <style:button ui:field="getbutton" tex

Fortran - Segmentatation fault (core dumped) -

this kind of follow questions fortran array dynamic size, easy r function seq() , asked previoulsy, in sense still same error when run program: program received signal sigsegv: segmentation fault - invalid memory reference. backtrace error: #0 0x7f13e6fd87d7 #1 0x7f13e6fd8dde #2 0x7f13e6929fef #3 0x4014b6 in fillmatrix_ #4 0x40270e in main__ @ dyn.f90:? segmentation fault (core dumped) i made slight changes program: program dyn implicit none real(kind=8), allocatable :: k(:), tt1(:), p(:) real(kind=8), allocatable :: fitness(:,:), k_opt(:,:) real(kind=8) :: dk = 0.1, dp = 0.1 integer :: j,l,m,lk,lp,lt external :: derivate, fillmatrix k = 0.1*dk*[(j,j=0,999)] ! vector of basal expression levels p = 0.4*dp*[(l,l=1,1000)] ! vector of period lengths tt1 = 0.1*dk*[(m,m=0,999)] ! vector of values t1/t lk = size(k) lp = size(p) lt = size(tt1) call fillmatrix(k,p,t

Nuget update when package was installed with ExcludedVersion -

i wondering whether possible update package installed /x flag? me seems not possible right now. mean updating making packages.config change greater version of given package (done nuget.exe update solutionname.sln) what flow of update operation? inside nupgk of installed package? or search version within directory name? when version in directory name missing there problem version comparison? i need precise explanation. note: use nuget 2.8.50224.430 i created identical thread on nuget codeplex here: https://nuget.codeplex.com/discussions/543299 i think managed answer own question. while waiting response decided @ nuget.exe sources , find how version installed package gathered. what realized: 1. version taken directly packages.config. 2. nuget update command looks packagename.packageversion.nupkg in packages directory. 3. when wanted file not exists, update cannot completed (it aborted). i tried change code use directory , package name without version. possi

sql - combining count(column) with count(column) in same table (MSSQL) -

i missing obvious here, if wanted combine this select location, count(location) item group location with this select collection, count(collection) item group collection in same result set. want see how many items in each collection @ each location. edit: i'd see location column , collection row edit: looks i'll need pivot make happen is simple this?: select location,collection, count(*) item group location,collection that's sprang mind from how many items in each collection @ each location. but if it's wrong, maybe should add sample data , expected results question.

css - How to achieve equal height of inner divs and float:left at the same time? -

i had 4 containers 4 inner divs, floated left auto height. <div class="box"> <div class="head"> heading text </div> <div class="image"> image </div> <div class="text"> integer posuere erat ante venenatis dapibus posuere velit aliquet. </div> <div class="link"><a href="#">link text</a></div> .box{ width: 150px; float: left; } complete jsfiddle: http://jsfiddle.net/h8w32/ to make inner divs height same througout of 4 containers, changed floated layout, , used display:table instead. <div class="table"> <div class="row head"> <div class="cell">heading text</div> <div class="cell">here lot longer heading text examplify</div> <div class="cell">heading text</div>

java - Twitter4j: getUserTimeline method sometimes returns http status code 405 when I call user timeline api continuously -

i trying recent 1000 tweets of 2000 twitter users using rest api's getusertimeline() method. works fine of times times stops executing returning http status code 405. respose code follows failed timeline: server returned http response code: 405 url: https://api.twitter.com/1.1/application/rate_limit_status.json?include_entities=1&include_rts=1 the full stack trace is: server returned http response code: 405 url: https://api.twitter.com/1.1/application/rate_limit_status.json?include_entities=1&include_rts=1 relevant discussions can found on internet at: http://www.google.co.jp/search?q=f68ccb24 or http://www.google.co.jp/search?q=6c2d1c77 twitterexception{exceptioncode=[f68ccb24-6c2d1c77 8612d0f1-19766e3f 8612d0f1-19766e30], statuscode=-1, message=null, code=-1, retryafter=-1, ratelimitstatus=null, version=3.0.6-snapshot(build: afd755d42f0c2fd7a2a87cedf1e91e123de2d754)} @ twitter4j.internal.http.httpclientimpl.request(h

java - initializing more than one JFrame creates blank JFrames -

i'm new swing , i'm having trouble replacing existing jframe. initialize first jframe without problem... main: public static jframe jf; public static int state = 0; public static void main(string args[]) { jf = new mainmenu(); jf.setvisible(true); while (state != -1) {} } mainmenu: public mainmenu() { settitle("battleship"); setdefaultcloseoperation(jframe.exit_on_close); setbounds(100, 100, 450, 300); contentpane = new jpanel(); contentpane.setborder(new emptyborder(5, 5, 5, 5)); setcontentpane(contentpane); jbutton btnsingleplayer = new jbutton("single player - easy"); btnsingleplayer.addmouselistener(new mouseadapter() { @override public void mouseclicked(mouseevent arg0) { gamedriver gd = new gamedriver(1); } }); jbutton btnsplitscreenmultiplayer = new jbutton("split screen multiplayer"); btnsplitscreenmultiplayer.addmouselistener(new mo

windows - Using a VB6 program to check another VB program's Error Codes -

i need develop "watchdog" program detect when program has crashed, kill process , restart it. unfortunately, original developer of program no longer here, , computer no longer able compile without buying expensive license. program in question crashes vb error code ("runtime error 5 ... etc). need detect when program enters state. alternatively, need able see first program's error handler if possible, can check if in "trappable" error, or @ least, able check current status of program in question. programs isolated each other. cpu makes every program thinks it's program running and, in 32 bit, has 4 gb of memory it's self. program cannot affect or monitor another. so debugging exception above because computers wouldn't usable without , built cpu/os. so run vb6 program under debugger, biz computers have ntsd installed. note not basic debugger machine code debugger. if it's window wait window title. can use api calls findwindo

api - Apigee SpikeArrest Sync Across MessageProcessors (MPs) -

our organisation migrating apigee. i have problem similar one, due fact stackoverflow newbie , have low reputation couldn't comment on it: apigee - spikearrest behavior if there way merge 2 questions please let me know. so, in our organisation have 6 messageprocessors (mp) , assume working in strictly round robin manner. please see config (it applied target endpoint of apiproxy): <?xml version="1.0" encoding="utf-8" standalone="yes"?> <spikearrest async="false" continueonerror="false" enabled="true" name="spikearrest-1"> <displayname>spikearrest-1</displayname> <faultrules/> <properties/> <identifier ref="request.header.some-header-name"/> <messageweight ref="request.header.weight"/> <rate>3pm</rate> </spikearrest> i have rate of 3pm, means 1 hit each 20sec, calculated according apigeedoc1 . the

Cannot set the time on Debian Wheezy -

i have problem setting system time on debian 7.4 wheezy machine. machine virtualbox guest vm. did following: /etc/init.d/ntp stop date -s 2014-05-01 after these commands, time updated, changes real time after few seconds. thought, disabling ntp should trick. in fact, did in past. time seems else manipulating system clock automatically. i'm kind of lost here. highly appreciated. this virtualbox issue. automatic setting of system time can deactivated on host via: vboxmanage setextradata <vmname> “vboxinternal/devices/vmmdev/0/config/gethosttimedisabled” “1″ see: http://rickguyer.com/virtualbox-disable-time-sync-between-host-and-client/

jquery - returning the same Offset top value on a group of different divs -

i have this: <div class="all"> <div class="first"></div> <div class="second"></div> <div class="third"></div> <div class="four"></div> </div> and trying offset of divs inside "all". i doing this: $( ".all div" ).each(function( ) { var etop=$(this).offset().top; console.log(etop); $(window).scroll(function() { console.log(etop - $(window).scrolltop()); }); }); it returns same value 4 divs. think returning "scrolltop", not offset. in css, has position:relative , child divs have position:relative well. anyone can me? thanks lot

ruby - Way is my code showing the output before getting all inputs? -

i'm creating program asks number of inputs needed, , bubbles sort these inputs. code: def bubble_sort(list) sl = list.clone sl.each_index |i| ( sl.length - - 1 ).times |j| if ( sl[j+1] < sl[j] ) sl[j], sl[j+1] = sl[j+1], sl[j] end end end end puts "enter number of elements" n = gets.chomp puts "enter #{n} elements" n.to_i.times (list ||= []) << gets.chomp bubble_sort(list) p ('sorted elements:') p (list) end i have tested bubbling loop , it's working fine. problem have output, program asks each input in new line, whenever entered input, shows output , doesn't wait inputting other elements. can me out of how fix make program hold output until finishes inputs? you put p(list) (as bubble_sort(list) , ton of other stuff) in element-gathering loop. if don't want them done part of loop, should put them outside.

java - retrieving List<Entity> from List<Object[]> JPA -

i have entity class calle publication, method called getallpublication return list<publication> , query inside method has resultlist of type list<object[]> , how can retrieve list of publication entity fromthe list<object[]> : -here method : public list<publication> getallpublication() { list<object[]> listepublication; query q; em.gettransaction().begin(); q=em.createquery("select c.titrepublication, c.datepublication, c.corps,p.login publication c join c.employee p "); listepublication = q.getresultlist(); //arraylist<publication> results = new arraylist<publication>(); //for (object[] resultat : listepublication) //results.add((publication) resultat[0]);*/ em.gettransaction().commit(); return results; } thanks in advance. here entity class package entities; import java.io.serializable; import javax.persistence.*; @entity @namedquery(name="publication.findall", que

java - Bukkit dispatchCommand not working -

i starting out java. i'm trying simulate command being triggered. i'm having troubles following: log.log(level.info, line); //outputs "say text here" bukkit.getserver().dispatchcommand(bukkit.getconsolesender(), line); bukkit.getserver().dispatchcommand(bukkit.getconsolesender(), "say hi"); bukkit.getserver().dispatchcommand(bukkit.getconsolesender(), "help"); they "unknown command. type "help" help." in server cmd window. idea doing wrong? i found causing it; being caused me using development snapshot version of craftbukkit rather recommended build.

javascript - Click functions do not fire without page refresh -

ok, have seen ask many times, , solutions thant work other users. none has satisfied need. in nutshell, using jquery mobile a ui touch screen desktop browser application. my index page contains 2 jqm pages (#page1, #page2), every click event works fine within dom ready function. when change external page after #page2 via $.mobile.changepage("newpage.php?param1=1&param2=2"), { transition : "slide"} ); parameters passed fine, however, none of click events work without requiring page refresh. when reload page gravy, notice again if navigate index page external page, continue have same problem unless refresh done. any insight appreciated....noting out there has remotely worked. , not going use page refresh work around. thank in advance. my apologies no code example, thought problem rather trivial. here goes.. document 1(index.php) javascript <script> $(document).ready(function() { ////////home functions $( "#issuespincoilbtn

java - How to decorate a TableCellRenderer with Graphics related instructions? -

i'm implemting tablecellrenderer s using decorator design-pattern. works nice , long need decorate returned component decorated renderer in such manner can performed inside scope of gettablecellrenderercomponent(..) . how can decorate returned component such cases need graphics object in paint process? in particular - inside paintcomponent(graphics g) method? example, when want draw line simple setborder(..) not suffice: import java.awt.color; import java.awt.component; import javax.swing.jtable; import javax.swing.table.tablecellrenderer; import javax.swing.table.defaulttablecellrenderer; public class mytablecellrendererdecorator extends defaulttablecellrenderer { private tablecellrenderer decoratedrenderer; private component decoratedcomponent; public mytablecellrendererdecorator(tablecellrenderer decoratedrenderer) { super(); this.decoratedrenderer = decoratedrenderer; } @override public component gettablecellrenderercomp