Posts

Showing posts from June, 2010

How to import shell functions from one file into another? -

i have shell script: #!/bin/bash export ld=$(lsb_release -sd | sed 's/"//g') export arch=$(uname -m) export ver=$(lsb_release -sr) # load test function /bin/bash -c "lib/test.sh" echo $ver distros=('arch' 'centos' 'debian' 'fedora' 'gentoo') in "${distros[@]}" i=$(echo $i | tr '[:upper:]' '[:lower:]') # convert distro string lowercase if [[ $ld == "$i"* ]]; ./$arch/${i}.sh fi done as can see should run shell script, depending on architecture , os run on. should first run script lib/test.sh before runs architecture , os-specific script. lib/test.sh : #!/bin/bash function comex { $1 >/dev/null 2>&1 } and when run on x86_64 arch linux x86_64/arch.sh script: #!/bin/bash if comex atom; printf "atom installed!" elif comex git; printf "git installed!" fi it returned output: rolling ./x86_64/arch.sh: line 3: comex: command not

html - My parent element is not getting affected -

i trying make sliding hamburger menu, , unable move div left when checkbox (icon) checked. html following: <div class="nav"> <div class="container"> <img src="{{ asset('assets/images/user.jpg') }}"> <a href="#">sameer manek</a> </div> </div> <div class="window"> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger"><i class="fa fa-bars"></i></label> {% block main %}{% endblock %} </div> and css: .nav-trigger:checked + label { left: 215px; } .nav-trigger:checked ~ .window { background-color: transparent; left: 200px; box-shadow: 0 0 5px 5px rgba(0,0,0,0.5); } .nav-trigger + label, .window { transition: left 0.2s; } the 1st , last css applied , label moves left current position, div .window not

reactjs - Draftjs: Query if entity of type "x" exists in content -

i'm using draft-js in chat client building. have created custom entity allows users "@" mention other users. if user "@" mentioned, want send them notification. there way in draft-js query current editor state , ask if there entities matching type? nice if data entity well. please check official tweet example. {props.children} of custom component mentioned.

Sorting a string alphabetically by line in Clojure(Script) -

suppose s string defined follows: ;; s b c is there clojure operation sort-alphabetically (that works in clojurescript) such (sort-alphabetically s) generates following string? ;; (sort-alphabetically s) => b c the following code snippet want: (require '[clojure.string :as str]) (def s "c\nb\na") (->> s (str/split-lines) ; split string sequence of lines (sort) ; sort sequence using natural order (for strings alphabetical order) (str/join "\n")) ; join elements of sorted sequence using \n producing multiline string ;; => "a\nb\nc"

php - File fails to upload in laravel -

here routes file route::resource('item', 'itemcontroller'); route::get('welcome', function() { return view('welcome'); }); route::auth(); route::get('/home', 'homecontroller@index'); route::get('/item', 'itemcontroller@store'); //route route::post('/item', ['as' => 'item.store', 'uses' => 'itemcontroller@store']); here store controller public function store(requests\createitem $request) { item::create($request->all()); $file = $request->file('filename'); if (input::hasfile('filename')) { echo 'uploaded'; $file = input::file('filename'); $file->move('uploads', $file->getclientoriginalname()); } } my upload form not return errors, snippet of code not moving uploads folder specified. doing wrong? using laravel 5.2. edit: here form {!! form::open(['url' =>

How to use variable from previous scope in Python -

i have following code: def test(): def printa(): def somethingelse(): pass print(a) aha = a[2] = [1, 2, 3] while true: printa() test() i've noticed code work fine, if change aha a , says a not defined. is there way set a value within printa? in python 3, can set variable nonlocal def test(): = [1, 2, 3] def printa(): nonlocal def somethingelse(): pass print(a) = a[2] while true: printa() test()

Trying to implement friends with Rails, getting a No Route Matches [GET] error when I try to route to any controller method -

i've been searching answer past few hours , i'm frustrated, i'm new rails feel stupid mistake or did totally wrong. please me fix error. here controller: class friendshipscontroller < applicationcontroller before_action :authenticate_user! before_action :def_user, only: [:create, :accept, :deny, :destroy] def index @user = current_user @friends = @user.friends.paginate :page => params[:page] @pending_friends = @user.pending_friends.paginate :page => params[:page] end def show end def create friendship.request(@user1, @friend) flash[:success] = "friend request has been sent #{@user2.screenname}." redirect_to user_path(@friend) end def accept freindship.accept(@user1, @friend) flash[:success] = "friend request #{@user2.screenname} has been accepted." redirect_to friends_path end def deny friendship.breakup(@user1,

python - VTK 7.0.0 ImageTracerWidget hidden behind imageactor -

using python, trying draw roi around image. testing, have following code. but, glyphs hide behind image. don't see roi being drawn when lower transparency of overlain image: import vtk imagesource = vtk.vtkimagecanvassource2d() imagesource.setscalartypetounsignedchar(); imagesource.setnumberofscalarcomponents(3); imagesource.setextent(0, 20, 0, 50, 0, 0); imagesource.setdrawcolor(0, 0, 0); imagesource.fillbox(0, 20, 0, 50); imagesource.setdrawcolor(255, 0, 0); imagesource.fillbox(0, 10, 0, 30); imagesource.update(); actor = vtk.vtkimageactor() actor.getmapper().setinputconnection(imagesource.getoutputport()) actor.visibilityon() actor.addposition(10,10,-13) actor.interpolateoff() ip = vtk.vtkimageproperty() ip.setcolorwindow(2000) ip.setcolorlevel(1000) ip.setambient(0.0) ip.setdiffuse(1.0) ip.setopacity(1.0) ip.setinterpolationtypetolinear() actor.setproperty(ip) renderer = vtk.vtkrenderer() renderer.addactor(actor) renderer.resetcamera() renderwindow= vtk.vtkrend

java - Troubles with simple animation on image -

im trying make image (alien.png) move around screen randomly , once hits walls comes back. im have trouble can't find way upload image , make bounce around. have far i'm getting lot of errors package animationdemo; import java.awt.graphics; import java.awt.image; import java.awt.toolkit; import javax.swing.jpanel; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class animationdemo extends jframe { public animationdemo() { image alien; alien = toolkit.getdefaulttoolkit().getimage("alien.png"); timer timer = new timer(50, this); timer.start(); } public static void main(string[] args) { animationdemo frame = new animationdemo(); frame.settitle("animationdemo"); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setsize(300, 300); frame.setvisible(true); } } class movingmessagepanel extends jpanel implements actionlistener { public int xcoordinate = 20; public int y

count - How to find tail node of a singly linked list without having to traverse the list? -

i'm thinking it's possible if have count variable keeps track of # of records in list, can't jump element[count] tail in array. this befuddling me, appreciated one thought keep track of tail pointer build linked list. other way allow building linked list inserting nodes @ beginning, way can keep track of tail.

python - Where am I screwing up with my output formatting? -

this question has answer here: where messing output formatting? 1 answer so got error message when tried run code (continued previous question ) , can't figure out problem is. says it's valueerror can't figure out 1 exactly. maybe it's late, @ loss. here's code: def sort(count_dict, avg_scores_dict, std_dev_dict): '''sorts , prints output''' menu = menu_validate("you must choose 1 of valid choices of 1, 2, 3, 4 \n sort options\n 1. sort avg ascending\n 2. sort avg descending\n 3. sort std deviation ascending\n 4. sort std deviation descending", 1, 4) print ("{0}{1:27}{2:39}{3:51}\n{4}".format("word", "occurence", "avg. score", "std. dev.", "="*51)) if menu == 1: dic = ordereddict(sorted(word_avg_dict.

Not understanding a Java polymorphism example involving HashMaps -

i'm rusty on java polymorphism. if have class merchandise, , class clothing extends merchandise, why aren't able following? hashmap<string, merchandise> stuff = new hashmap<string, clothing>(); when so, getting compilation error: datastore.java:5: error: incompatible types: hashmap<string,clothing> cannot converted hashmap<string,merchandise> public static hashmap<string, merchandise> tshirts = new hashmap<string, clothing>(); aren't clothing items merchandise items? ^ consider following scenario: hashmap<string, clothing> clothing = ... hashmap<string, merchandise> merchandise = clothing; // suppose allowed merchandise.put("potato", new potato()); uh-oh, putting potato merchandise, has gone clothing, because reference same object!

OpenCart: Paypal Session Time-Out -

i using standard paypal payment method opencart website. when go through checkout process , redirected paypal website, login , choose payment source on paypal site. however, when starts processing, returns "your session has timed out, please log in again." , logs me out of paypal. any appreciated. i had facing problem also. if using sandbox mode, should gave test account buyer(buyer account must business account) , seller account must individual account(personal). example xxx@gmail.com buyer account should put in admin panel paypal extension,then should login in e-store website seller account (yyy@gmail.com) , proceed paypal works well.

uppercase - readline: Convert input to upper case on screen as it is typed -

how can instruct readline convert keyboard intput upper case, typed, , have echo terminal? (related, python: convert input upper case on screen typed — asks different question trying achieve similar result. not python-specific question, not duplicate of one.) the program i'm writing (which python 3 code, if matters) uses readline library command line input, implementing conversion of each keystroke not option. i'm looking way requesting readline library me. the existing commands upcase-word , downcase-word user invoke, deliberately change case of text typed. isn't need; instead want text changed it's typed in. you have 3 options guess: changing keyboard firmware in way sends caps-lock on signal in start-up! modifying keyboard driver in operation system send os uppercase letters instead of lower-cases. modifying source code of shell see result of typing inside, in way show upper-cases always. you can't aim goal using program running!

javascript - How do I get to transfer an array from the server side to client side in node.js? -

i have following function on client side: //todo: fix var socket = io.connect('http://localhost:3000/home'); socket.on('news', function (data) { console.log('testing: ' + data); //socket.emit('my other event', {my: 'data'}); }); and following on server side: module.exports = function(app, io) { app.get('/home',function(req, res){ //res.render('profile.ejs'); }); io.on('connection', function(socket){ socket.emit('news', { data: 'world' }); }; the problem can't seem log received data client's console. what's wrong code? use json.stringify() printing whole data in proper formate` console.log('testing: ' + json.stringify(data));

Change android Ripple effect center position for android Appcompat radio button -

Image
i tried make rtl radio -put radio on right side- button android appcompactradiobutton, , achieved android:drawableright , set android:button="@null" final view wanted , final code this: <android.support.v7.widget.appcompatradiobutton android:id="@+id/radio_man" style="@style/app_font" android:layout_width="0dp" android:layout_height="@dimen/edit_text_height" android:layout_weight="1" android:button="@null" android:drawableright="@drawable/form_radiobutton" android:minheight="33dp" android:onclick="onsexradiobuttonclicked" android:text="@string/hint_man" /> but question how to change ripple effect center position, because set button null, ripple effect center poisiton in center of radio button image above , not expected user see ripple there.

Android fragment show/hide is not working -

in activity have 2 fragments of same type different instances , want show 1 , hide other when different button pressed. here code adding fragments activity: _pardiscinemafragment = newslistingfragment.newinstance(tab_cinema); _shoppingfragment = newslistingfragment.newinstance(tab_shopping); fragmenttransaction transaction = getfragmentmanager().begintransaction(); transaction.setcustomanimations( r.anim.enter_from_left, r.anim.exit_to_left, r.anim.enter_from_left, r.anim.exit_to_left); transaction.addtobackstack(null); transaction.add(r.id.news_list_fragment_container, _pardiscinemafragment); transaction.add(r.id.news_list_fragment_container, _shoppingfragment); transaction.commit(); and here's onclick event: public void ontabclick(view view) { string tag = view.gettag().tostring(); fragment fragmenttoshow = null; fragment fragmenttohide = null; if(tag.equals(tab_cinema) &

java - Alternative(s) of converting Canvas to WritableImage -

i'm developing application needs lot of comparing image data in javafx. comparing, need to rgb data of pixels in images. let's picture need compare picture1 , picture2 . picture1 input picture selected user. picture2 drawing make programmatically. afaik, way rgb data per pixel in javafx pixelreader of image . it's fine picture1 since it's input. need drawing on picture2 , picture2 canvas (i draw polygons on picture2 , because drawing pixel pixel pixelwriter bit complicated imo) , doesn't have pixelreader or similar functionality. solution follows: read input image , make picture1 make canvas , drawing attach canvas scene make snapshot of scene , make writableimage (picture2) compare picture1 , picture2 so have method like: public static writableimage makedrawableimage(canvas in) { anchorpane root = new anchorpane(in); writableimage out = new writableimage((int)in.getwidth(), (int)in.getheight()); scene sc = new scene(root, i

javascript - How to create a dynamic table in jQuery? -

i want create dynamic table in jquery. code creates table each of element. var dataitem = this.dataitem($(e.currenttarget).closest("tr")); var str = dataitem.description; var spl = str.split(','), part; var spl2 = ""; (var = 0; < spl.length; i++) { part = spl[i].split(':'); content = "<table>" + "<tr><td>" + part[0] + "</td>" + "<td>" + part[1] + "</td></tr>"; spl2 += content; } content += "</table>" var desc = "<div id='openmodal' class='modaldialog'>" + "<span>" + spl2 + "</span><br/>" + + "</div>"; which part of code wrong? as adding table in loop, creating table each item.try this: var dataitem = this.dataitem($(e.currenttarget).closest("tr")); var str = dataitem.description; var spl = str.split(

php - Laravel - Interactive User Setup -

essentially trying create interactive user set wizard (often seen in cmses wordpress or xenforo) when first run project. consist of basic configuration such setting parameters mysql database, setting , admin account, etc. issue is, i'm not sure how go going in first place. how go overwriting values in configuration file properly? best implementation this? maybe you're looking for? laravel setup wizard

neo4jclient - Searching in Neo4j -

my web application has users , coworker relationship. want search users has coworker relationship specific user. used query: var query = _client .cypher .start(new { //user = node.byindexlookup(indexhelper.user_index, "email", email) } ).match(string.format("user-[:{0}]-(coworkers)", coworker.typekey)) .where((user coworkers) => coworkers.email.contains(term)) .return<node<user>>("coworkers"); but throws invalid parameter at where((user coworkers) => coworkers.email.contains(term)) . how can replace condition search coworker term? reading. cypher doesn't support contains operator this, hence why exception says there no .net equivalent. the nearest use regex: where coworkers.email =~ ".*something.*" but horribly ineffici

objective c - How to retrieve Downloaded content in iOS? -

in app i've downloaded mp3 file , stored giving file name write abc.mp3 , while storing file path shown this: /var/mobile/containers/data/application/9afc500a-91d5-421b-8a5f-19a239456353/documents/abc.mp3 and when play path is file:///var/mobile/containers/data/application/9afc500a-91d5-421b-8a5f-19a239456353/documents/abc.mp3 the code play is : nsurl* songurl = [nsurl fileurlwithpath:songurlstring]; mediaplayer = [[avplayer alloc]initwithurl:url ]; //this avplayer instance [mediaplayer play]; the code download is: - (void)downloadcontent:(nsstring*)stringurl{ stringurl = [stringurl stringbyreplacingoccurrencesofstring:@" " withstring:@"%20"]; currenturl = stringurl; nsurl *url = [nsurl urlwithstring:stringurl]; nsurlrequest *therequest = [nsurlrequest requestwithurl:url cachepolicy:nsurlrequestreloadignoringlocalcachedata timeoutinterval:60]; receiveddata = [[nsmutabledata alloc] initwithlength:0]; nsurlconn

javascript - transparent background for responsive-tabs -

i using js library http://openam.github.io/bootstrap-responsive-tabs/ . can't manage set background transparent (or other color). it seems problem tab styles updated js library when accordion tabs created, white background-color. add following css rule: .nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover { background: transparent !important; }

ios - UIImage created with animatedImageWithImages have bugs? -

Image
recently found gif image not shown. write test code it: import uikit import imageio extension uiimage { static func gifimagearray(data: nsdata) -> [uiimage] { let source = cgimagesourcecreatewithdata(data, nil)! let count = cgimagesourcegetcount(source) if count <= 1 { return [uiimage(data: data)!] } else { var images = [uiimage](); images.reservecapacity(count) in 0..<count { let image = cgimagesourcecreateimageatindex(source, i, nil)! images.append( uiimage(cgimage: image) ) } return images; } } static func gifimage(data: nsdata) -> uiimage? { let gif = gifimagearray(data) if gif.count <= 1 { return gif[0] } else { return uiimage.animatedimagewithimages(gif, duration: nstimeinterval(gif.count) * 0.1) } } } class viewcontroller: uiviewcontroller, uitableviewd

php - How to get a single value form multiple values in a Mysql field -

i have created mail table have following fields. id mail_to mail_subject mail_message 1 6,9,10 test mail test message 2 4,8,6 test mail test message values stored in mail_to field id of users. want display mail mail_to 6. how use condition in case. i tried achieve result query did not work. select * tbl_profile_inbox mail_to = '6' ; can guys on one. you can use find_in_set() that: select * tbl_profile_inbox find_in_set('6',mail_to)

javascript - Backbone.js popover implementation -

Image
i new backbone.js , first project implement popover view can reused throughout project easily. defined following requirements. requirements the popover should referenced element in dom able calculate popover's position , open/close popover. reference acts popover toggle button a new popover appended body, on close popover destroyed , removed dom any click outside of popover forces popover close , destroyed the popover backbone view , should independent it's parent/creator view, communication open/close should performed using events popovers content may view the implementation: first create view popover reference: my.views.toggle = backbone.view.extend({ tagname: 'a', events: { 'click': 'toggle' }, serialize: function() { return { model: this.model }; }, initialize: function() { this.listento(this.model, 'change', this.render); }, afterrender: function() {

php 7 - php ldap connection function issue -

i use ubuntu server , installed default lamp package run ldap query php following error message ; fatal error: uncaught error: call undefined function ldap_connect() in i insert extension=php_ldap.so , extension=ldap.so paramater in php.ini file however, want install php ldap package following error message; php7.0-ldap : depends: php7.0-common (= 7.0.4-7ubuntu1) 7.0.4-7ubuntu2 installed so, can't install package how can enable ldap package php7.0? how can enable ldap extension php7.0? i solved issue, download files php7.0-ldap_7.0.4-7ubuntu2_amd64.deb https://mirror.umd.edu/ubuntu/pool/main/p/php7.0/ , install manuel via dpkg

Remove text appearing between two characters - multiple instances - Excel -

in microsoft excel file, have text in rows appears this: 1. rc8 {[%emt 0:00:05]} rxc8 {[%emt 0:00:01]} 2. rxc8 {[%emt 0:00:01]} qxc8 {} 3. qe7# 1-0 i need remove text appearing within flower brackets { , } , including brackets themselves. in above example, there 3 instances of such flower brackets. rows might have more that. i tried =mid(left(a2,find("}",a2)-1),find("{",a2)+1,len(a2)) this outputs to: {[%emt 0:00:05]} . see first instance of text between flower brackets. and if use within substitute this: =substitute(a2,mid(left(a2,find("}",a2)),find("{",a2),len(a2)),"") i output this: 1. rc8 rxc8 {[%emt 0:00:01]} 2. rxc8 {[%emt 0:00:01]} qxc8 {} 3. qe7# 1-0 if have noticed, 1 instance removed. how make work instances? thanks. it not easy without vba, there still way. either (as suggested yu_ominae) use formula , auto-fill it: =iferror(substitute(a2,mid(left(a2,find("}",a2)),find("

unity3d - how to code on server side in photon in unity -

we need create game 10 + 1 users. 10 players real users - in multiplayer online game. 1 player dealer app software - work dealer. dealer not real player. dealer throwing dice. how can in photon pun ? using free version of photon right now. depending on photon client sdk use, should have callback of when master client changed (should "onmasterclientswitched"). triggered when server detects master client disconnected. master client should actor lowest actor number there way force master client (change client). if save data in room properties or send events , maybe cache them, there no risk of data loss there long room still "alive". actor properties on other side, should cleaned when respective actor leaves room. one tricky situation though: when master client not responding , did not explicitly disconnect, there may few seconds (default timeout 10seconds) before server detects that actor timed out , switches new one. if situation concerns you, inst

why Rails call a method does't exist in current version(4.2.0)? -

i works on rails project, using rails 4.2.0, gemfile: gem 'rails', '4.2.0' # other gems......... we have these 2 models: class shop < activerecord::base has_many :shop_categories end class shopcategory < activerecord::base # has column named "shop_id" belongs_to :shop def self.some_max(shop) # line number: 33 where(shop: shop).maximum(:some_value) end end and have generator, call "some_max" method on shopcategory: # simplified, shop = shop.first # lib/generators/shop/build/build_generator.rb:36 shopcategory.some_max shop and generator invoked code inside our rails application: # app/services/shop_service.rb:8 rails::generators.invoke 'shop:build', [..params..] and error: nomethoderror (undefined method `convert_value_to_association_ids' activerecord::predicatebuilder:class): composite_primary_keys (8.1.3) lib/composite_primary_keys/relation/predicate_builder.rb:24:in `expand' activ

c# - comparing a list within linq expression -

i have following query: var zoneids = filter.zones.select(s => s.zoneid); var playerquery = this._cmsdbcontext.playersloader.query(user.clientid); var sortedlocationids = playerquery .where(w => zoneids.contains(w.zoneid)) .groupby(g => g.locationid) .select(s => s.key); the problem i'm having following: if list zoneids contains more 1 zoneid , want return locations has of zoneid's in list. of return every location find hit on within zoneid list. so if zoneids contains lets zoneid = 1 , zoneid = 5 , want locations has players zoneid 1 , 5 . every location has either zone 1 or 5 . any highly appreciated! *edit, here classes im working with: public class location : ientitybase { public location() { players = new list<player>(); filters = new list<filter>(); } [key] [databasegenerated(databasegeneratedoption.identity)] public int locationid { get; set

javascript - Animating SVG elements with GSAP -

Image
i tasked creating interactive svg infographic few slides browser game, has 5 steps total. when click prev / next buttons or specific step, whole svg should animate correct step. in terms of code, have: function slide() { // cache top-level svg elements later use this.el = $('svg#betfair-slider'); this.hands = this.el.find('#hands_8_'); this.cardsdesk = this.el.find('g#center-cards'); this.textcontainer = $('.step-text'); // use shared timeline across slides, there no overlapping tweens this.tween = new timelinelite(); } function slide2 () { // inherit main slide slide.call(this); // each slide has own supporting explanatory text this.html = [ '<h3>preflop</h3>', '<p>amet sit lorem ipsum dolar</p>' ].join(''); // main openslide method this.openslide = function() { // find cards need animated specific slide v

nunit - Jenkins CI: 'NumberFormatException: empty String' -

we have jenkins installation , projects tested nunit. works fine , writes nunit results xml file. have 'publish nunit test result report' post-build step. since friday produces error: recording nunit tests results error: step ‘publish nunit test result report’ aborted due exception: java.io.ioexception: remote file operation failed: c:\jenkins\workspace\xxx @ hudson.remoting.channel@205d5d5c:ciagent: java.io.ioexception: failed read c:\jenkins\workspace\xxx\temporary-junit-reports\test-xxx_tests.testswithrealservers.testwithtwolocals_1_2.xml @ hudson.filepath.act(filepath.java:986) @ hudson.filepath.act(filepath.java:968) @ hudson.plugins.nunit.nunitpublisher.gettestresult(nunitpublisher.java:226) [...] caused by: java.io.ioexception: failed read c:\jenkins\workspace\xxx\temporary-junit-reports\test-xxx_tests.testswithrealservers.testwithtwolocals_1_2.xml @ hudson.tasks.junit.testresult.parse(testresult.java:306) @ hudson.tasks.junit.testresult.p

Algorithm of ellipse fitting in OpenCV -

i read code of ellipse fitting in opencv, following link gives source code of ellipse fitting in opencv: http://lpaste.net/161378 . i want know details ellipse fitting in opencv, can not find documents of algorithm. in comments, said " new fitellipse algorithm, contributed dr. daniel weiss". can not find paper ellipse fitting of dr. daniel weiss. i have questions of algorithm: why algorithm need re-fit. first fit parameters - e, , re-fit parameters - c center coordinates. ellipse need satisfy constraint of 4*a*b - c^2 > 0, how algorithm satisfy it? i'm wondering myself since i've discovered algorithm bugged. see bug-report: https://github.com/itseez/opencv/issues/6544 i tried find relevant papers dr. daniel weiss , failed.

java - Calling a PostgreSQL Proc using EntityManager -

i'm trying call stored procedure on postgresql db. procedure handles inserting, updating, , deleting table entries, accepts params. of params null, depending on kind of operation want perform. able call proc using hibernate's sessionfactory, want use jpa entitymanager. procedure using sessionfactory follows: public result callfunction(string type_proc, string node, string fullcode, date bdate){ session session = this.sessionfactory.getcurrentsession(); org.hibernate.query query = session.createsqlquery( "select*from public.somefunction(:type_proc, :node, :fullcode, :bdate, cast(:cat_id bigint)") .addentity(result.class) .setparameter("type_proc", type_proc) .setparameter("node", node) .setparameter("fullcode", fullcode) .setparameter("bdate", bdate) .setparameter("cat_id", null, longtype.instance) return (result) que

video - What's the correct way of adding a .mov file to a webpage? -

i've been having around , can't understand why not working ;) my code (testfile) <!doctype html> <html> <head> <title></title> </head> <body> <video controls="controls" width="800" height="600" name="video-name" src="video/cloisterarch.mov"></video> </body> </html> when open file on chrome, video there, , can hear audio, it's white screen play/pause , volume buttons, missing? a .mov file movie in quicktime format. video , audio can encoded using different codecs. depending on codec used , depending on browser , operation system, video or audio might not play. the quicktime format isn't supported. better off converting different format such .mp4 (mpeg-4). the best solution convert video several different formats , resolutions , let browser pick suitable one.

javascript - CSS - Making border box next to other? -

so tried making bordered box. made new div, thing is. break "position" of other box. here's example: normal looking example broken one my question is, how prevent that? so, other box stay on same place, other 1 won't move direction wants? box <div class="itemcart" style=" border: 2px solid; width: 50px; top: 80px; position: relative; height: 50px; ">hello</div>

node.js - Socket.io 1.4.5 Rooms issue -

i unable emit events rooms in server application, using version 1.4.5 i tried these 2 ways communicate in room, neither worked. this.io.to(this.id).emit(eventname,data); this.io.sockets.in(this.id).emit(eventname,data); before calling this, register user in room in fashion user.socket.join(this.id); further details the this.io object require('socket.io')(http); the user.socket object io.on('connection', function(socket) i omitted rest of code because in overly complex structure , inheritance chain, , irellevant question. i dont require code snippet copy, rather way how debug , figure issue out. edit when pause application @ moment when want emit message, when inspect io object, following. io -> nsps -> '/' -> adapter -> rooms -> theroomname -> sockets and socket id is listed there. is there way how find out whether message being sent ? edit #2 when inspect socket object, located @ io -> sockets

python - NLTK - Remove Tags From Parsed Chunks -

this question has answer here: ne_chunk without pos_tag in nltk 2 answers #!/usr/bin/env python # -*- coding: utf-8 -*- import os import nltk import re nltk.tree import * nltk.chunk.util import tagstr2tree nltk import word_tokenize, pos_tag text = "yarın, mehmet ile birlikte ankara'da ki nüfus müdürlüğü'ne, aziz yıldırım ile birlikte, Şükrü saraçoğlu stadı'na gideceğiz.".decode("utf-8") tagged_text = pos_tag(word_tokenize(text)) tagged_text2 = word_tokenize(text) grammar = "np:{<nnp>+}" cp = nltk.regexpparser(grammar) result = cp.parse(tagged_text) tree in result: print(tree) wrapped = "(root "+ str(result) + " )" # add "root" node @ top trees = nltk.tree.fromstring(wrapped, read_leaf=lambda x: x.split("/")[0]) tree in trees: print(tree.leaves()) tree2 in result

javascript - Simple Unit Testing NodeJS/Express -

hi pretty new nodejs , trying write first tests. i kind of stuck setup, hoping help. i wrote these 2 functions: app.js: var express = require('express') , cors = require('cors') , app = express(); app.get('/a_nice_jsonp',cors(corsoptions), function(req, res, next){ var result = parsecookies(req); res.jsonp(result); }); app.get('',function(req,res,next){ res.statuscode = 200; res.end() }); i not export module file. i assume it's pretty easy write tests that. started this: app-test.js: var expect = require('expect.js'); var express = require('express'); var expressapp = express(); describe('app js test', function() { describe('get /', function() { it('should respond empty path', function () { expressapp.get('', function(req, res, body){ expect(res.status).to.equal(200); }); }) }); }); i suppose reads simple task, seem fail on setup of test

java - IllegalMonitorStateException in code -

class test { public static void main(string[] args) { system.out.println("1.. "); synchronized (args) { system.out.println("2.."); try { thread.currentthread().wait(); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } system.out.println("3.."); } } } i getting illegalmonitorstateexception monitor exception in code. per understanding, because of synchronized block around args string array object, current thread must have acquired lock , wait method, release lock. can explain me reason behind exception? you're calling wait() on thread.currentthread() . before calling wait() on object, must own monitor of object , way of synchronized block synchronizing on object . missing synchronized(thread.currentthread()) { thread.currentthread().wait(); }