Posts

Showing posts from August, 2014

php - Find the network distance between two IPv4 addresses (not geographic distance) -

given ipv4 address (needle) , unsorted array of ipv4 addresses (haystack), how programmatically determine single address in given haystack closest (network-wise, not geographically) needle? since don't have access netmask of every address, solution should ignore netmasks , traceroute alike options. all sorts of addresses used, mean: private, reserved, broadcast, lan , wan. any in form of theory, pseudo-code, python, php or perl welcome. the question getting ip address list between 2 ip addresses similar, quite cut it. i'm still not quite sure you're asking, based on comment @petergibson closest meant, 192.168.1.101 closer 192.168.56.1 172.30.130.66 . , 192.168.1.254 closer 192.168.1.240 192.168.2.1 you try following python code distance function: import socket def dist(a, b): def to_num(addr): # parse address string integer quads quads = map(ord, socket.inet_aton(addr)) # spread quads out return reduce(l...

html - use width inside of calc -

i trying this: .my-style { width: 50px; margin-left: calc(50% - calc(width / 2)); } later changing width 90px , want margin grow accordingly. doesn't work. possible? the newest browser's should support it, tried following code. this webkit example made, check in chrome css p { -webkit-var-a: -webkit-calc(1px + 3px); margin-left:-webkit-calc(-webkit-var(a) + 5px); } html <p>this text should have margin-left, doesn't</p> fiddle http://jsfiddle.net/uqe8b/ if inspect <p> element can see see code valid, doesn't anything... seems have use javascript, less or equivelent it's still experimental feature. edit: it does seem work when make var plain number: p { -webkit-var-a: 3px; margin-left:-webkit-calc(-webkit-var(a) + 5px); } http://jsfiddle.net/uqe8b/1/ so answer question, yes possible, not recommend now. css .my-style { height:100px; background-color:bl...

why ffmpeg is not working in new installation -

i working on live encoding ffmpeg last few days. 1 day re-installed os , tried run ffmpeg commands again after configuration. publish points in starting not started. why? missing configuration required? the command trying run is: ffmpeg -y -re -i d:\video2.mp4 -pix_fmt yuv420p -movflags isml+frag_keyframe -f ismv -threads 0 -c:v libx264 -preset fast -profile:v baseline -map 0:v -b:v:0 800k http://localhost/pps/publishpoint.isml/streams(encode r1) output got in command prompt is: ffmpeg version n-54772-g53c853e copyright (c) 2000-2013 ffmpeg developers built on jul 16 2013 22:25:42 gcc 4.7.3 (gcc) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena ble-libopencore-amrnb --enable-libopencore-amrwb --enable-...

Use library Windows.Networking.Sockets ( metro app ) in a dekstop app c# -

recently i've developped c# metro app works , want developp same app in c#. i've done few things enable use of metro app library website library windows.networking.proximity still working, windows.security.cryptography apparently windows.networking.sockets doesn't work. goal in part of code, receive data sent smartphone wifi: namespace openitformedesktop{ class server { private streamsocketlistener serverlistener; public static string port = "3011"; public static string adressip = "192.168.173.1"; private hostname hostname; //initialize server public server() { serverlistener = new streamsocketlistener(); hostname = new hostname(adressip); listen(); } //create listener waiting connection private async void listen() { serverlistener.connectionreceived += onconnection; try { //await serverlistener.bindendpointasync(hostname, port); ...

java - Refresh TabActivity on TabHost -

i have same code: public class mainactivity extends tabactivity { private tabhost mtabhost; private void setuptabhost() { mtabhost = (tabhost) findviewbyid(android.r.id.tabhost); mtabhost.setup(); } @override protected void oncreate(bundle savedinstancestate) { setcontentview(r.layout.activity_main); // create tabs , etc... setuptabhost(); mtabhost.gettabwidget().setdividerdrawable(r.drawable.tab_divider); setuptab(new textview(this), "category", "category.class"); setuptab(new textview(this), "top", "top.class"); setuptab(new textview(this), "favorite", "favorite.class"); } private void setuptab(final view view, final string tag, final string classname) { view tabview = createtabview(mtabhost.getcontext(), tag); tabhost tabhost = gettabhost(); tabhost.tabspec spec; intent intent; intent = new intent().setclass(this, category....

How to directly upload files from browser to Google Cloud in Rails -

i have rails app allows users upload files. upload (via post) server, uses fog gem upload google cloud storage. problem files universally available knows url, want prevent. so have 2 issues i'd solve: i'd enable users upload google directly browsers i'd prevent downloading files, users logged app i have downloaded p12 file google api generated, i'm stuck. according documentation need generate key (done google-api-client gem) , signature (not done) , put post headers if understood correctly? does has example use? edit: got done, secret in interoperable storage access keys , sha1 , google documentation doesn't say. i'll cover solution in blog post shortly. here example of generating signed urls in python . details different in ruby, process same.

simulation - C++ simulate pressing of equal sign (=) and question mark (?) -

having problems simulating keypress of equal sign (=) , question mark (?). figured if there's no virtual key code two, should combine key presses , releases guy did ctrl-v: http://batchloaf.wordpress.com/2012/10/18/simulating-a-ctrl-v-keystroke-in-win32-c-or-c-using-sendinput/ my code "=" (shift + "+"): input ip; ip.type = input_keyboard; ip.ki.wscan = 0; // hardware scan code key ip.ki.time = 0; ip.ki.dwextrainfo = 0; ip.ki.wvk = vk_lshift; ip.ki.dwflags = 0; // 0 key press sendinput(1, &ip, sizeof(input)); // press "+" key ip.ki.wvk = vk_oem_plus; ip.ki.dwflags = 0; // 0 key press sendinput(1, &ip, sizeof(input)); // release "+" key ip.ki.wvk = vk_oem_plus; ip.ki.dwflags = keyeventf_keyup; sendinput(1, &ip, sizeof(input)); // release "shift" key ip.ki.wvk = vk_lshift; ip.ki.dwflags = keyeventf_keyup; sendinput(1, &ip, sizeof(input)); it outputs "+" sign. need work on, preferably windows os,...

c# - Convert String Into Dynamic Object -

is there straightforward way of converting: string str = "a=1,b=2,c=3"; into: dynamic d = new { = 1, b = 2, c = 3 }; i think write function splits string , loops results create dynamic object. wondering if there more elegant way of doing this. you may use microsoft roslyn ( here 's all-in-one nuget package): class program { static void main(string[] args) { string str = "a=1,b=2,c=3,d=\"4=four\""; string script = string.format("new {{ {0} }}",str); var engine = new scriptengine(); dynamic d = engine.createsession().execute(script); } } and if want add more complex types: string str = "a=1,b=2,c=3,d=\"4=four\",e=guid.newguid()"; ... engine.addreference(typeof(system.guid).assembly); engine.importnamespace("system"); ... dynamic d = engine.createsession().execute(script); based on question in comment, there code injection vulnerabilities. add...

hibernate - when or why do i use Property.forName()? -

what difference between : list cats = session.createcriteria(cat.class) .add( restrictions.like("name", "f%") .list(); and list cats = session.createcriteria(cat.class) .add( property.forname("name").like("f%") ) .list(); or matter, difference between : criteria cr = session.createcriteria(user.class) .setprojection(projections.projectionlist() .add(property.forname("id").as("id")) .add(property.forname("name").as("name")) and criteria cr = session.createcriteria(user.class) .setprojection(projections.projectionlist() .add(projections.property("id"), "id") .add(projections.property("name"), "name")) property.forname("propname") returns matching property instance. having said this, means there no difference between first 2 code snippets posted in question. should use property.forname("pr...

Windows Phone 8 Application Bar Button Long Tap Event -

i working on windows phone 8 c# application. have long tap events of forward , backward buttons have placed in application bar, found click event application bar button. please let me know how capture long tap event application bar button? thanks in advance this not possible. applicationbar api quite restrictive, deliberate move microsoft ensure consistency. cannot handle arbitrary events applicationbar. if want kind of behaviour, have build own ui support it. it worth noting users not expect 'long press' (more commonly referred tap-and-hold) behaviour on app-bar.

Why is my HAML and Ruby loop still not working? -

i have same question in " haml , ruby loop , ul not working ", except think have proper indentation, , it's still not working. my haml code is: %ul.thumbnails - @images.reverse_each |image| %li.span2 %div.thumbnail the output is: <ul class="thumbnails"></ul> <li class="span2"> <div class="thumbnail"></div> </li> i think indentation in haml code looks right, doesn't it? have no idea wrong. sergio's answer helped me. apparently have indent plain ruby well.

jqGrid filter toolbar show search operator selector just for single column -

Image
i have jqgrid table many columns. searching in grid made using filter toolbar. of them search simple default operator. 1 datetime column want different kind of operators , datepicker selector. have added datainit datepicker initialization searchoptions , necessary operators searchoptions.sopt . show operators have set searchoperators true. column ok. have datepicker operator selector popup. other columns default operator icon shown on left of it. annoying operator default , user couldn't change it. there possibility hide them using jqgrid api? far see hide using custom code: i need check column model , after rendering of grid (may in loadcomplete ) columns have empty sopt or sopt.length == 0 remove operator selector. or add css class hide it. not sure of these solution better (hide or remove) because removing broke logic, , hiding affect width calculation. here sample of mean on fiddle function fixsearchoperators() { var columns = jquery("#grid").jqgrid (...

ASP.NET: How can i update hidden field in JQuery or Javascript? -

i have hidden field in view. have list of strings put comma separated values in hidden field. trying access hidden field. possible? other best practice? have tried $('input[name=hiddeninputname]').val(thevalue);

ios - Passing Data between View Controllers -

i'm new ios and, objective-c , whole mvc paradigm , i'm stuck following: i have view acts data entry form , want give user option select multiple products. products listed on view uitableview controller , have enabled multiple selections. my question is, how transfer data 1 view another? holding selections on uitableview in array, how pass previous data entry form view can saved along other data core data on submission of form? i have surfed around , seen people declare array in app delegate. read singletons don't understand these , read creating data model. what correct way of performing , how go it? this question seems popular here on stackoverflow thought try , give better answer out people starting in world of ios me. i hope answer clear enough people understand , have not missed anything. passing data forward passing data forward view controller view controller. use method if wanted pass object/value 1 view controller view controller may pu...

java - how to find the ppi of an android screen -

i have simple question? i'm looking code find ppi of android screen know how find height , width in pixles not amount of pixels per inch. need me find diagonal of screen. tried doesnt seem work displaymetrics displaymetrics = new displaymetrics(); windowmanager wm = (windowmanager) getapplicationcontext().getsystemservice(context.window_service); int ppi = (int) displaymetrics.density; maybe this? displaymetrics metrics = getresources().getdisplaymetrics(); see here

extjs - Button to another Page with Sencha Touch -

i created little homepage sencha touch. want use buttons link site/page. how can that? don't want use standard tab bar. ext.define('rma-app.view.main', { extend: 'ext.container', xtype: 'main', requires: [ 'ext.titlebar' ], config: { items: [ { docked: 'top', xtype: 'titlebar', title: 'rma-app' }, { xtype: 'button', text: 'event anlegen', ui: 'normal', iconcls: 'add', iconmask: 'true', iconalign: 'top', margin: '5 5 5 5' }, { xtype: 'button', text: 'events anzeigen', ui: 'normal', iconcls: 'list', iconmas...

javascript - Loop through a game board represented by a matrix and analyze all possible 3 in a row winning positions -

i have 6 x 6 game board, represented following array: gameboard= [ 0 , 1, 2, 3, 4, 5, 6 , 7, 8, 9,10,11, 12,13,14,15,16,17, 18,19,20,21,22,23, 24,25,26,27,28,29, 30,31,32,33,34,35 ] i working on game of hybrid tic tac toe. here first step (cpu's turn): loop through each position of board for(var i=0, len = gameboard.length; < len; i++){ } now, lets @ position 8. my logic check surrounding positions (1,2,3,7,9,13,14,15) for: if there "x" (opponent), score = 0; if there blank space, sc0re = 1; if there "0", score = 2 at end, store inside array. the position biggest score array, position cpu play. finally, question: how code above logic inside loop? , keeping in mind there positions 0,1,2,4... aren't surrounded other positions can't use logic above everywhere. here have tried , thinking of building on: function scorecalc(pos){ console.log("score: "+pos...

objective c - iOS: Determine if there are notifications in the Notification Center -

i working on application right , need determine if there notifications (for app, of course) in notification center. i'd know if knows way access app's notifications in notification center. i not sure if understand correctly. if want retrieve list of notifications apns, , "proper" way rely on standard push notification mechanism (you can find in push notification tutorial). catch notification when comes, , store them somewhere, within nsarray maybe. there no way retrieve push notifications when still on server . is, obviously, because haven't come device yet!

java - Collision of static variables for two applications in the same jvm -

i have applet application uses several static objects (and can not rid of them). application launched html page. browser creates single jvm amount of tabs , if open 2 tabs application, static variables shared both of them. both won't work correctly after this. we've tried use separate_jvm doesn't work in every browser. is there other solution? this test case demonstrates how static field in single class can have different values, in same jvm, when loading class 2 instances of classloader: @test public void test() throws exception { myloader customloader1 = new myloader(); myloader customloader2 = new myloader(); class<?> c1 = customloader1.loadclass(special_class_name); class<?> c2 = customloader2.loadclass(special_class_name); loadedclass o1 = (loadedclass) c1.newinstance(); loadedclass o2 = (loadedclass) c2.newinstance(); o1.setstaticpart(100d); o2.setstaticpart(1d); assertequals(100d, o1.getstaticpar...

python - django-autocomplete key error -

i installed via pip install django-autocomplete , django autocomplete 's documentation said. then, added code, following documentation given. i error: keyerror: gestion.clientes and also, when try import views module gestion app, says attributeerror: 'module' object has no attribute 'autocomplete' it seems cannot import gestion/views.py, since there's circular import going on... tried attack issue in many ways, i'm stucked... here's app files the app called "gestion", i'm running django 1.3 in virtualenv python2.7 gestion/views.py # -*- encoding: utf-8 -*- django.core.paginator import paginator, pagenotaninteger, emptypage, invalidpage django.shortcuts import render_to_response,render django.contrib import messages django.http import httpresponseredirect, httpresponse django.core.urlresolvers import reverse django.core import serializers import models django.db.models import q django.utils import simplejson autocomplete....

c# - Html Agility Pack - loop through rows and columns -

i getting involved on parsing html files using c# language , htmlagilitypack. i trying each row 2 columns values insert them database. running following: foreach (htmlnode row in htmldoc.documentnode.selectnodes("//tr")) { foreach (htmlnode cell in row.selectnodes("//td")) { console.writeline(cell.innertext); } } i got error loop on td , not ones includes in current tr. my html looks this: <table> <tr> <th align="center" width="50"><b>column 1</b></th> <th align="center" width="210"><b>column 2</b></th> </tr> <tr bgcolor="#ffffff"> <td align="left"> </td> <td align="left"></td> </tr...

Debugging Android NDK C/C++ code in Eclipse - breakpoints are not hit -

i downloaded android sdk bundle linux , android ndk. adt installed, installed cdt. i created android project , added native support (jni). wrote native function in java-code exporting in c++ code. in c++ code defined function. java-code: static { system.loadlibrary("test"); } private native string get_text_from_cpp(); c++ code (h): extern "c"{ jniexport jstring jnicall java_com_example_test_mainactivity_get_1text_1from_1cpp(jnienv *, jobject); } c++ code (cpp): jniexport jstring jnicall java_com_example_test_mainactivity_get_1text_1from_1cpp(jnienv * env, jobject){ return env->newstringutf( "hello c++" ); } code works without errors. when set breakpoint in c++ code not hit. build-nkd ndk_debug = 1 - included i followed instructions http://tools.android.com/recent/usingthendkplugin android.mk in jni/ has local_cflags := -g i have read information could't customized eclipse. please, anybody. ps: sorry english ...

ruby on rails - Capistrano task from another task with parameters -

my question similar how invoke 1 capistrano task another? the thing want being able pass parameters bar when calling foo: task :foo # calls bar, pass params (i.e n = 10) # if calling cap bar -s n=10 # bar not take arguments bar end task :bar if exists?(:n) puts "n is: #{n}" end end capistrano tasks can't parameterized. can define helper method, follows: task :foo bar(10) end def bar(n=variables[:n]) puts "n #{n}" end if you're dead set on having :bar task well, try trick: task :foo bar(10) end task :bar { bar } def bar(n=variables[:n]) puts "n #{n}" end note task must declared before method.

Which method to override in android fragment to populate a listview -

i have activity holds fragment , fragment hold list view , button, when pressed button directs fragment b. my question method need override in fragment when pressed button, can re-populate list view inside. or there simple way can make ? until tried override onresume , onstart, didnt work. btw cant override button pressed in fragment b because in case cant reach ui components in fragment b , getting null pointer normally. thanks in advance. your no notice when previous fragment show again. can override onbackpressed() method of fragment's parent activity this: @override public void onbackpressed() { //1.find fragment tag, tag supplied //when using fragmenttransaction.add(int id, fragment fragment, string tag) //the can find fragment way //fragmenta fragment = getsupportfragmentmanager().findfragmentbytag(name) //2.call method of it! }

javascript - why aren't my images showing up -

hi i'm trying learn how use easeljs libraries, combining of extjs libs butt i'm having trouble putting code in .js files. js file looks this var democanvas = document.createelement('canvas'); document.body.appendchild(democanvas); democanvas.height = "400"; democanvas.width = "600"; function init() { var canvas = document.getelementbyid("democanvas"); var stage = new createjs.stage('canvas'); var im = new createjs.bitmap("dbz.jpg"); // im.regx - im.image.width *.2; // im.regy - im.image.height *.2; stage.addchild(im); stage.update(); im.addeventlistener("click", function(){ var seed = new createjs.bitmap("seed.jpg"); seed.alpha = 0.5; seed.x = window.event.clientx; seed.y = window.event.clienty; stage.addchild(seed); stage.update(); }); //end seed evenlistener */ } //end functin init() this doesn't work, if comment out whole document.createelement('canvas') section , a...

jqgrid - Different custom formatters for inline and form editing -

is there way show different custom formatter cell , form editing? i'm using custom formatter cell, defined in colmodel following formatter:functionname but not work on edit form. i think there misunderstanding when custom formatter used. used filling grid body , not during editing (cell, inline or form editing). can need implement custom editing control ( edittype: "custom" , editoptions custom_element , custom_value callback functions}). should describe more need implement. see the answer , this one , this one more examples implementing of custom editing controls.

Rails - Display flash notice before running method -

i have method in controller index action, add_product_data , updates product data if title of first or last product nil . flash message display if title of first or last product nil , before add_product_data method called, user knows why request taking long. what have: def index if params["rating_set_id"] @products = product.find(:all, :joins => :rating_sets, :conditions => ["rating_set_id = ?", params["rating_set_id"]]) if @products.first.title.nil? && @products.last.title.nil? redirect_to :back, :flash => { :notice => "updating missing product data..." } fetchrec.add_product_data(@products) end @rating_set = ratingset.find(params["rating_set_id"]) @unique_dept = product.find_by_sql("select dept products dept <> '' group dept") else @products = product.all end end as have set up, flash message displays after product data added , request...

sql - Column Combination -

i know there sql this: sample table: id firstname lastname 1 jones smith 2 paul tabunjong 3 john parks sql result: id name 1 jones smith 2 paul tabunjong 3 john parks now, possible have reverse of it? this: sample table: id name 1 jones smith 2 paul tabunjong 3 john parks sql result: id firstname lastname 1 jones smith 2 paul tabunjong 3 john parks another one: possible have this: sample table: id corporatenames 1 jones smith; anna tomson; tonny parker 2 paul tabunjong; poncho pilato 3 john parks; berto taborjakol sql result: id firstname lastname 1 jones smith 1 anna tomson 1 tonny parker 2 paul tabunjong 2 poncho pilato 3 john parks 3 berto taborjakol yes, can write split function , use parse data. below sample split function using substring() function: create function dbo.s...

selenium - HtmlUnitDrivers scrolling down the page is not working in java even after enabling the javascript -

does out there know how scroll page using html unit drivers? please let me know whats best way scroll page down until last element loaded using html unit drivers? i have tried these possibilities in html unit drivers, looks nothing loads page scrolls down. basically, page not scrolling down @ all... after logging in, i'm trying scroll down page until last element , page source. code: htmlunitdriver.setjavascriptenabled(true); //htmlunitdriver.executescript("scroll(0,300);"); //htmlunitdriver.executescript("window.scrollto(0, document.body.scrollheight);"); //htmlunitdriver.executescript("window.scrollby(0,3000)", ""); //((javascriptexecutor) htmlunitdriver).executescript("window.scrollby(0,20000)", ""); hoping can me... i wanted know if selenium htmlunitdriver provides facility scroll down page though actual page not render in browser. can fetch new records on page if can sc...

winapi - FileMapped write access -

i try write file while opened file mapped process , fails. please @ fragments of code: access = generic_read | generic_write; share = file_share_read | file_share_write; disposition = open_existing; handle filehandle = createfilea(filename.c_str(), access, share, 0, disposition, 0); //... unsigned long valprotect = 0; //... valprotect = page_readwrite; //... const handle mappinghandle = createfilemapping(filehandle, 0, valprotect, 0, 0, 0); //... this->m_access = file_map_all_access; //... this->m_startaddress = (uint8_t*)mapviewoffile(mappinghandle, this->m_access, 0, 0, 0); //... closehandle(filehandle); at time file closed (it's handle) mapped address space. open file in notepad++, modify , try save, see message: "please check if file opened in program." so cannot rewrite process, seems it's permissions writing locked. if unmapped file like: unmapviewoffile(this->m_startaddress); then cannot rewrite file again. wh...

gmail - Getting conditionNotMet error on migration of emails > 32kb in size -

i've had success migrating small test messages google email migration api v2 . however, when migrating larger messages, error like: { "error": { "errors": [ { "domain": "global", "reason": "conditionnotmet", "message": "limit reached.", "locationtype": "header", "location": "if-match" } ], "code": 412, "message": "limit reached." } } i start noticing error sporadically messages @ 32kb size. @ 40kb in size, error becomes consistent (no messages succeed). i've confirmed error occurs whether i'm using google-api-python-client my non-standard discovery document or oauth 2.0 playground . here's successful call , response message < 32kb looks like: post /upload/email/v2/users/jay@ditoweb.com/mail?uploadtype=multipart http/1.1 host: www.googleapis.com content-length: 6114 content...

android - Running Robotium on a server -

i'm trying test android app on linux server robotium. lt.socialheat.android.tests.socialheattest: failure in testeventtomap: junit.framework.assertionfailederror: view id: '2131034182' not found! @ com.jayway.android.robotium.solo.solo.getview(solo.java:1929) @ com.jayway.android.robotium.solo.solo.getview(solo.java:1909) @ lt.socialheat.android.tests.socialheattest.testeventtomap(socialheattest.java:45) @ java.lang.reflect.method.invokenative(native method) @ android.test.instrumentationtestcase.runmethod(instrumentationtestcase.java:214) @ android.test.instrumentationtestcase.runtest(instrumentationtestcase.java:199) @ android.test.activityinstrumentationtestcase2.runtest(activityinstrumentationtestcase2.java:192) @ android.test.androidtestrunner.runtest(androidtestrunner.java:190) @ android.test.androidtestrunner.runtest(androidtestrunner.java:175) @ android.test.instrumentationtestrunner.onstart(instrumentationtestrunner.jav...

Use mysql command line interface with memcached -

i'm trying test performance of using memcached on mysql server improve performance. i want able use normal mysql command line, can't seem connect memcached, when specify right port. i'm running mysql command on same machine both memcached process , mysql server. i've looked around online, can't seem find using memcached other program apis. ideas? memcached has own protocol. mysql client cannot connect directly memcached server. you may thinking of mysql 5.6 feature allows mysql server respond connections using memcached-compatible protocol, , read , write directly innodb tables. see http://dev.mysql.com/doc/refman/5.6/en/innodb-memcached.html but not allow mysql clients connect memcached -- it's opposite, allowing memcached clients connect mysqld. re comment: the innodb memcached interface not caching solution per se, it's solution using familiar key/value api persistent data in innodb tables. innodb transparent caching of dat...

java - No Transaction in Progress -

i trying use container managed transactions in java ee app. sems wrong here... @transactionmanagement(transactionmanagementtype.container) public class repositorymaster implements serializable{ @persistencecontext entitymanager entitymanager; @transactionattribute(transactionattributetype.required) public void saveall() { entitymanager.flush(); } } 19:32:51,769 error [org.apache.catalina.core.containerbase.[jboss.web].[default-host].[/games].[faces servlet]] (http--127.0.0.1-8080-2) servlet.service() servlet faces servlet threw exception: javax.persistence.transactionrequiredexception: no transaction in progress @ org.hibernate.ejb.abstractentitymanagerimpl.flush(abstractentitymanagerimpl.java:970) [hibernate-entitymanager-4.0.1.final.jar:4.0.1.final] @ de.leichler.games.common.repository.repositorymaster.saveall(repositorymaster.java:25) [classes:] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) [rt.jar:1.7.0_21] @ s...

HTML form submit to PHP -

okay have file called proxy.php these contents , want that, if of forms filled value , submitted, "if" check should become true , run commands have problem , though submit value, doesn't go "if" check. if put commands out of "if" check, start work not inside them. <html> <body> <br> <form action="proxy.php" method="post"> <br> host port 1: <input type="text" name="hport" /> server port 1: <input type="text" name="sport"/> <br> host port 2: <input type="text" name="hport2"/> server port 2: <input type="text" name="sport2"/> <br> <input type="submit" /> </form> </body> </html> <?php include('net/ssh2.php'); $_post["ip"]="iphere"; $_post["pass"]="passhere"; $ssh = new net_ssh2($_post[...

Magento keep the base css or get rid of it? -

ok looked everywhere , took few tutorials. first 2 themes built in magento.. got rid of base styles.css file.. in trying theme entire magento pages.. skipped on few minor pages , jacked since original css wasn\’t there. don\’t want mistake keep happening.. are suppose know pages should styled in local.css file? or should keep base styles.css file , override or copy local.css , change way? has lot of unecessary code , it\’s little large keep editing.. i\’ve been thinking past 2 hours , can\’t seem find solution. inside template/page directory (not everything, few files 1-column, 2-column, 3-column, header, footer, etc) should edited new theme right? copied, pasted, , edited? i\’m doing local.xml file right way , not touching of other .xml files edit blocks. i\’m stumped on how whole css stuff.. since i\’m unsure how many pages , pages magento comes if rid of css make sure check , style in local.css.. "it depends". official magento recommendation (such exist,...

ios - Fetch arrays of values in CoreData -

in xcode project, have 2 entities coredata. these entities called session , sessiondetails . session has 1 attribute called timecompleted (type: date) time stamp of event. session in one-to-many relationship sessiondetails attribute important averagedistance (type: float) . the sessions sorted using timecompleted. fetch averagedistance values of sorted sessions , place them in array used generate plot. x-axis have date of event , y-axis have averagedistance value. not concerned right creating plot rather extracting values used it. appreciate help! you can use key-value coding array of attribute values. assuming averagedistance attribute of session , can following: nsarray *sessions = ...; // sorted array of session objects nsarray *distvalues = [sessions valueforkey:@"averagedistance"]; distvalues array of nsnumber objects containing averagedistance each session object. update: turned out in discussion, there to-many relationship session ...

tomcat - Absolute Paths in solr.xml configuration using Tomcat6 on windows -

we have multicore solr setup 2 cores, 1 site , 1 catalog data. inside solr.xml core config follows; <cores adminpath="/admin/cores"> <core name="catalog" instancedir="e:\solrinstances\catalog" /> <core name="sites" instancedir="e:\solrinstances\sites" /> </cores> e:\ mapped/mounted network drive regularly backed up. however, when try access core nasty stack trace jul 17, 2013 8:28:00 pm org.apache.solr.common.solrexception log severe: java.lang.runtimeexception: can't find resource 'solrconfig.xml' in classpath or 'e:\solrinstances\sites\conf/', cwd=c:\program files (x86)\apache software foundation\tomcat 6.0 @ org.apache.solr.core.solrresourceloader.openresource(solrresourceloader.java:268) @ org.apache.solr.core.solrresourceloader.openconfig(solrresourceloader.java:234) @ org.apache.solr.core.config.<init>(config.java:141) @ org.apache.solr.core....

if statement - Java While Loops Issue -

this question has answer here: how compare strings in java? 23 answers i using while loop , if loop determine response , action. odd reason continues ignore if statements. boolean _exit = false; while (_exit == false){ system.out.println("\nwould meal?\tyes or no?"); string answer = scan.next().tolowercase(); if (answer == "yes"){ system.out.println("reached1"); _exit = true; } if (answer == "no"){ system.out.println("reached1"); exit = _exit = true; } could explain happening , why failing check if statements. i've tried scan.nextline well. problem persisted when removed of tolowercase brought attention can have affect on string values, though did try lo...