Posts

Showing posts from July, 2013

plsql - Can anyone tell me what is wrong with the following PL/SQL block? -

i trying execute following script in sqlplus each time says "missing keyword". main objective select random number column1 of table variable vnm_rand_number each value(1 8) of column2. please tell me wrong code , there other way me this? declare vvc_sql_stmt long; vvc_name varchar2(10) := 'asdf'; vnm_rand_number number; vvc_table_name varchar2(50); begin vvc_table_name := 'ak_'||vvc_name||''; in 1 .. 8 loop vvc_sql_stmt := 'select column1 vnm_rand_number from( select * '||vvc_table_name||' column2 = '||i||' order dbms_random.value) rownum = 1'; execute immediate (vvc_sql_stmt); commit; dbms_output.put_line(vnm_rand_number); end loop; end; / it's helpful post full error stack (the ora-xxxxx error number, line throwing error, etc.). guess want vvc_sql_stmt := 'select column1 ' || ' from( ' || ' select * ' || ' ' || vvc_table_name || '

r - How to draw a power curve using ggplot2 -

Image
i want use ggplot2 visualize data follows power curve. has been asked before ( add exp/power trend line ggplot ) answer didn't help. one trick use stat_function() create curve. however, unable stat_function() , power curve work logarithmic scales. i illustrate problems. create sample data , base plot: library(ggplot2) x <- 1:100 pwr <- function(x)x^-2.5 dat <- data.frame(x, y = pwr(x)) p <- ggplot(dat, aes(x = x, y = y)) + geom_point() p + stat_function(fun = pwr) great, let's add logaritmic scales using coord_trans() . works perfectly, except straight lines no longer straight (exactly documentation tells me expect). p + stat_function(fun = pwr) + coord_trans(x = "log10", y = "log10") so, try again coord_x_log10() , coord_y_log10() , throws error : p + stat_function(fun = pwr) + scale_x_log10() + scale_y_log10() error in seq.default(min, max, = by) : 'from' cannot na, nan or infinite this has fact

java - How to filter properties on a self reference using Jackson? -

let's have class want serialize jackson. public class product { int id; string name; list<product> similarproducts; } how end this? { "id": 1, "name": "product 1", "similarproducts": [ { "id": 2, "name": "product 2" }, { "id": 3, "name": "product 3" } ] } i've see how use @jsonproperty class or @jsonview select things seems it's class (am mistaken)? i'm not sure how work when have class that's referencing , parent has many properties, while child has few. imagine ecommerce site , want name , url of similar products single json payload, don't need other details of similar products (children). you can serialize using @jsonfilter annotation. new version of model: public class product { int id; string name; @jsonfil

python - launch tornado app on port 80 on remote server -

i have flask app wrapped in tornado server , trying run app on remote server when got error: traceback (most recent call last): file "run.py", line 7, in <module> server.listen(80) file "/home/ec2-user/gatekeeper/local/lib/python2.7/site-packages/tornado/tcpserver.py", line 126, in listen sockets = bind_sockets(port, address=address) file "/home/ec2-user/gatekeeper/local/lib/python2.7/site-packages/tornado/netutil.py", line 187, in bind_sockets sock.bind(sockaddr) file "/usr/lib64/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) socket.error: [errno 13] permission denied so tried use sudo , got this: traceback (most recent call last): file "run.py", line 1, in <module> tornado.wsgi import wsgicontainer importerror: no module named tornado.wsgi so wondering if must install tornado root in turn mean virtualenv practically useless. how launching

delphi - How do I raise an exception in an asm block? -

i want raise exception in x64 asm block. lets assume have function so: function example(values: array of integer): integer; asm or rcx,rcx jz @error .... i know can read pointer , av, want raise more descriptive error. i make additional function , call one: asm or rcx,rcx jz @error .... @error: mov ecx, 1 mov rdx, errorstring jmp raiseerror .... function raiseerror(code: integer; const msg: string); begin case code of 1: raise eemptyarrayerror.create(msg); however error occur outside function in caused. how exception (seem to) originate inside example function. note x64, seh answers apply x86 no because x64 uses veh. the full syntax of raise is: raise exception @ address all need pass current ip parameter , error proc can pass on exception. you can rip using lea rax, [rip] . thus code becomes: asm or rcx,rcx jz @error .... @error: mov ecx, 1 mov rdx, errorstring lea r8,[rip] jmp raiseerror .... fun

Odd syntax in C++: return { .name=value, ... } -

while reading article, came across following function: solidcolor::solidcolor(unsigned width, pixel color) : _width(width), _color(color) {} __attribute__((section(".ramcode"))) rasterizer::rasterinfo solidcolor::rasterize(unsigned, pixel *target) { *target = _color; return { .offset = 0, .length = 1, .stretch_cycles = (_width - 1) * 4, .repeat_lines = 1000, }; } what author doing return statement? haven't seen before, , not know how search it... valid plain c too? edit: link original article this isn't valid c++. it's (sort of) using couple features c known "compound literals" , "designated initializers", few c++ compilers support extension. "sort of" comes fact legitimate c compound literal, should have syntax looks cast, you'd have like: return (rasterinfo) { .offset = 0, .length = 1, .stretch_cycles = (_width - 1) * 4, .repeat_lines = 1000, }; regardless o

css - Website resources still loading with https protocol -

i've strange issue website . several months ago site had ssl cert i've stopped using reasons. since seems works few days ago lot of users tell me issues website (broken layout said). of them solves issue hard refresh. since last update of chrome (yesterday) i'm facing same issue stylesheet doesn't load. so took in source code of page , see every resources (css, js, img, ...) loaded in https protocol instead of http. it's why can't load. i don't know happens, i'm facing issue chrome , i've of course clean cache, cookies, ssl certs, can clean , clean again. in htaccess nothing rewriting http in https protocol, nothing in wp-config (i'm running wordpress install), , subdomain tv.blizzheart.com on same domain , using same vhost works perfectly. today users tell me error occures in firefox too. on side i'm facing issue chrome (i've tried firefox , ie). of them said error occures on login page (blizzheart.com/login/) i'm

Android Studio IDE got Broken -

after sudden shutdown of computer, android became broken. i couldn't see toolbar adv , sdk manager are, , in tools options "tasks & context", "save file template...", "generate javadoc...", "new scratch file...", "ide scripting console" , "xml actions". if ide forgot android. i decided uninstall android studio checking options ("android sdk" , "android user settings" (it took long while). after installing normaly, , downloading packages, started ide, opened project , same, still can't find toolbar managers. after searching, posts said start ide in quick start (which shows fine) configure sdk, "configure" > "project defaults" > "project structure" , "android sdk" option seen. tried "invalidate caches / restart" in file menu still same. windows 7, java 1.8.0_45 android-studio 1.2.2 how can fix this? here's how looks

vb.net - Move Form if second monitor screen exists -

looking way load if second screen exists. i have tried code load event: dim numofmon integer = screen.allscreens.length if numofmon > 1 me.bounds = screen.allscreens(1).bounds end if side note: if point me how detect when cursor no longer on form, appreciate it. to able place form on second screen, set windowstartuplocation manual before setting bounds. causes form positioned according left , top property values. these set changing bounds property did. to detect if cursor above form that's focused, use mouseenter , mouseleave events.

javascript - Adding Navigational Arrows and Pagination GSAP Slideshow -

i have built slideshow following gsap / jquery script. looking way extend script add navigational arrows , pagination. any appreciated. <script> $(function(){ var $slides = $(".slide"); var $slides_text = $(".slide2"); var currentslide = 0; var staytime = 5; var slidetime = 1.3; tweenlite.set($slides.filter(":gt(0)"), {opacity:0,display:'none'}); tweenlite.set($slides_text.filter(":gt(0)"), {opacity:0,display:'none'}); tweenlite.delayedcall(staytime, nextslide); function nextslide(){ tweenlite.to( $slides.eq(currentslide), slidetime, {opacity:0,display:'none'} ); tweenlite.to( $slides_text.eq(currentslide), slidetime, {opacity:0,display:'none'} ); currentslide = ++cur

sql - Column type to store 0..7 (octal) and bool values (oracle, postgres) -

i create table in oracle , need make single column following values 0, 1, .., 6, 7 create table "loc_db"."ti_ts" ( "bit" char(1) constraint cons_ti_ts_bit check (bit in ('0','1','2','3','4','5','6','7')) ) this the one best way ? or, maybe, we've got special types(octal number system) (in case of postgresql question interests too ) edit 1 i told practice better: create table "loc_db"."ti_ts" ( "bit" number(1,0) not null constraint const_ti_ts_bit check (bit between 0 , 7), "activ" number(1,0) not null constraint const_ti_ts_active check (activ in (0,1)), ) thanks matt allwood, a_horse_with_no_name

php - Elgg white screen: undefined function Elgg\\mysql_connect() -

i have elgg website running on ubuntu 12.04 abruptly started producing white screen of death. no changes made php files, of working moments before. error in apache error.log : [thu jul 23 09:45:49.672038 2015] [:error] [pid 6905] [client 127.0.0.1:53280] php fatal error: call undefined function elgg\\mysql_connect() in /var/www/my-website/engine/classes/elgg/database.php on line 144 apache2 can load html , php pages , can log mysql command line. i've restarted apache2 , mysql . php, afaik, @ recent version. have restarted computer , installed recent updates. following test page produces nothing seems out of ordinary untrained eye: <?php echo "test!"; error_reporting(e_all); ini_set('display_errors', true); ini_set('display_startup_errors', true); phpinfo(); exit(); ?> this post makes me think maybe update ran , broke php / mysql connection, can't confirm that. simpy put, i'm stumped. given error is undefined function elgg\

windows - How to set a variable with an environment variable read from a text file -

i've created following config file contains parameters used batch file: file winscp.conf : folder %appdata%\winscp version 5.7.4 visit http://sourceforge.net/projects/winscp/files/winscp/ download http://sourceforge.net/projects/winscp/files/winscp/5.7.4/winscp574.zip batch file ( get.bat ): @echo off setlocal @if not exist "%1" ( echo config file not found in "%1" exit /b ) @for /f "tokens=1,2 delims= " %%a in (%1) ( set %%a=%%b ) mkdir %folder% when call batch file this: get.bat winscp.conf i sub-folder %appdata%\winscp created in current folder, this: c:\temp\%appdata%\winscp while want winscp folder created in windows app data folder, this: c:\users\caffe\appdata\roaming\winscp i think there's wrong statement set %%a=%%b , since if change set %%a=%appdata%\winscp folder created way want. the variables inside tokens should expanded prior assignment adding call : call set %%a=%%b

php - Accessing controller's global variable in ajax returns NULL -

hi guys have controller proceses data in index() assign on global variable. i want global variable accessed ajax when pages loaded. here i've done in index(): class search extends ss_controller { public static $q; public function index(){ $k = $this->input->get(null, true); $data['title'] = "search"; $data['page_content'] = "search_results_view.php"; $data['logout'] = "/./ssmis/home/logout"; $data['active_nav'] = 'search'; $data['k'] = $k['k']; self::$q = array('123','456'); ... and have method function called in ajax: public function q(){ var_dump(self::$q ); if(self::$q ){ $response['error'] = false; $response['has_data'] = true; $response['message'] = 'success'; $response['data'] =

css - Bootstrap input inside column -

i have html this <div class="col-lg-4"><input type="text"></div> how can make input width stretched @ column size? put class form-control input element. <div class="col-lg-4"> <input class="form-control" type="text"> </div>

sql server - Issue escaping single quote on mssql 2008 from php codeigniter -

i doing insert database 1 of columns trying escape single quotes user might type. example, it's , using codeigniter framework , did following escape column: $test=$this->db->escape($test); but sql-server error when submit. example if type it's , trying this insert table (test) values(''it''s'') when should be insert table (test) values('it''s') why inserting single quotes? you escaping entire sql statement when should escaping string inserting. example, lets have following code currently. $test = "insert table (test) values ('" . $value . "');"; you should change be $test = "insert table (test) values ('" . $this->db->escape($value) . "');"; edit as liam pointed out, since using codeigniter, may want consider using query binding provide. see url more information: https://ellislab.com/codeigniter/user-guide/database/queries.html

TFS, Jenkins and how to update work items with build numbers -

we using tfs , tfs build service. considering migrate build service jenkins came across issues. according this site , there things not work tfs , jenkins plugins. of them use lot: associated change sets – team build automatically associates list of change sets included in build associated work items – team build analysis relationships , associates work items build. indeed walks work item tree (parent) , maintains association in chain. is still true? have scenario: a developer checks in code fix bug or resolve user story. associating check in work item id. his check in triggers build associate work item changeset. bugs, build update "integrated in build" field build number. use field know in witch version bug fixed. is there way make jenkins behave , tfs build service does? another option mix 2 using dummy builds on tfs side set records straight , kick-off jenkins' builds. hints how trigger jenkins builds remotely , pass parameters , “fake” tfs

jsp - Show the username on the header of every page in Struts 2 -

i have used interceptors authentication app.i have added defaultstackhibernate working fine & getting desired results, issue want show username on header of every page. i have try <s:property value="name"></s:property> work welcome page.so there way can send variable username interceptor every action invoking or directly jsp? if access others action session null thanks. the following part of code in header page jsp : <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <b><s:property value="name"></s:property></b> <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="user_profile.html">my profile</a></li> <li class="divider"></li> <li><a href="logout">log out</a></li> </ul> </li&

c# - How can I programatically Kindlize an .HTML or .DOCX or .PDF file (make it Kindle-ready)? -

Image
empirical observation has brought me conclusion when upload book files createspace (print books), best rendered .pdf files. kindle (ebook) format, otoh, turn out better when provided .docx file. still far perfect, though. created book contains text - 1 font english, , different font, , bolded, alternating translated-into-spanish paragraphs. paperback version looks fine. here's how displays: the kindle version of file, though, "9x uglier bag of butts" (or @ least plainer nebraska): as can see, has no breaks between paragraphs (besides line break - big whoop!), , not retain bold formatting on spanish paragraph - or chapter heading formatting! kindlizing process apparently sees text being equal - no special formatting attempted! so, since kindle rendering process not work (it worse when giving them same pdf provided create book file - parts of missing rendered content reason), there way can programmatically (in c#) massage file (either html, docx, or pdf) all

angularjs - Chrome is closing my ajax post at exactly 60 seconds -

Image
i submitting information takes longer 60 seconds process, reason chrome closing connection @ 1 minute. have page cached akamai timeout 120 seconds, else must causing problem. don't have timeouts in our angular code or anywhere close. here output chrome's net internals. happens in chrome, ie , firefox process submit fine. t=191705 [st= 0] +request_alive [dt=60081] t=191705 [st= 0] url_request_delegate [dt=0] t=191705 [st= 0] +url_request_start_job [dt=60080] --> load_flags = 672000 (bypass_data_reduction_proxy | maybe_user_gesture | report_raw_headers | verify_ev_cert) --> method = "post" --> priority = "low" --> upload_id = "0" --> url = "https://qa2.web.com/payment/submit" t=191705 [st= 0] url_request_delegate [dt=0] t=191706 [st= 1] http_cache_get_backend [dt=0] t=1917

centos - PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so -

i'm working centos 6.5 when i'm executing php -v i'm getting below message: php warning: php startup: unable load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: cannot open shared object file: no such file or directory in unknown on line 0 php 5.4.36 (cli) (built: dec 19 2014 06:28:27) copyright (c) 1997-2014 php group zend engine v2.4.0, copyright (c) 1998-2014 zend technologies as seems memcached error, when i'm trying this yum install memcached.x86_64 php-pecl-memcache.x86_64 i'm getting below mentioned errors: loaded plugins: fastestmirror loading mirror speeds cached hostfile * rpmforge: mirror.team-cymru.org drivesrvr | 2.2 kb 00:00 setting install process resolving dependencies --> running transaction check ---> package memcached.x86_64 0:1.4.

C++ Pointer to unordered_map entry changes, but entry not -

i'm trying set variable of unordered_map entry "chunk" calling function using pointer entry. pointer changes value "chunkindex", map entry not glm::ivec3 chunkindex(1, 1, 1); chunks.insert(make_pair(chunkindex, chunk())); chunk = &chunks[chunkindex]; chunk->setchunkindex(chunkindex); logvector(chunk->chunkindex); // output: 1, 1, 1 logvector(chunks[chunk->chunkindex].chunkindex); // output: 0, 0, 0 "chunks" unordered_map of type: typedef unordered_map<glm::ivec3, chunk, keyhash, keyequal> chunkmap; do know why pointer changes value, , not referenced object? thanks in advance! update: chunks.insert(make_pair(chunkindex, chunk())); log((chunks.find(chunkindex) == chunks.end()) ? "true" : "false"); this code outputs true, inserted entry doesn't exist! this might useful too: struct keyhash { size_t operator()(const glm::ivec3& k)const { return std

javascript - jquery select div index -

let's assume have following divs <div class="category"></div> <div class="item"></div> <div class="item"></div> <div class="category"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="category"></div> <div class="item"></div> i access specific div class "category". i know can use first: $(".category").first() but if want 2nd or 3rd? etc..? you can use eq() select element using index. reduce set of matched elements 1 @ specified index. $('.category').eq(2) // 3rd element note: index starts zero. demo $('.category').eq(2).css('background', 'green'); .category { background: red; width: 100px; hei

php curl run send proxy ip -

i made curl script , script blocked after website detects bot. how can prvent , i tried below code $ch = curl_init(); $proxy = "10.128.60.40:3128"; // needed disable ssl checks site curl_setopt($ch,curlopt_ssl_verifyhost,0); curl_setopt($ch,curlopt_ssl_verifypeer,0); curl_setopt($ch,curlopt_verbose, 0); curl_setopt($ch,curlopt_autoreferer, false); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_useragent, 'mozilla/5.0 (windows nt 5.1; rv:13.0) gecko/20100101 firefox/13.0.1'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_httpproxytunnel, 1); curl_setopt($ch, curlopt_proxy, "$proxy"); but still data blocked due automated script, how can u send dynamic ip avoid issue you should use: 1) anonimous proxies (dies quick , need parse them) or 2) tor https://www.torproject.org or 3) not active. use sleep(1); in code

objective c - iOS, View width - out of bounds -

Image
i'm having issue storyboard (least bit surprised). i have 1 viewcontroller holds container view along side various image views. naturally, image views selected determine displayed in container view. my issue when simulated on iphone 6 plus, have container not meeting edge of window, creating gap (see below - left hand side). my constraints seen below as appear in storyboard i'm lost how supposed & correctly. suggestions? delete 2 constraints , add them again, time unchecking "constrain margins".

sockets - C - Get a string of an IP address using sin_addr -

this question has answer here: how print ip address getaddrinfo() 2 answers i'm trying ip address struct in_addr , put in char array. i've tried following code got segmentation fault error. char ip[30]; strcpy(ip, (char*)inet_ntoa((struct in_addr)clt.sin_addr)); can tell me how fix this? expanded code bit make compile #include <netinet/in.h> struct sockaddr_in clt; int main() { char ip[30]; strcpy(ip, (char*)inet_ntoa((struct in_addr)clt.sin_addr)); } trying compile warning enabled (always idea) gives few warnings, , sure not work $ gcc -wall -wextra -o3 ntoa.c -o ntoa && ./ntoa ntoa.c: in function 'main': ntoa.c:5:3: warning: implicit declaration of function 'strcpy' [-wimplicit-function-declaration] ntoa.c:5:3: warning: incompatible implicit declaration of built-in function 'strcpy' [enabled d

http basic authentication - How to configure http_basic firewall in Symfony to return JSON in response body? -

by default, when configure http_basic firewall in symfony, firewall return " 401 unauthorized " , empty body requests fail. i'd have return custom json (eg: {success: false, error: 401} ). possible? here's configuration: security: firewalls: api: http_basic: provider: myprovider you need use custom authenticationentrypoint . create class implementing authenticationentrypointinterface : <?php namespace appbundle; use symfony\component\security\core\exception\authenticationexception; use symfony\component\security\http\entrypoint\authenticationentrypointinterface; use symfony\component\httpfoundation\response; use symfony\component\httpfoundation\request; class custombasicauthenticationentrypoint implements authenticationentrypointinterface { private $realmname; public function __construct($realmname) { $this->realmname = $realmname; } public function start(request $request

javascript - Setting cookies for internjs functional tests -

i'm trying set cookie intern functional test, cookie data doesn't seem available on page. here's setup: registersuite(function() { 'test': function() { return this.remote .get(require.tourl("index.html") .setfindtimeout(5000) .setcookie({name: "foo", value: "bar"}) .then(function() { //... test here ... }); } }); when accessing document.cookie inside index.html, there no data. tips on doing wrong? update : i haven't solved problem, figured out need call setcookie() before get(). way i'm hacking around call get() on noop url, , calling setcookie() return this.remote .get('/') .setcookie({name: "foo", value: "bar"}) .get(require.tourl("index.html") .setfindtimeout(5000) .setcookie({name: "foo", value: "bar"}) .then(function() {

c# - Disable dates from dropdownlist in datepicker -

i have dropdownlist dates. , can iterate through dates in jquery. have datepicker , want disable dates dropdownlist in datepicker. the id of dropdownlist is: #form_one3. and javascript this: inp.datepicker({ dateformat: dateformat, changemonth: true, beforeshowday: function(date) { $("#form_one3 > option").each(function() { //alert(this.text); var array = [this.text].tostring(); alert(array.tostring()); var string = jquery.datepicker.formatdate('yy-mm-dd', date); return [array.indexof(string) == -1]; }); }, changeyear: false, showweek: true, firstday: 1, yearrange: "c-100:c+15", showon: inp.hasclass("ui-date-picker-onfocus") ? "focus" : "button" }) if this: $("#form_one3 > option").each(function() { alert(this.text); }); i see dates dropdownlist. but complete javascript file give

cmd - Batch script for copying files with folder -

i have list of files path in rarme.txt file. such as: d:\test\bin\test.dll d:\test\bin\test.exe d:\test\image\house\door.bmp d:\beta\apphouse.dll now how copy files 1 or 2 level folder for ex: in case of d:\test\bin\test.dll how copy test.dll file within bin folder? and in case of d:\test\image\house\door.bmp how copy door.bmp within image\house folder ? this bat script copies file location d:\forpatch , rars it rem copying files folder pause /f "tokens=*" %%i in (rarme.txt) xcopy "%%i" "d:\forpatch" /s pause cd d:\forpatch pause rar -ep1 -r patch.rar *.* pause hoping understand aim: @echo off >nul setlocal enableextensions rem copying files folder /f "tokens=*" %%i in (rarme.txt) ( /f "tokens=1,* delims=/\" %%j in ("%%~pi") ( echo if not exist "d:\forpatch\%%~k" mkdir "d:\forpatch\%%~k" 2>nul echo copy /b "%%~

Java 8 metaspace garbage collection -

Image
a java process i'm running performs consistently in first hour or runs. however, performance rapidly degrades. when profiling found metaspace garbage collection happened until hour mark , got out of control: i'm sure i'll able fix using -xx:maxmetaspacesize option. however, i'd know more why behaviour might occurring. can't imagine why garbage collection algorithm behave this. have explanation or advice better fix? thanks you can try setting -xx:maxmetaspaceexpansion=0 . should force full gc - releasing dynamically created methods/class data - before attempting grow metaspace. additionally can try setting maxmetaspacefreeratio lower value default shrink metaspace more after gc. see this answer other metaspace related options. metaspace collection relies on classes being unloaded garbage collector. depending on gc you're using tweaking reclaim garbage sooner might help.

python - App installed on OpenShift won't run after adding form -

i added form application using wtforms, , app no longer works on openshift. can run on localhost, believe error may lie in setup.py . need change work? from setuptools import setup setup(name='granite', version='2.0', description='personal blog', author='myname', author_email='myemail', url='mysite', install_requires=[ 'flask', 'flask-flatpages' ], ) you need add flask-wtf install_requires list. setuptools uses list install whatever packages application need run. it's important keep updated. can see packages have installed in virtualenv (you are using virtualenv right?) runnning command terminal virtualenv active: $ pip freeze [> filename] the part in brackets can optionally added output results file (usually called requirments.txt ). note see things in pip freeze don't remember installing. these packages installed via requirment

javascript - Starting up with Underscore.js (A simple running program) -

i ui/ux designer worrying start underscore.js. have used jquery, jquery-ui, , other javascript libraries, add cdn , start events , classes our work done. i start simple program underscore.js out of worthwhile tutorial in 'w3schools.com' start with. can me out simple running program it? <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> </head> <body> //underscore code goes here ... </body> </html> when i'm lazy set jsfiddle try out in underscore google underscore jsfiddle [underscore function name]. google return jsfiddle examples (mostly) correctly set , have try out/modify: _.each(list, iteratee, [context]) _.each _.template(templatestring, [settings]) _.template

java - Is there a way to tell the programming language of a web app? -

this question has answer here: how determine technology website built on? [closed] 18 answers this bit of silly question, wondering if there way tell underlying programming language of website delivered html? i.e determine if asp.net, php, python or java etc. i understand easy way deduce @ response header , see server it's on, if it's using a service cloudflare nginx, i.e. reverse proxy masks server type. also, asp.net know there giveaways aspx extension, if these hidden? also, there dead giveaways other languages? basically, question comes down possible me mask language used in website? please take @ following website: http://builtwith.com/ . can find out website built technology.

PHP Associative Array Duplicate Keys -

i have associative array, when add values using below function seems overwrite same keys. there way have multiple of same keys different values? or there form of array has same format? i want have: 42=>56 42=>86 42=>97 51=>64 51=>52 etc etc code: function array_push_associative(&$arr) { $args = func_get_args(); foreach ($args $arg) { if (is_array($arg)) { foreach ($arg $key => $value) { $arr[$key] = $value; $ret++; } }else{ $arr[$arg] = ""; } } return $ret; } no, cannot have multiple of same key in associative array. you could, however, have unique keys each of corresponding values arrays, , arrays have multiple elements each key. so instead of this... 42=>56 42=>86 42=>97 51=>64 51=>52 ...you have this: array ( 42 => array ( 56, 86, 97 ) 51 => ar

How to iterate XML-formatted string through "foreach" loop in C#? -

i have string in xml format following content: <?xml version="1.0" encoding="windows-1251" ?> <operation> <personoperation> <name>john smith</name> <phone>79161234586</phone> <city>glasgow</city> <date>2014-02-03</date> <operationtype>join</operationtype> <amount>9000.00</amount> </personoperation> <personoperation> <name>bill satly</name> <phone>78263211334</phone> <city>london</city> <date>2014-07-10</date> <operationtype>stock</operationtype> <amount>3000.00</amount> </personoperation> how can iterate string through "foreach" loop in c# , check if value of operationtype node equal "join"? load string xmldocument , use selectnodes() method appropriate xpath query. query iterate: "operation

user interface - How to track a Java app's usage without rewriting its source code? -

i track clicks jbutton s, log page views, see time spent on specific page, etc... ideally, add 1 liner in constructor or along lines of analytics.starttracking() is there such framework this? if not, how go implementing one? i don't know of framework this. can use toolkit.addawteventlistener capture awt events , use information.

javascript - Is it possible to find html attributes with specific start? (not specific value) -

imagine have following button: <button id="id" data-trigger-function = "true", data-value-1="12345", data-value-guid="534-534-657647365-gd">click me function</button> is possible, following in called function: $(this).attr('data-value-'+ * ).each(...); the objective use universal selector in attribute name, , not in attribute value (not this: [name^='something']). objective values of data-value-1 , data-value-guid because both have same start.., means data-value be, data-value-qwerty, data-value-xpto, without having know *. i've searched this, couldn't find this, or mentions this. possible? thank you! (sorry bad english) you attributes , loop through them: $.each(this.attributes, function(index, attr){ var name = attr.name; if(name.startswith('data-value') { var value = attr.value; //you code goes here } });

subset dataframe with topmost values based on a category in r -

this question has answer here: how select row maximum value in each group 7 answers i have data frame this type value cella 2.02 cella 2.56 cellb 1.24 cellb 2.34 cellb 4.56 cellc 3.55 cellc 2.36 cellc 6.78 cellc 3.56 and want subset based on topmost value each type,,, output be type value cella 2.56 cellb 4.56 cellc 6.78 how can achieve in r - unique command can of - bit struck::: suggestions m using dplyr can done top_n library(dplyr) # assume data in data frame df2 df2 %>% group_by(type) %>% top_n(1) you get selecting value source: local data frame [3 x 2] groups: type type value 1 cella 2.56 2 cellb 4.56 3 cellc 6.78

Would you play an iphone game cause it gives you money? -

i have iphone game going released in week. intended give weekly top scorer real money ($100 , wil increase player base increases). play game if wasn't appealing? i.e, if weekly top scorer paid $100. would have pay game? if so, how much? i believe want play game if offered weekly reward $100. (ps, sign me up, what's game's name?)

hash - How to extract salt from sha512 digest? -

i encoded(sha512 hash)the password string "hello" using salt string "world" , saved string in file. hex: 2b83319d3e78544e4430c4f5621968fee8b6ffa1254678b2c6fb98f7f79ff16afee2da909a7bb741488ca3bacbbf6cec8fd226c5a52eef805ea65a352e2ece8e base64: k4mxnt54ve5emmt1yhlo/ui2/6elrniyxvuy9/ef8wr+4tqqmnu3quimo7rlv2zsj9imxauu74beplo1li7ojg== now in program have above encoded value of salted "hello" , fresh password string "hello". have again encode "hello" using same salt , compare output. possible extract salt above output? you cannot retrieve "salt" hash. hash function one-way function cannot reversed (only brute-forced). since you're using sha-512 , output 512-bit long (128 hex-encoded bytes), there no room salt stored. when create hashes using additional data such salt, need either store or use function produces string encodes such additional data output. if you're hashing passwords or other brute-force

c# - MemberExpression actual values -

class sometype { public string value { get; set; } } lets have create function call below notation: var someinstance = new sometype(); dosomethingonexpression(()=>someinstance.value); where method should that void dosomethingonexpression<t>(expression<func<t>> exp) { memberexpression mexp = (memberexpression)exp.body; sometype sometypeinsance = ... //from mexp (1) string sometypevaluestring = ... //from mexp (2) string someintancemembername = (memberexpression)exp.body).member.name; assert.equals(sometypeinstance.value, sometypevaluestring) } any idea how accomplish this? so basically, question is: can extract member value memberexpression (2) , if can extract instance of type owner of instance

html - Inherit height from one div to another -

Image
i want inherit height div content div information, not working, heres code. here's fiddle: http://jsfiddle.net/maximusperson/pssh3jzg/ red same height blue. html: <div class="content"> <div class="information"><p>welcome website,<br>created me</p> </div> </div> css: .content { position: absolute; top: 100 % ; left: 0; width: 100 % ; height: 50 % ; background: white; align-self: center; margin: 0; padding: 0; background-color: blue; } .information { height: inherit; font-size: 24 px; font-family: serif; font-color: black; text-align: center; vertical-align: middle; background-color: red; } when provide height div (here, div.content ) in percent, in relation parent of div, , again, believe parent of content div doesn't have height given @ all. so giving height:inherit on div.information won't work you'd expect,

java - Camel CXF: compressing response with CXFOutInterceptor throws classcast exception -

i have service bundle want compress response using cxf gzipfeature. bundle deployed on jboss fuse(jboss-fuse-6.1.0.redhat-379). camel route configuraion is: <cxf:bus id="cxf" name ="cxf"> <cxf:features> <bean class="org.apache.cxf.transport.common.gzip.gzipfeature"> <property name="threshold"> <value>1</value> </property> </bean> </cxf:features> </cxf:bus> <camel:camelcontext ...> <camel:route id="test-server"> <camel:to uri="cxfbean:servicebeans?bus=#cxf&amp;providers=#providers" /> </camel:route> </camel:camelcontext> but throws classcast exception: java.lang.classcastexception: org.apache.cxf.transport.common.gzip.gzipoutinterceptor$gzipthresholdoutputstream cannot cast org.apache.cxf.io.cachedoutputstream @ org.apache.camel.component.cxf.tra

Ionic: How to override back button function? -

i need override button function both buttons: the icon on top left corner of nav-bar the hardware button (for example in android) but 1 specific view, not globally. how can that? this code android button, while button on navigation bar bit more simple: android button : $ionicplatform.registerbackbuttonaction(function (event) { if($state.current.name=="home"){ alert("button back"); } }, 100); ionic button : you can edit topic , see how have defined menus , views?

r - Unreadable messages on RStudio on Windows -

i using rstudio frontend r. works on gnu/linux (even russian locale , russian messages). hoewever, on windows works worse. problem fonts or charsets of messages. i installed rstudio version 0.99.467 (amd64) , r version 3.2.1 (2015-06-18). i see following prompt @ beginning (no issues that, locale en_us, english language): r version 3.2.1 (2015-06-18) -- "world-famous astronaut" copyright (c) 2015 r foundation statistical computing platform: x86_64-w64-mingw32/x64 (64-bit) r free software , comes absolutely no warranty. welcome redistribute under conditions. type 'license()' or 'licence()' distribution details. r collaborative project many contributors. type 'contributors()' more information , 'citation()' on how cite r or r packages in publications. type 'demo()' demos, 'help()' on-line help, or 'help.start()' html browser interface help. type 'q()' quit r. but when try wrong thing, suppose trying

c# - RSA Public key encryption using modulus and exponent -

i want generate public key using rsa given modulus , exponent values. public static string rsapublic(string toencrypt) { var crypt = asymmetrickeyalgorithmprovider.openalgorithm(asymmetricalgorithmnames.rsapkcs1); var buffer = cryptographicbuffer.convertstringtobinary(toencrypt, binarystringencoding.utf8); string publikkey = modulus + exponent; publikkey.replace("\r\n", ""); var plaintextbytes = system.text.encoding.utf8.getbytes(publikkey); string pk = system.convert.tobase64string(plaintextbytes); ibuffer keybuffer = cryptographicbuffer.decodefrombase64string(pk); cryptographickey key = crypt.importpublickey(keybuffer, cryptographicpublickeyblobtype.x509subjectpublickeyinfo); // throws exception here, have tried using 4 available blobtypes // var key = crypt.createkeypair(512); var sigbuffer = cryptographicengine.encrypt(key, buffer, null); string signature = cryptographicbuffer.encodetobase64string(sigbu

c++ - How to use fftw library in Qt -

this question has answer here: adding external library qt creator project 7 answers i have simple question regarding use of external library in qt, , in particular fftw. working on project in whice need build gui. working qt creator first time , pretty novice porgrammer. i need preform fft in program , have found fftw library useful matter. how can make use of library in qt? know porbably have nothing program , more c++ language , compiling , linking, basicly in dark on subject. i failed find detailed enough answer , can make progress on project without use of library. please help. when want use external library in c/c++ first of have find 1 ore more *.h files should have been shipped library, .h files describe compiler found inside library. have #include correct .h file in code , tell compiler find (in folder). in case should have line @ top of prog

c# - error CS0012: The type 'ConnectionStringSettings' is defined in an assembly that is not referenced after upgrading to Visual Studio 2015 -

i've upgraded visual studio 2013 pro visual studio 2015 (enterprise), , when compile solution, i'm getting following error: error cs0012: type 'connectionstringsettings' defined in assembly not referenced. must add reference assembly 'system.configuration, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'. is there missed during installation process? have manually add reference projects on? update : yes work after adding reference system.configuration projects, question more why need in visual studio 2015 (it used work without reference in visual studio 2013) update : explain context: work in team developers work various versions of visual studio (2012 onwards). if developers work visual studio < 2015 forget manually add reference, won't compilation error, ones on vs2015 will. it's important team understand what's happening here :) i can think of 2 reasons why have add explicit reference system.confi

thrift - Shutdown a TThreadPoolServer in python -

i want know how shutdown tthreadpoolserver properly. right use following python code: try: # other settings transport = tsocket.tserversocket(port=server_port) server = tserver.tthreadpoolserver(processor, transport, tfactory, pfactory) print("starting server...") server.serve() except (systemexit, keyboardinterrupt): transport.close() print("done.!") exit(0) after server started using terminal, press control-c , "done.!" printed on screen, doesn't exit , go command line. can this? if use tsimpleserver , terminated , go command line. don't need .stop() server ?

php - yii framework doesnt use the correct CSS -

i'm working yii framework have installed yii booster extensions , work vagrant. friend works on project, problem application doesn't use correct css. instead, uses css saved in cache. here how is: there folder at: www\svn\wwwroot\public\assets contains folders weird names, 1 of them contains bootstrap css , belonging bootstrap. wrong because art regenerated every-time regenerate vagrant. problem using correct css unless (delete cookie cash) correct css wrong css, other people using wrong css, unless change them manually on assests folder, totally wrong because every time update workstation using svn should apply new lay out other prople doesn't work. here main config: <?php /** * main web application configuration. * * writable cwebapplication properties can configured here. * constructed following way: * main.php = return main settings * unless overwritten local main settings if available * unless overwritten test