Posts

Showing posts from January, 2012

javascript - Loading part of file from server -

i have large text file on server (21 gb). read part of it, byte byte b. is possible xmlhttprequest, filereader or blobs, or other interface? without special software on server? actually, want process whole file locally. entire file not fit ram (can't load single xmlhttprequest). filereader can read specific bytes of local file, have choose manually < input >, each time run program. you can send range header in request (with xhr). if server supports partial requests, can give bytes ask for. xhrinstance.setrequestheader("range", "bytes=500-999"); note should expect 206 partial content response instead of 200 ok response.

mysql - Filtering select with join on the same table -

let's got table named entity has following columns: id | flag | foreignkey | parententityid misc notes none of fields can null when parententityid !=0 can sure foreignkey has value !=0 (and vice-versa) i had gather data following constraints : foreignkey has equal 0 [easy :d ] flag must equal 0 or (let's 15) [easy :p ] id must not referenced on row's parententityid field [ :/ ?] i did not manage satisfy last constraint using self join -- ended sub-query (which returns need) : select e.* entity e e.flag='15' -- gathering entities ids foreignkey has specific value , e.id not in (select group_concat(distinct convert(parentid , char(8)) separator ",") entity foreignkey='10' group id ); my question .. can achieved "self join" expression ? something (for conditions in text): select e.* entity e e.foreignkey = 0 , e.flag in (0, 15) , not exists (select 1 entity e...

jquery - Show message while javascript is running -

i know such question has been requested several times have need show popup or message or whatelse when javascript function triggered , hide @ end. see simple js fiddle that's html code: <div id='message'>default message</div> <input type='button' onclick='run();' value='start'> the div 'message' has contain simple text "running" or "please wait" or ... that's js function took (delay) 3 seconds: function run() { var delay = 3000; //-- 3 seconds $( '#message' ).text('please wait ' + delay + ' seconds...'); var start = new date().gettime(); while (true) { current = new date().gettime(); if ( (start + delay) < current) { break; } } $( '#message' ).text('done'); } the expected behaviour '#message' div contains "please wait 3 seconds..." before enter in loop , "do...

html - Using Firefox website information in C++ program -

i trying extract information "about:plugins" website when use firefox web browser. want able use contents of website in c++ program. way know how use content location reading file. what trying read file name , file path each plugin about:plugin' not sure if send information file , read there, seems double work since if output file, read there. needed know how extract information firefox website in order used in c++ program. just parse pluginreg.dat file, can find in: c:\users\xxxxxxx\appdata\roaming\mozilla\firefox\profiles\xxxxxx.default to obtain appdata char cappdata[max_path]; if(shgetspecialfolderpatha(null, cappdata, csidl_appdata, false)) { // obtain profile name, parse profiles.ini file in folder // ...appdata\roaming\mozilla\firefox // ... }

java - I have import org.apache.commons.io.FileUtils; in my code and it works on eclipse but not in command line -

i'm using apache package; i've add it's jar file location classpath environment variable. when try compile code via command line numerous errors including: package org.apache.commons.io not exist you missing jar contains package (in case apache-commons.jar) on classpath. try export packaged jar file dependend jars included. should work.

excel vba - Inconsistent VBA Error Message Box? -

it seems message box vba pops-up when unhandled exception occurs behaves differently depending on... something? see mean, create new .xlsm, then create standard module module1 ; paste inside code paste inside sheet1 worksheet object code: public sub testerrmsgbox() debug.print "hello!" call err.raise(number:=vbobjecterror, source:="vbaproject.sheet1", description:="lorem ipsum") end sub on excel 2010 professional plus, calling subroutine in vbe's "immediate" (ctrl+g) window: call module1.testerrmsgbox call sheet1.testerrmsgbox will show error message automation error / invalid oleverb structure . now, if 1 calls directly raise method in "immediate" window: call err.raise(number:=vbobjecterror, source:="vbaproject.sheet1", description:="lorem ipsum") it show (expected) error message lorem ipsum . what changes in error handling, or in err object, first case last? , how may ma...

Could not run simple spring boot application() generated by STS tool -

i new java , spring, have latest sts tool , java 1.6, able create , run spring mvc project. started looking in spring boot, created spring starter project selected 'web' , picked default had multiple error in application.java file(see below) fixed adding jre in build path. try run getting run time exception (see below). question : why ide not able add jre in build path spring boot? why still can't run application. missing configuration because of ide not generating correct project. help appreciated. thanks *************** error in application.java multiple markers @ line - type java.lang.string cannot resolved. indirectly referenced required .class files - type java.lang.object cannot resolved. indirectly referenced required .class files - type java.lang.class cannot resolved. indirectly referenced required .class files multiple markers @ line - occurrence of 'application' - implicit super constructor object() undefined default constructor. must ...

c# - Windows phone application crash when searching for location -

i've got following function: private async void searchlocation(string location) { var myposition = await new geolocator().getgeopositionasync(timespan.fromminutes(1), timespan.fromseconds(10)); // define search var geoquery = new geocodequery(); geoquery.searchterm = location; geoquery.geocoordinate = new geocoordinate(myposition.coordinate.latitude, myposition.coordinate.longitude); geoquery.querycompleted += (s, f) => { if (f.error == null && f.result.count > 0) { map.center = f.result[0].geocoordinate; map.zoomlevel = 12; } }; geoquery.queryasync(); } it's searching location , show on map. works fine, when i'm clicking on map, application crashes (map_tap empty). in output appears: a first chance exception of type 'system.invalidoperationexception' occurred in system.windows.ni.dll st...

Install windows application with chef windows-package -

i trying install package on windows 7 machine using chef's "windows-master" cookbook: https://github.com/opscode-cookbooks/windows . first thing did grab install firefox example , try , run in environment. i'm getting error when run chef-client: starting chef client, version 11.12.4 [2014-05-16t15:15:50-04:00] info: *** chef 11.12.4 *** [2014-05-16t15:15:50-04:00] info: chef-client pid: 1528 [2014-05-16t15:16:03-04:00] info: run list [role[windowsuserdesktop]] [2014-05-16t15:16:03-04:00] info: run list expands [adminuseraccounts::monito r_user, windows7x32desktop::installfirefox] [2014-05-16t15:16:03-04:00] info: starting chef run windows7node [2014-05-16t15:16:03-04:00] info: running start handlers [2014-05-16t15:16:03-04:00] info: start handlers complete. resolving cookbooks run list: ["adminuseraccounts::monitor_user", "windows7x 32desktop::installfirefox"] [2014-05-16t15:16:04-04:00] info: loading cookbooks [adminuseraccounts@0.1.4, wi nd...

custom uiview inside a uiview controller does not show ios -

i have uiview controller , uiview called gcview. if code : self.view = [[gcview alloc] init]; i can see custom view. when drag , drop uiview in storyboard, assign property called customview and use code: self.customview = [[gcview alloc] init]; nothing shown. i want use second approach, because more convenient have stuff inside uiview created , handled dynamically, , others statically inside storyboard , handled in uiviewcontroller. make sure view object in story board of class gcview. call initwithcoder: in gcview class when view loads. once have that, remove this: self.customview = [[gcview alloc] init]; as object have been initialized storyboard loading. make sure of initialization calls in gcview class in initwithcoder: , not init.

html - Making a position:static (or :relative) element span the width of the page -

i have top "tray" advertisement. can slide away beyond border of page, javascript script. "divider" below holds close icon, , cosmetic, gets fixed when page scrolled past point. (this prevent browser's theme screwing page design). my problem before divider gets position:fixed javascript, needs either position:relative or position:static , absolute positioning take out of flow of page. when set position:static , width:100% there margin shows background image through it. want cover entire top of page. i've searched solution, can't find on how remove border. easier explain using jsfiddle : @ top there part red border, , directly below divider fixes page when scroll down. cannot figure out how red border , divider (before becomes fixed) span width of page. here's offending piece of html: <div class = "adtray"> <div class = "ad"></div> <div class = "ad"></div> </div...

android - Does recv() always return a complete data packet which has the expected length? -

i have question regarding recv (c, android). is recv guaranteed return complete udp datagram when returns? in case using recv read rtp packets socket. expected length of each rtp packet 172 (160 bytes payload , 12 header). however, i'm not sure whether have guarantee i'll complete 172 bytes when recv returns data. can confirm/comment? per posix, recv returns entire udp packet, unless , error occurs or buffer small entire packet. can detect setting msg_trunc flag, causes recv return frame's actual data length, can compare buffer size.

C++ how to return a const object from a class variable -

so have class called musiccomposer has audiosignal object data member called music. music non-const. however, need return music const audiosignal in method called getmusic. in source file: const audiosignal& musiccomposer::getmusic(){ } music declared as: audiosignal music; ^ in header file. i declare music non-const because music needs changed before returned getmusic method. however, can't figure out life of me how return const version of it. how can return const version of music? c++ can automatically change mutable const whenever. no biggie. it's going other way that's hard. return music; if really want explicit this, it's wierd code, , wierd bad. return static_cast<const audiosignal&>(music); also, cyber observed getter methods const, lets them called when musiccomposer const . const audiosignal& musiccomposer::getmusic() const { ^^^^^

javascript - How to show and hide an element in my case? -

i trying show , hide element when user clicks ul element i have like <ul ng-click="expandmenu =!expandmenu"> //when clicks ul, wrapper shows </ul> <div id='wrapper' ng-show='expandmenu' ng-animate="{show:'animate-show', hide:'animate-hide'}"> //contents </div> the element shows , hides expected when click ul want have smooth animation. my css .animate-show, .animate-hide { -webkit-transition:all linear 1s; -moz-transition:all linear 1s; -ms-transition:all linear 1s; -o-transition:all linear 1s; transition:all linear 1s; } .animate-show { opacity:0; } .animate-show.animate-show-active { opacity:1; } .animate-hide { opacity:1; } i found above answer google can't seem worked in case. can me out? thanks you don'y need ng-animate stuff need is .wrapper.ng-hide-add{ display:block !important; opacity:1; } .wrapper.ng-hide-remove{ display:blo...

mysql - Get best students from each class limit 3 results -

i need 2 best students each class. try select t1.nota,t2.sala,t3.serie aluno t1 left join sala t2 on t1.sala = t2.id left join serie t3 on t1.serie = t3.id order t1.serie,t1.sala,t1.nota limit t1.nota 2 ?? actual query result in: nota sala serie 9 1-102 1 ano 8.9 1-102 1 ano 9.1 1-102 1 ano 8.2 1-201 2 ano 9 1-201 2 ano 7.8 1-201 2 ano 9 1-303 3 ano 10 1-303 3 ano 8.7 1-303 3 ano 10 1-102 1 ano i need from nota sala serie 10 1-102 1 ano 9.1 1-102 1 ano 8.2 1-201 2 ano 9 1-201 2 ano 9 1-303 3 ano 10 1-303 3 ano ------ create table if not exists `aluno` ( `id` int(11) not null auto_increment, `serie` int(11) not null, `sala` int(11) not null, `nota` int(11) not null, primary key (`id`) ) engine=innodb default charset=latin1 auto_increment=11 ; insert `aluno` (`id`, `serie`, `sala`, `nota`) values (1, 1, 2, 9), (2, 1, 2, 10), (3,...

PHP: Search SubString in Array -

this question has answer here: search php array element containing string 5 answers i want array index particular substring. here got far: <?php $array = array(0 => 'blau', 1 => 'rot', 2 => 'grün', 3 => 'rot'); $key = array_search('grün', $array); // $key = 2; $key = array_search('rot', $array); // $key = 1; ?> it matches whole value. but, want match substring. there predefined function achieve goal? you try use array_filter strpos function search($var) { if(strpos($var, 'some_sub_string') !== false){ return true; } return false; } $array = array(0 => 'blau', 1 => 'rot', 2 => 'grün', 3 => 'rot'); array_filter($array, 'search'));

c - In a POSIX unix system, is it possible to mmap() a file in such a way that it will never be swapped out to disk in favor of other files? -

if not using mmap() , seems there should way give files "priority", time they're swapped out page faults trying bring in, e.g., executing code, or memory malloc() 'd process, never other files. 1 can think of situations useful. consider search engines, should keep index files in cache, may simultaneously writing new files (not being used search). there few ways. the best way madvise() , allows inform kernel need particular range of memory soon, gives priority on other memory. can use particular range not needed soon, should swapped out sooner. the hack way mlock() , forces range of memory stay in ram. not idea, , should used in special cases. common case store passwords in ram password cannot recovered swap file after computer powered off. not use mlock() performance tuning unless had exhausted other options. the worst way poke memory, forcing stay fresh.

c++ - Keyboard input doesn't work, works when clicking the mouse -

i have code: #include <iostream> #include <gl/glut.h> using namespace std; bool* keys = new bool[256]; void keyboarddown(unsigned char key, int x, int y) { keys[key] = true; } void keyboardup(unsigned char key, int x, int y) { keys[key] = false; } void reshape(int width, int height) { glfloat fieldofview = 90.0f; glviewport(0, 0, (glsizei)width, (glsizei)height); glmatrixmode(gl_projection); glloadidentity(); gluperspective(fieldofview, (glfloat)width / (glfloat)height, 0.1, 500.0); glmatrixmode(gl_modelview); glloadidentity(); } void draw() { if (keys['e']) cout << "e" << endl; glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glmatrixmode(gl_modelview); glloadidentity(); glbegin(gl_quads); glcolor3f(0.1, 0.1, 0.1); glvertex3f(1.0, 1.0, -1.0); glcolor3f(0.1, 0.9, 0.1); glvertex3f(1.0, -1.0, -1.0); glcolor3f(0.9, 0.1, 0.1); glvertex3f(-1.0, -1.0, -1.0)...

elasticsearch - Elasticseach script_score get value from a different index -

i trying use script_score adjust scoring of particular result based on id value. works basic run. not understand how perform lookup multiplication factor based on different table. example have mysql table of id's , associated scaling factors. these factors change hourly need used @ query time rather indexing time. while table in mysql can put index how can lookup. guess similar join in mysql? below idea of i'm going for: { "query": { "function_score": { "functions": [ { "script_score": { "params": { "param1": 2, "param2": 3.1 }, "script": "_score * doc['id'].value in associated table" //get scaling factor of id external table/index } } ], "query": { "filtered": { "query": { "match_all"...

c# - How to config unity to use setter injection only in my customeactionfilterattributes? -

in structuremap possible config when using setter injection actionfilterattribute injects , search setter in customeactionfillterattribute : setallproperties(x => x.matching(p => p.declaringtype.canbecastto(typeof(actionfilterattribute)) && p.declaringtype.namespace.startswith("myassemblyname") && !p.propertytype.isprimitive && p.propertytype != typeof(string))); how in unity? is setting [dependency] attribute enough?

jquery - How to hide animated elements on load? -

i'm using animate.css waypoints.js in landing page. want animate elements when user scrolls page. but, problem need hide elements before animation starts(if don't hide, animate.css hides element first , animates in, looks pretty ugly). however, solved problem adding 2 classes in css creates problem. .visible{ opacity: 1; } .invisible {opacity: 0; } // added following jquery code $('elem').removeclass('invisible').addclass('visible fadeinup'); this works until add animation-delay elements. here explanation want achieve. i've elements this: <ul> <li>element1</li> <li>element2</li> <li>element3</li> </ul> i want add animation delay each of elements, fadeinup after each other specified seconds in each of elements using animation-delay property. can't work. tried following code without using animation-delay no success. $('elem').each(function() { // code delay using ti...

python - Connecting multiple columns of a table -

i writing code taking data multiple columns of mysql database. in coding need print lines present in database, did , works fine it's not printing next column word match. i have text file "qwer.txt" contains line1:"i have car".line2:"i have phone" my tablename 'adarsh1' in "a1" column consists of car , "a2" consists of phone. according coding prints "i have car" instead of "i have car" and "i have phone" . so, problem in coding preventing me printing both line since presents in both column of table? import mysqldb db = mysqldb.connect(host="localhost", # host, localhost user="root", # username passwd="mysql", # password db="sakila") # name of data base cursor = db.cursor() # execute sql select statement cursor.execute("select a1,a2 adarsh1") # commit ch...

osx - Buliding an ARM cross-compiler with crosstool-ng on OS X -

i'm trying create cross compiler on mac raspberry pi, have managed configure, build , install crosstool-ng, when building arm-unknow-linux-gnueabi toolchain, fails. output of ./ct-ng build is: [info ] performing trivial sanity checks [info ] build started 20140517.143156 [error] [error] >> [error] >> build failed in step 'dumping user-supplied crosstool-ng configuration' [error] >> called in step '(top-level)' [error] >> [error] >> error happened in: ct_doexeclog[scripts/functions@216] [error] >> called from: main[scripts/crosstool-ng.sh@125] [error] >> [error] >> more info on error, @ file: 'build.log' [error] >> there list of known issues, workarounds, in: [error] >> '/usr/local/share/doc/crosstool-ng/ct-ng.1.19.0/b - known issues.txt' [error] [error] (elapsed: 0:00.00) [00:00] / make: *** [build] error 1 the contents of build.log are: ...

Rotate an iOS App ONLY When Playing a Video in WebKit? -

i have ios 7 app, , don't want whole interface landscape, when user plays video want play in landscape. don't have many view controllers, i'm fine implementing in each individual controller. you force view landscape when video playing, after has finished, force app portrait again. check out: force landscape ios 7

multithreading - How can I safely and timely dispose a scarce shared resouce in Java? -

in parallel application, threads(32) in thread group use shared unmanaged , standalone disposable object. we have same thing in our c/c++ app, , there use shared_ptr<> in order let object dispose , finalize after there no need object. i tried apply same thing in java, , faced finalize() method. there problems, because of gc lazy sometimes, object doesn't identified unreachable object disposing/finalizing, called, there no warranty gc lets object invoke finalize() completely. so came complex solution count down , track threads using object doesn't work too, know not reliable solution, , know faced unexpected results. i'm wonder if there equivalent shared_ptr<> in java, or possible handle object via jni? any ideas? doing want needs effort, , never feel natural in java, because deterministic cleanup of resources is foreign java. has gotten bit better since java 7 though. the best way work around this: add counter of type java.util.c...

python - How to get correct GMT `last_modifed` of AWS S3 key using `boto` API? -

Image
when using get_key , fetching last_modified property, there deviation of 3 hours. k = b.get_key('av-bait/modules/reporters.py') print k.last_modified i get: 'sat, 17 may 2014 18:42:02 gmt', while file updated @ 21:42:02 following picture indicates: any idea how fetch gmt via s3? thanks if want adjust string 3 hours can use: >>> t='sat, 17 may 2014 18:42:02 gmt' >>> datetime import datetime >>> str_time= datetime.strptime(t,'%a, %d %b %y %h:%m:%s gmt') >>> updated_time= str_time.replace(hour=str_time.hour+3) >>> print updated_time 2014-05-17 21:42:02 there many ways it, have @ datetime docs,

How to handle JavaScript events (e.g. 'link_to :remote') the Rails Way? -

i using ruby on rails 4 , handle javascript events rails way. is, example, given have following link_to('destroy', article_path(@article), :method => :delete, :remote => true) when click on above generated link success js event update page content removing deleted article dom element. ajax response, whatever is, should ignored. i aware of existence of rails.js file don't how use in order accomplish looking for. there wiki page https://github.com/rails/jquery-ujs/wiki/ajax explanation of ujs custom events. here little example in case: $('a').on 'ajax:success', -> alert 1 upd if want prevent xhr response being evaluated, add data-type=text attribute remote link: link_to('destroy', article_path(@article), :method => :delete, :remote => true, 'data-type' => 'text')

python - Why can't I make a frozeset of a list? -

when try code below: frozenset([[]]) i get traceback (most recent call last): file "-----.-----.py", line 1, in <module> frozenset([[]]) typeerror: unhashable type: 'list' why can't this? in python, the elements of set must hashable . python docs explain : an object hashable if has hash value never changes during lifetime (it needs hash () method), , can compared other objects (it needs eq () method). hashable objects compare equal must have same hash value. this because set needs able efficiently perform set operations , determine if item in set or not (by comparing hash values). since list mutable , not hashable, can't put in set. in code, if frozenset([]) fine. in case, creating frozenset of items in [] should hashable (since there aren't items in list, hashable-ness not problem). when frozenset([[]]) , python tries create frozenset of items in outer list; first item in outer list list ( [] ) not hashable;...

Loop invariant mistake -

this old midterm. looking on trying study final. fun(int n, int a[]){ for(i = 0;i < a.length; += 2){ a[i] = n; } return; } it asks loop invariant, @ location after loop begins, before assignment of a[i]. asks invariant , exit conditions imply loop achieves when exits. i answered: loop invariant < a.length exit conditions >= a.length this i+=2 implies array has entries equal n on every number n entry less or equal a.length i not awarded full credit, , think may due loop invariant. can clarify? sorry don't have enough reputation comment, write answer. i think loop invariant < a.length should be loop invariant < a.length , i%2=0 and for this i+=2 implies array has entries equal n on every number n entry less or equal a.length maybe lecture want it's even-indexed elements(the 1st,3rd... or a[0],a[2]...) , wouldn't necessary less or equal a.length

mysql workbench - Trim all characters in a field after a certain character -

i have column titled email. list of emails. has 2 emails in record, database separates them ' ' (space). i need deleted space (including space) i've tried update employee set email = trim(trailing ' ' email); which found in heaps of other posts nothing! thanks! you can use: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_substring-index it should like: update employee set email = substring_index(email, ' ', 1)

c# - How to parse Children of TreeviewItem correctly in ViewModel? -

i have treeview control in wpf program,which gets data mysql server , show databases , tables : server ...databases ...tables what want when click item in treeview ,i can server/databases/tables ' name.however,after hours testing,i still not name. hierarchicaldatatemplate of server <hierarchicaldatatemplate datatype="{x:type local:serverviewmodel}" itemssource="{binding children}"> <stackpanel orientation="horizontal"> <image width="16" height="16" margin="3,0" source="figures/server.png" /> <textblock text="{binding servername}" /> </stackpanel> </hierarchicaldatatemplate> the other 2 similar, except hierarchicaldatatemplate of table not have itemssource . as i'm using mvvmlight pattern,i pass selecteditem commandparameter to viewmodel : <i:interaction.triggers> <i:eventtrigger eventnam...

android - FLAG_ACTIVITY_CLEAR_TOP? -

as title says, why intent.addflags(intent.flag_activity_clear_top) or intent.setflags(intent.flag_activity_clear_top) won't work? i have 3 activities let a, b , c. when trying launch activity c code: intent = new intent(this, a.class); i.addflags(intent.flag_activity_clear_top); startactivity(i); it starts activity doesn't clear top.! -_- i have tried using setflags() . i read different questions on problem, couldn't find right answer. >_< somebody please help! edit code onbackpressed() in activity 'a' requested @codemagic. @override public void onbackpressed(){ if(wvlogin.cangoback()) wvlogin.goback(); else super.onbackpressed(); } from documentation flag_activity_clear_top : if set, and activity being launched running in current task , instead of launching new instance of activity, of other activities on top of closed , intent delivered (now on top) old activity new intent. as added i...

angularjs - How do I route off a module in Angular -

i have module declared. var app = angular.module('myapp', ['donor.donation.donationcontroller']); here setup of donationcontroller . var donationmodule = angular.module('donor.donation.donationcontroller', ['ngroute']); donationmodule.config(['$routeprovider', donationconfig]); and here donationconfig var donationconfig = function ($routeprovider) { $routeprovider.when('/donor/donation', { resolve: { resolveddata: 'donationcontrollerresolver' }, controller: 'donationcontroller', templateurl: 'js/donor/donation/donation.html' }); }; module.exports = donationconfig; the $routeprovider in donationconfig looking route /donor/donation , when go http://localhost:5000/donor/donation , cannot /donor/donation . how route off module? there no other routes defined app, missing? the problem angular looking # in route. when went http://localhost:5000#donor/donation w...

cryptarithmetic puzzle - Need assistance with similar More Money code for Prolog -

every letter below in puzzle uniquely represent 1 of 10 digits in 0, 1, …, 9. no 2 letters represent same digit. each word below in puzzle, first letter not 0. ex: shine - == knit all i've got code this... :- lib(ic). exampleone(list) :- list = [s, h, i, n, e, t, a, k], list :: 0..9, diff_list(list), (10000*s - 1000*h - 100*i - 10*n - e) - (1000*t - 100*h - 10*a - n) $= (1000*k - 100*n - 10*i - t), s $\= 0, t $\= 0, k $\= 0, shallow_backtrack(list). shallow_backtrack(list) :- ( foreach(var, list) once(indomain(var)) ). diff_list(list) :- ( fromto(list, [x|tail], tail, []) ( fromto(y, tail, param(x) x $\= y ) ). comparelists(list) :- length(list, n), ( foreach(input1, list), count(i, 1, n), param(n, list) ( foreach(input2, list), count(j, 1, n), param(list, input1, i, n) ( ( $\= j, input1 $\= input2 ) ...

angularjs - Angular-ui ui-router - using multiple nested views -

i trying out nested views feature of ui-router plugin, faced issue don't know how solve. code shows problem can found @ http://jsfiddle.net/3c9h7/1/ : var app = angular.module('myapp', ['ui.router']); app.config(function($stateprovider) { return $stateprovider.state('root', { template: "<div class='top' ui-view='viewa'></div><div class='middle' ui-view='viewb'></div>" }).state('root.step1', { url: '', views: { 'viewa': { template: '<h1>view a</h1>' } } }).state('root.step1.step2', { url: '/step2', views: { 'viewb': { template: '<h1>view b</h1>' } } }); }); app.controller('mainctrl', [ '$scope', '$state', function($scope, $state) { $state.transitiont...

java - Primefaces schedule and selectEvent -

i use 5.0 now, in 4.0 same. 3.5 works well. i've got scheduleevent implementation, store in postgresql table jpa. use lazy data model, can persist new events, , load them back. event , title appear in schedult. schedulemanager session scoped bean, handle ajax events, oneventmove, oneventresize, , oneventselect. last event handler getobject method give null, can't edit event. my event implementation this: @entity @table(name = "basescheduleevent") @namedquery(name = "basescheduleevent.findall", query = "select l basescheduleevent l") public class basescheduleevent implements scheduleevent, serializable { private static final long serialversionuid = 6213082779383114637l; private string id; private string title; private object data; private date startdate; private date enddate; private string description; @id @generatedvalue(strategy = generationtype.identity) @column(unique = true, nullable = false) public str...

linux - Compiling SDL program written in C. -

i've got problem compiling sdl program. i've installed sdl dev package according post: https://askubuntu.com/questions/344512/what-is-the-general-procedure-to-install-development-libraries-in-ubuntu (method 1). seems completed without errors. when i'm trying compile such instruction: gcc -i/usr/include/sdl/ showimage.c -o out -l/usr/lib -lsdl it returns error: showimage.c:7:23: fatal error: sdl_image.h: no such file or directory compilation terminated. even if put sdl_image.h folder i'm compiling returns error: /tmp/ccfiso10.o: in function `load_image': showimage.c:(.text+0xd): undefined reference `img_load' collect2: ld returned 1 exit status here code recive teacher: #include <stdlib.h> #include <stdio.h> #include <string.h> #include "sdl.h" #include "sdl_image.h" sdl_surface* load_image(char *file_name) { /* open image file */ sdl_surface* tmp = img_load(file_name); if ( tmp == ...

javascript - How can I loop through a list of form ID's and add a submit handler to each? -

i have website containing lot of different contact forms. want keep array of id's (and other related settings) can loop through them , add submit handlers each one. the problem last form in array seems handler attached it. list of forms: forms = [ {id: '#contact-form-1', ...}, {id: '#contact-form-2', ...} ] how i'm trying add submit handlers: for (i in forms) { $(document).on('submit', forms[i].id, function(){ // validation, send email etc. } } is $(document).on() right way approach this? have tried $(forms[i].id).submit(); same outcome; last form in list gets bound to. might want other way round. /* listen submit forms */ $('form').on('submit', function() { /* id of 1 */ var _id = $(this).attr('id'); /* conditions on _id */ )); so objects : var formids = { formidone: { func : function() { alert('called form id one'); }}, formidtwo: { func : fu...

ruby on rails - Deploying to Heroku Error foundation 5 -

anyone know why getting this? when deploying heroku? file import not found or unreadable: foundation_and_overrides. on production.rb: config.serve_static_assets = true config.assets.compile = true thanks in advance

sql - Error in execution of query in java class -

hi not execute following query. works fine in sql developer doesnt work in java class query = new stringbuilder().append("select substr(attrib,2) def,decode(parent_id,null,null,'c'||parent_id) xyz,'c'||attribute_id lmn,decode(parent_id,null,'c'||(to_char(attribute_id)),'c'||parent_id||'/'||'c'||attribute_id) abc (select attribute_name,sys_connect_by_path(attribute_name, '/') attrib, treestruct_attribute_name,parent_id,attribute_id my_table treestruct_attribute_name = 'xyz' start attribute_level =1 connect prior attribute_id = parent_id);").tostring(); statement stmt=con.createstatement(); system.out.println("after connection"); resultset rs = stmt.executequery(query); system.out.println("after ececute"); query not executed. goes exception block. should execute query in java class

javascript - what is this ext.js's "xtype: 'app-main'" -

newbie ext.js: trying understand this: xtype: 'app-main' means in auto generated code. no documentation available. guess reference me alias, not find it.. i used sencha cmd (latest may 2014 - ext.js 4.2.2) autogenerated number of files, had xtype: 'app-main' in them... main.js ext.define('test12.view.main', { extend: 'ext.container.container', requires:[ 'ext.tab.panel', 'ext.layout.container.border' ], xtype: 'app-main', <<<<------- layout: { type: 'border' }, items: [{ region: 'west', xtype: 'panel', title: 'west', width: 150 },{ region: 'center', xtype: 'tabpanel', items:[{ title: 'center tab 1' }] }] }); viewport.js ext.define('test12.view.viewport', { extend: 'ext.container.viewport...

ios - AutoLayout in UITableview with dynamic cell height -

Image
for dynamic height of table view cell take reference link. using auto layout in uitableview dynamic cell layouts & variable row heights here code of tableview data source , delegate methods -(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section; { return arrtemp. count; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier=@"autolayoutcell"; autolayouttableviewcell *cell=(autolayouttableviewcell *)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell==nil) { (id currentobject in [[nsbundle mainbundle] loadnibnamed:@"autolayouttableviewcell" owner:self options:nil]) { if ([currentobject iskindofclass:[uitableviewcell class]]) { cell = (autolayouttableviewcell *)currentobject; break; } } } cell.iblbllineno.text=[nsstring stringwithformat:@"line:%i",i...

c++ - Setting an internal variable of an explicitly linked DLL -

i loading dll explicitly loadlibrary , use getprocaddress load function it. far good. following variable defined in header file of dll (readline.h): readline_dll_impexp file *rl_outstream; this variable used internally dll, why have change "inside dll". new c++ , couldn't find way set variable in parent cpp file. tried: hdll = loadlibrary("readline.dll"); hdll.rl_outstream = fopen("outstream.txt","w"); which yields following error: error c2228: left of '.rl_outstream' must have class/struct/union type 'hinstance' did intend use '->' instead? how set dll variable correctly? where should have searched find solution problem? if need set variable inside dll. need export variable. consider following example: we have dll: #include <cstdio> #include <cassert> #ifdef __cplusplus extern "c" { #endif file *rl_outstream; void do_something() { assert(rl_outstream); ...

grails - Not sure if I have an issue with blank constraint or Dynamic Scaffolding -

i have simple domain class has few properties. want allow 1 of them empty. using blank:true in constraints block. in config.groovy have set convertemptystringstonull=false. believe keep form submission setting blank field null , submit failing on implicit nullable check. i using dynamic scaffolding in controller. i have added data via bootstrap.groovy. 1 record has blank field , saves expect. i launch app , list shows bootstapped records, including 1 blank field. when try create new record, property accepts blanks, getting "please fill out field" validation error. believe record should save. i'm not sure if issue scaffolded view, issue blank constraint, or me not understanding how these features should work. any appreciated. i guess entry in config.groovy is: grails.databinding.convertemptystringstonull = false the scaffolding plugin not take configurationoption account , scaffolded view _form.gsp contains required="" attribute ...

node.js - Node js start and stop windows services -

i have nodejs app communicates third party application installed windows service. nodejs application requires service running, if circumstances may not. im trying search method check if windows service running , if not start it. after many days searching have found many results running nodejs application windows service not 1 providing ability start/stop installed windows services. is possible? have found tools psexec make nodejs run such script preferable if nodejs perform task natively. any information end useful , find hard believe others haven't been in situation have needed also. stephen in windows, command line can type: # start service net start <servicename> # stop service net stop <servicename> # can pause , continue so, simple answer - use child-process start service on startup of server. this: var child = require('child_process').exec('net start <service>', function (error, stdout, stderr) { if (error !==...

php - Replace die statement -

currently code looks this <?php if($controlsomething) { include(header); echo "something"; include(footer); die(); } if($anothercontrol) { include(header); dosomeoperations(); // throw error if $controlsometing true echo "something else"; include(footer); die(); } ?> clearly not way things. want move cleaner. i created view class wrap page , avoid include(header)/include(footer) repetition. converted conditional statement, changing if($condition) function condition () . now should ? thinking of : if(condition1()) { message condition1 ...} else if(condition2()) {} the problem file might included file executed because there no die statement anymore. so should include var "die" in view object , check value before doing on every page ? doesn't seem clean me. have thousands of lines of code more simple/automated solution, better.

How to keep function(dset,group) unchanged in R -

this question has answer here: how store t or f value , p value in data frame 1 answer x<- c(62, 60, 63, 59, 63, 67) grp1<-factor(rep(1:2)) grp2<-rep(1:3) dat <-data.frame(x,grp1,grp2) aaa<-function(dset,group) { if (length(levels(group))==2) { print("ccc") } else { print("ddd") } } i run aaa(dset=dat,group="grp1") , result not "ccc" . how revise aaa function contents , keep aaa(dset=dat,group="grp1") unchanged? my answer: aaa<-function(dset,group) { grp<-dset[,c(group)] if (length(levels(grp))==2) { print("ccc") } else { print("ddd") } } aaa(dset=dat,group="grp1") the function needs know context of group (namely subset of dset ): aaa <- function(dset,group) { if (length(levels(dset[,group])) == 2) { #this d...