Posts

Showing posts from January, 2014

php - Part of code into variable -

how can incorporate code in php in "my code" part? $out.= '<li class="portfolio_item overlayed_animated_highlight portfolio_item_4' . $slugs . '"> <div class="overlayed"> ' . get_the_post_thumbnail() . ' <div class="overlay"> <p> <a href="'.get_permalink().'"><i class="icon-share"></i></a> <a href="'.$thumbnail_src.'" class="fancybox" data-fancybox-group="portfolio"><i class="icon-search"></i></a> </p> </div> </div> /** code **/ <h4><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4> <span>'

c - program to copy its input to output by replacing each backspace by \b -

int main() { int c, d; while ( ( c = getchar() ) != eof ) { d = 0; if (c == '\b') { putchar('\\'); putchar('b'); d = 1; } if (d == 0) putchar(c); } return 0; } but when press backspace \b not being displayed in place of that but when press backspace \b not being displayed in place of that your code compiles fine, backspace won't printed console. unlike other format characters, backspace won't show up. the reason is, mentioned above: getchar() places input buffer, reads, outputs text once press enter. logically, backspace character won't printed result, unlike tabs or spaces. getch() getch() output backspace; not read standard input, , instead returns input without waiting press enter. getch() part of conio.h header file. #include <stdio.h> #include <conio.h> int main() { int c, d; while ((c = _getch()) != e

rest - Groovy RestClient not using correct response handler for Content-Type: application/json? -

i'm using groovy's restclient.java post plain text server, response json i'm having issues figuring out why response being parsed stringreader object instead of jsonslurper object. from understand response body should parsed object based on content type in response header, response header application/json seems it's defaulting , parsing response stringreader object. i'm not sure if i'm defining headers incorrectly or whether need specify own success handler?? have other methods use post method , work fine, posting xml , expecting xml in response think headers work out fine in instance. below how i'm attempting , logs, can see response headers content-type application/json i'm baffled why restclientresponse.getdata() stringreader object instead of jsonslurper object def restclient = new restclient("http://this.doesnt.matter", 'text/plain') restclient.setproxy("someproxy", 8080, "http") restclient.

opengl - Sphere Tessellation wrong coordinates -

Image
i'm trying apply tessellation on gpu simple sphere. tessellation working simple plan, it's not working sphere. of course, know coordinates mapping aren't same, tried many ways it. example, tried use gl_tesscoord (x , y) in tessellation evaluation longitude et latitude mapped plane. convert them spherical coordinates, 'really' didn't work. for tessellation control, i'm splitting patches 2 outer , 2 inner level. here code draw sphere : glbindvertexarray(vertexarrayobject); glpatchparameteri(gl_patch_vertices, 4); glbindbuffer(gl_element_array_buffer, indicesbuffer); gldrawelements(gl_patches, indices.length, gl_unsigned_int, 0); glbindvertexarray(0); here current code in tessellation evaluation : #version 430 layout(quads, fractional_even_spacing, ccw) in; uniform mat4 u_projectionmatrix; uniform mat4 u_viewmatrix; uniform mat4 u_transformmatrix; uniform float u_radius; uniform vec3 u_cameraposition; void main(void){ vec4 positi

angularjs - angular-generator error with lodash -

i trying run angular generator i try run grunt following error running "wiredep:app" (wiredep) task warning: /users/hsolutions/desktop/mobile400/stairs/node_modules/grunt-wiredep/node_modules/wiredep/node_modules/lodash/dist/lodash.js:6619 }); ^ unexpected token } use --force continue. when @ file lodash file cut off. lodash.findlast = findlast; lodash.findlastindex = findlastindex; lodash.findlastkey =

xunit cannot discover tests after upgrading to v2 -

after upgrading xunit2 , following migration guide ( http://xunit.github.io/docs/test-migration.html ), following error when discovering tests in projects: ------ discover test started ------ [xunit.net 00:00:00.0701819] exception discovering tests mylibrary.tests.dll: system.missingmethodexception: constructor on type 'xunit.sdk.testframeworkproxy' not found. @ system.runtimetype.createinstanceimpl(bindingflags bindingattr, binder binder, object[] args, cultureinfo culture, object[] activationattributes, stackcrawlmark& stackmark) @ system.activator.createinstance(type type, bindingflags bindingattr, binder binder, object[] args, cultureinfo culture, object[] activationattributes) @ system.activator.createinstance(string assemblystring, string typename, boolean ignorecase, bindingflags bindingattr, binder binder, object[] args, cultureinfo culture, object[] activationattributes, evidence securityinfo, stackcrawlmark& stackmark) @ system.activator.cre

python - How to access decoded JSON values in .txt file -

i sending json request server , need access time-stamp dynamically changes based on time variable. using requests send post request json .txt file. my json here. able access dateandtime field can use current time send query. json consumed server data2 =jsonpickle.encode(jsonpickle.decode(f2.read()) ) f2 json file. here post request have changed; dateandtime parameter in r2 = requests.post(url2, data=data2, headers=headers2,timeout=(connect_timeout, 10)) { "requestspecificdetail": { "parentsrnumberforlink": "" }, "metadata": { "appversion": "1.34", "devicemodel": "x86_64", "dateandtime": "01/15/2015 12:46:36", "devicetoken": "a2c1dd9d-d17d-4031-ba3e-977c250bfd58", "osversion": "8.1" }, "srdata": { "srnumber": "1-3580171"

angularjs - How to write unit test to Restangular with Jasmine? -

i know how write test methods, other methods? put, patch, delete? this example service method remove user: removeone: function(user) { var deferred; console.log(user); deferred = $q.defer(); if (_.isundefined(user.id) || _.isnan(user.id)) { alertsserv.logerror(err); deferred.reject(err); } else { user.remove().then(function(result) { alertsserv.logsuccess('użytkownik został usunięty'); return deferred.resolve(result); }, function(err) { alertsserv.logerror(err); console.log(err); return deferred.reject(err); }); } return deferred.promise; } it should this: describe('delete /users/1', function() { beforeeach(function() { return $httpbackend.expect('delete', backend_url + '/users/1').respond(200, 'user1'); }); return describe('removeone method', function() { return it('should

Python 3: Multiprocessing API calls with exit condition -

i'm trying write application works through list of database entries, making api call those, return value , if 1 value of apis json response true 5 calls, want have list of 5 calls. database entries couple of thousand entries, want realise multiprocessing . i'm beginner parallelisation , seems can't grasp of how works , how set exit condition. here's got: from multiprocessing.dummy import pool import requests def get_api_response(apikey, result, subscription_id): r = requests.get("https://api.example.com/" + subscription_id) if r.json()['subscribed'] == true: result.append(r.json()) return result def pass_args(args): foo = get_api_response(*args) if foo: return foo def check_response_amount(result): if len(result) >= 5: pool.terminate() # 1 entry looks that: {"id": 1, "name": "smith", "subscription_id": 123} db_entries = get_db_entries() apikey = &

ffi - how can i get query response of prolog in c# -

i using swi prolog c# front end. if put query like: plquery.plcall("assert(father(sam,lia))"); i want to display whether the query executed or not in mmessagebox. need answer in 'true' or 'false' comes in prolog console.

value of a function in JavaScript(protractor) returns as undefined -

im using protractor retrieve text. one of function is //get impersonation id this.getusersessionid = function(){ //get whole text userimpersonatetextelement.gettext().then(function(text) { var temptext = text; var startstring = 'session id '; var sessionid = temptext.substring(temptext.lastindexof(startstring)+startstring.length,temptext.length); console.log('sessionid is:'+sessionid); return sessionid; }); }; and im calling function in js(where imported above js) file var getuserimpersonationid = impersonationsuccesspage.getusersessionid(); and when try console.log('user impersonation id is:'+getuserimpersonationid); i undefined value. but console.log('sessionid is:'+sessionid); in function displays proper value. can suggest im doing wrong here? the internal call text returns promise. go ahead , return promise , can chain then in call getusersessionid. example this.g

c - gcc compile error: unknown type name 'File' -

i learning how use file i/o using c. this code in file, test.c #include <stdio.h> #include <stdlib.h> int main() { file *fp; char *mode = "r"; fp = fopen("testfile", mode); if(fp == null) { fprintf(stderr, "can't open input file testfile\n"); exit(1); } } when compile code using : gcc -o test test.c i error : atria:~/471/a4> gcc -o test test.c test.c: in function ‘main’: test.c:6:5: error: unknown type name ‘file’ file *fp; ^ test.c:10:8: warning: assignment incompatible pointer type [enabled default] fp = fopen("testfile", mode); ^ i thought maybe using wrong header file have included stdio.h does have ideas why i'm getting error? thank in advance that should file , not file .

mysql - How to format date in db with php -

i want change format of date: if (!empty($_post['dob']) && !empty($_post['mob']) && !empty($_post['yob'])) { $yob = mysqli_real_escape_string($con, $_post['yob']); $mob = mysqli_real_escape_string($con, $_post['mob']); $dob = mysqli_real_escape_string($con, $_post['dob']); $date = mysqli_real_escape_string($con, "$yob->$mob->$mob"); $addtothedb = "insert login (dateofbirth) values ('". $date . "')"; $result = mysqli_query($con, $addtothedb); } however data db yyyy-mm-dd whereas have dd-mm-yyyy . you use http://php.net/manual/en/function.date.php function desired format. $result = date('d-m-y', strtotime($birthdate));

Get the latest WHOLE record by date in mongodb -

i have collection objects (records of events) this: {_id: 1, type: "a", val2: "x", val3: "z", date: 1/1} {_id: 2, type: "a", val2: "y", val3: "y", date: 2/1} {_id: 3, type: "c", val2: "z", val3: "x", date: 3/1} {_id: 4, type: "b", val2: "x", val3: "z", date: 4/1} {_id: 5, type: "c", val2: "y", val3: "y", date: 5/1} {_id: 6, type: "b", val2: "z", val3: "x", date: 6/1} i fetch complete object latest date each type, in example above should return records ids: 2, 5, 6 i'm doing pipeline query this: db.items.aggregate( [ { $group: { _id: "$type", lastdate: { $last: "$date" } } } ] ) but returns me documents this: { _id: 2, lastdate: 2/1} whereas want entire object (with val2, val3, etc) how can accomplish t

Finding people with similar parameter around you android app -

so i'm working on android app class project matches users use app other users in vicinity have similar interest inside app well. basic idea is, persona open app , there dropdown box can select 1/10 interests options in list. personb, has opened app , specified specific interest dropdown before can click button says "find person near me within 100feet interest selected". if persona within 100feet of personb them both matching interest selected, persona returned screen are. how go doing solution in android? there library/class or api this? i'm new android, i'm not sure how approach this. i've been looking through many forums , stackoverflow questions, can't seem find way implement or start go creating solution. appreciated! :)

facebook - Yet another PHP Parse error: syntax error, unexpected 'use' (T_USE) -

i lost evening on , feel need other check this, i'm blind. define('facebook_sdk_v4_src_dir', '/var/www/rateanything/facebook-sdk/src/facebook'); require('/var/www/rateanything/facebook-sdk/autoload.php'); use facebook; facebooksession::setdefaultapplication('my_app_id', 'my_app_secret'); $session = new facebooksession($fbtoken); $request = new facebookrequest($session,'get','/me?fields=email,name,gender'); why not duplicate: because question has not error. i'm getting parse error. i'm using php 5.4. is code wrapped inside function? use keyword can applied on outermost scope of file. basically, move use facebook; top of file. alternatively, reference namespace in facebooksession , facebookrequest defined. so: define('facebook_sdk_v4_src_dir', '/var/www/rateanything/facebook-sdk/src/facebook'); require('/var/www/rateanything/facebook-sdk/autoload.php'); facebook\faceboo

Can't run Roboletric on windows: java.lang.NoSuchMethodException: android.os.Looper.<init>(boolean) -

i want add support unit tests on existing android studio 1.1 project. followed this tutorial getting error: java.lang.runtimeexception: java.lang.runtimeexception: java.lang.nosuchmethodexception: android.os.looper.<init>(boolean) @ org.robolectric.robolectrictestrunner$2.evaluate(robolectrictestrunner.java:228) @ org.junit.runners.parentrunner.runleaf(parentrunner.java:325) @ ... i found this solution applies mac, , can't find similar way in windows. i found out. in maven settings.xml added (as specified in maven site ): <localrepository>${user.home}/.m2/repository</localrepository> after remove it, roboletric worked fine.

cmd - Windows delete with wildcards deleting erratically -

this driving me crazy. basically, have program outputs tables flat file multiple databases same structure. these files named in format tablename_####.dat , #### 4 digit company number. after these created, program combines of files tablename, , adds timestamp on end. so, final file name in format tablename_yyyymmdd_hhmmss.dat . finally, want delete of individual .dat files, leaving combined, time stamped files. this works fine of tables, except table vex. example, have files: vex_1234.dat vex_5678.dat vex_0987.dat which combine form vex_20150414_144352.dat . after this, run command: `del *_????.dat` this deletes of tables' individual files ( v_1234.dat , pat_9534.dat , etc.), while leaving combined files ( v_20150414_142311.dat , pat_20150413_132113.dat ) ...except vex. deletes both individual files , combined file. shouldn't delete files end underscore, 4 characters, , ".dat"? i know has simple i'm missing. going on? most issue

ruby on rails - foundation installation and turbolinks -

i installed foundation in rails 4 app. foundation overrwites layout file. it replaces: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> to just: <%= stylesheet_link_tag "application" %> is there sort of incompatibility or should append turbolinks tracking directive? there no incompatibility. i've used turbolinks foundation without issues on several projects. at rate, wouldn't think foundation affect turbolinks, it's html/css/jquery framework. understand, turbolinks works preloading data links on page if click one, page loads quicker.

php - Comparing dates with Query Builder -

i trying add parameter addwhere in query builder make retrieve date similar today's date (matching month , day). dates stored in database looks 1895-04-14 00:00:00 , if today 14-04 regardless year give me record. here's i've got far. ->select('r') ->where('r.status = :status') ->setparameter(':status', 1) ->andwhere('r.dateofdeath = :now') ->setparameter('now',\date("m-d", time())) ->getquery(); return $qb->getarrayresult(); how can entries database matching today's day , month? since querybuilder should accept native sql-code: ->andwhere('r.dateofdeath >= now()') should work... or ->setparameter('now', (new \datetime()->format('y-m-d h:i:s'))) if using php 5.4 or higher should work

c# - How to specify foreign key property for one to zero..one relation using fluent api in Entity Framework -

i have table user , table company . user can have 0 or 1 company registered. user (1)---> (0..1) company my user class: public class user { public string id {get; set; } public string firstname { get; set; } public string lastname { get; set; } public string fullname { { return firstname + " " + lastname; } } //relations public virtual company company { get; set; } } and company class is: public class company { public int id { get; set; } public string companyname { get; set; } public string taxnumber { get; set; } public string taxoffice { get; set; } public string officetel { get; set; } public string faxnumber { get; set; } public string website { get; set; } public string address { get; set; } public string { get; set; } //keys public int cityid { get; set; } public int stateid { get; set; } public string userid { get; set; } //re

Converting arrays to string in PHP -

i trying add values comes off database using method count ; method works , using array give me proper count. trying add values code blocks coming up: $value1 = mysqli_query($con,"select count(column) table"); $value1print = mysqli_fetch_array($value1); $value2=mysqli_query($con,"select count(column) table"); $value2print= mysqli_fetch_array($value2); i print value these arrays using code block: echo $value1[0]; echo $value2[0]; now i'm trying add values value1 & value2 , i've tried following functions: implode : $arraytostring=implode($value1); this method returns data in manner: if value1 1 , , value2 2 , returns 11 , 22 , when added, return 33 . wrong because obviously, need 3 . serialize : $arraytostring=serialized($value1); my count method returns number of rows or data database has, ie: 1 or 2 .. etc. etc.; want values add up, ie: if value1 1 , value2 2 , 1+2 , come result, in example, 3 . the below shou

javascript - In jQuery how to select all other parent li of not clicked anchor? -

i have following simple nav links , want make sure when click on of links, "active" class removed other li except 1 clicked. in jquery how can setup selector achieve this? <ul class="nav"> <li><a href="#">link 1</a></li> <li class="active"><a href="#">link 2</a></li> <li class="active"><a href="#">link 3</a></li> <li><a href="#">link 4</a></li> </ul> this take on this... $(function() { $('.nav li a').on('click', function() { $('.nav li').removeclass('active'); // remove active class $(this).closest('li').addclass('active'); // add active classs element clicked }); }); .active { color: red; border: 1px solid green; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jq

java - Unable to run Code Coverage since update 14.1.1 in IntelliJ -

since update intellij 14.1.1 , unable run code coverage. i can run test without problem, code coverage button gives me error : fatal error in native method: processing of -javaagent failed java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:483) @ sun.instrument.instrumentationimpl.loadclassandstartagent(instrumentationimpl.java:386) @ sun.instrument.instrumentationimpl.loadclassandcallpremain(instrumentationimpl.java:401) caused by: java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmet

c++ - Correctly forward to specializations for dynamically allocated arrays -

i learned can specialize dynamically allocated arrays t[] : template<typename t> class c {}; template<typename t> class c<t[]> {}; now while trying use such machinery, seem have trouble composing feature (using in inner layer, eg inside function template) : #include <iostream> template<class _ty> struct op { void operator()(_ty *_ptr) const noexcept { std::cout << "single pointer\n"; delete _ptr; } }; template<class _ty> struct op<_ty[]> { void operator()(_ty *_ptr) const noexcept { std::cout << "dynamically allocated array\n"; delete[] _ptr; } }; template<typename t> void f1(t *arg) { op<t>()(arg); } int main() { f1(new int(3)); f1(new int[(3)]); } the above prints single pointer single pointer when it's clear second call done array. how can fix this, doing wrong ? both c

python - How to speed up complex/difficult data filtering in pandas -

i have large data set has below indices , column headers. +------+------------------------+------------------------------+--------------------------+------------------------------------+-------------------------------------+------------------------+--------------------------+--------------------------------+----------------------------+--------------------------------------+---------------------------------------+--------------------------+ | | count: interaction_eis | count: interaction_eis_reply | count: interaction_match | count: interaction_single_message_ | count: interaction_single_message_1 | count: interaction_yes | dc(uid): interaction_eis | dc(uid): interaction_eis_reply | dc(uid): interaction_match | dc(uid): interaction_single_message_ | dc(uid): interaction_single_message_1 | dc(uid): interaction_yes | +------+------------------------+------------------------------+--------------------------+------------------------------------+----------------------------------

Edting collection of items is slow in Sitecore -

i've implemented on item:saved handler per question posted here: run code when publishing restriction saved in sitecore when author changes publishing restrictions on page, iterate through each of related components page, updating publishing restrictions on each match page item. works, pages have 150 or components , process of editing each taking ever. result ui hangs 5 minutes while runs. not good. i'm doing this: compitem.editing.beginedit(); compitem.publishing.validfrom = pageitem.publishing.validfrom; compitem.publishing.validto = pageitem.publishing.validto; compitem.editing.endedit(true, true); i've played around updatestatistics , silent arguments. if "silent" ui responds, of course still takes forever update run in background cause issues, since there window of time pub restrictions between page , components out of sync. any thoughts on why updating 150 items slow? ways speed up? here's full code: public void onitemsaved(object sende

c - java processbuilder open a text file for reading data -

i have file lets "test.txt", (same directory java program) has numbers on seen below. aim start process builder reads data file i'm going paint java jpanel. i understand read data text file, need read input stream. question 1: how can read line line? after first line has read, process builder goes next? i'm puzzled on how start process this. i.e q2: how can open text file using processbuilder? for second question i've tried this. nothing happens on screen haven't instructed happen, on right track? //get data public void returndata () { try { processbuilder pb; pb = new processbuilder("test.txt"); process runcode = pb.start(); runcode.waitfor(); } catch (ioexception | interruptedexception exp) { system.out.println(exp); } } test.txt 0 1 3 5 2 3 you need program sends file standard out such windows: type filename for unix cat filename then execute command using

r - how to send different commands to multiple hosts to run programs in Linux -

i r user. run programs on multiple computers of campus. example, need run 10 different programs. need open putty 10 times log 10 different computers. , submit each of programs each of 10 computers (their os linux). there way log in 10 different computers , send them command @ same time? use following command submit program nohup rscript l_1_cc.r > l_1_sh.txt nohup rscript l_2_cc.r > l_2_sh.txt nohup rscript l_3_cc.r > l_3_sh.txt first set ssh can login without entering password (google if don't know how). write script ssh each remote host run command. below example. #!/bin/bash host_list="host1 host2 host3 host4 host5 host6 host7 host8 host9 host10" h in $host_list case $h in host1) ssh $h nohup rscript l_1_cc.r > l_1_sh.txt ;; host2) ssh $h nohup rscript l_2_cc.r > l_2_sh.txt ;; esac done this simplistic example. can better (for example, can put ".r&quo

python - printing certain positions from a matrix -

if matrix [[1,2,3,4],[5,3,6,2],[7,7,7,2],[9,7,5,3]] and want print positions of second row output this: [1][0] [1][1] [1][2] [1][3] i think need use for loop not sure how. thnx python provide built-ins every purpose. use enumerate function , string formatting: for i, j in enumerate(matrix[1]): print '[1][{}] contains {}'.format(i, j)

php - Make Trait protected attributes accessible to Eloquent in Laravel 4.2 -

i'm new using traits , having trouble saving protected attributes of trait within eloquent model: here route model: namespace app\models; use eloquent; class route extends eloquent { use cardtrait { cardtrait::__construct __cardconstruct; } public $timestamps = false; protected $table = 'routes'; protected $primarykey = 'id'; protected $visible = [ 'name', 'description' ]; public function __construct(array $attributes = array()) { $this->__cardconstruct($attributes); } //relationships follow } and here cardtrait trait: namespace app\models; trait cardtrait { protected $timesasked; protected $factor; protected $nexttime; public function __construct($attributes = array(), $timesasked = 0, $factor = 2.5, $nexttime = null) { parent::__construct($attributes); if (is_null($nexttime)) $nexttime = \carbon::now()->todatetim

php - Laravel: inserting arrays to a table -

i got code can store result( present,late,absent,others ) each student. here's view <div align="center"><b>list of students enrolled</b></div> <table class="table table-striped table-bordered"> <thead> <tr> <th>student id</th> <th>student name</th> <th>present</th> <th>late</th> <th>absent</th> <th>others</th> <th>comments</th> </tr> </thead> <tbody> @foreach ($users $users) <tr> <td>{{ $users->student_id }} </td> <td>{{ $users->student_firstname }} {{ $users->student_lastname }}</td> <td>{{ form::radio('student['.$users->student_id.'][status]', 'present' , true) }}</td> <td>{{ form::radio('student['.$users->student_id.&

google spreadsheet - Transposing Items with Prices to Separate Section -

Image
in google sheets i'm trying to transpose list of items , prices (displayed in rows) automatically display in adjacent section columns. problem need include items have prices. here's demo image of i'm trying do. intended result: i have list of items prices in "plan" section items , prices listed. i need transpose data rows items have price , display items , corresponding prices in "details" section. here's mock-up of have working: current version: the problem it's listing items whether have price or not . listing items , prices in unrelated columns. currently using named ranges category1_items , category2_items , price_1 , price_2 in following formulas: =arrayformula(split(join("~~~",category1_items,category2_items,),"~~~")) =arrayformula(split(join("~~~",price_1,price_2,),"~~~")) i know not close need, it's close have been able far i'm of newbie sheets. i'd achieve wi

Octopus Deploy: Set deployment limitation between multiple environments -

i have multiple environments on octopus deploy , working fine. want add 1 limitation cannot find way how solve this. example have cd, qa , staging environments. tfs deployed cd environment automatically. cd qa deployed manually via octopus, , qa staging. now want set limitation on octopus nobody can promote directly cd staging. want cd environment promote cd qa! help? lifecycles in octopus 2.6 designed solve exact problem.

css - How can I expand a container using :target? -

i wondering it possible use nested ":target" directive modify elements on page pure css. bringing in form text area absolutely positioned inside div element (.container). when text area appears, want 3 things: 1) open link dissapear 2) close link appear 3) contaner div expand form element i have been trying nesting :target element inside .container not working. possible? <div class="container" id="container"> <h4><a href="#comments" id="open">show</a>&nbsp;&nbsp;<a href="#" id="close">close</a></h4> <div id="comments"> <form name="myform"> <p>write comment:<br /> <textarea name="mytextarea"></textarea></p> </form> </div> </div> css .container{ position:relative; background:pink; &:target { transition: 1s ease; a#open { display: none;

How could I pass in commands into a terminal that is already running in java (linux) -

i have been researching how run terminal command in java. doing make program can use ssh pc (just project). how keep continuing putting commands in terminal? if run message put in password , if print out messages terminal spits out @ : while((line = in.readline()) != null){ system.out.println(line + "\n"); } line, few seconds after program stop working. have gui button , if press button run code. me fix issue of stopping , give me information on how continue put commands terminal? thanks. process p = null; string[] command = {"/bin/sh", "-c", "ssh 192.168.2.100"}; processbuilder pb = new processbuilder(command); string line = null; try { term = pb.start(); } catch (ioexception e1) { // todo auto-generated catch block e1.printstacktrace(); } inputstream = p.getinputstream(); bufferedreader in = new bufferedreader(new inputstreamreader(is)); try { while((line

odata - Populating IEnumerable<MyType> using Linq gives error "The specified type member is not supported in LINQ to Entities." -

i have model in fields directly mapped database table , expose through odata (v4). created 1 unmapped property ienumerable , map runtime in webapiconfig. model looks this public class myclass { public int id {get;set;} public string name {get;set;} [notmapped] [foreignkey("mytype")] public virtual ienumerable<mytype> mycollection { { return context.mycollection.asqueryable(); } set { ;} } } now when run , try results url http://localhost/odataservice/myclass(1) ?$expand=mycollection, gives me error saying "message": "the specified type member 'test' not supported in linq entities. initializers, entity members, , entity navigation properties supported. can point out how populate ienumerable runtime using linq? thanks. the error saying type doesn't map db entity. guess mytype c# type no db equivalent (seems said in question). ienumerable<mytype> fine when use it, needs in context of linq objects no

encryption - C RC4 super weird behavior -

so found implementation of rc4 in pure c, using on website. working super except when input 6 characters string. internal error page. figured out length causes problem. 1.crypt.c unsigned char s[256]; unsigned int i, j; void swap(unsigned char *s, unsigned int i, unsigned int j) { unsigned char temp = s[i]; s[i] = s[j]; s[j] = temp; } /* ksa */ void rc4_init(unsigned char *key, unsigned int key_length) { (i = 0; < 256; i++) s[i] = i; (i = j = 0; < 256; i++) { j = (j + key[i % key_length] + s[i]) & 255; swap(s, i, j); } = j = 0; } /* prga */ unsigned char rc4_output() { = (i + 1) & 255; j = (j + s[i]) & 255; swap(s, i, j); return s[(s[i] + s[j]) & 255]; } char *rc4_e(char *text, size_t text_length) { char *dup=(char *)malloc(text_length * sizeof(char)); strcpy(dup,text); unsigned char *vector[2] = {"key", dup}; int y; rc4_init(vector[0], strlen((char*)vector[0])); char *out=(char *)malloc(text_length * sizeof(char) ); c

php - How to authenticate users and securely serve videos for them to watch? -

i trying prevent unauthorize users being able view video on company internal website using laravel 4.2. the videos stored outside document root. therefore, need way serve videos users. i have route handles request follows: route::get('video/{name}', function($name){ $type = explode('.', $name)[1]; header("content-type: video/$type"); $file = "c:\\xampp5-4\\intranet\public\\$name"; readfile($file);//i tried return response::download($pathtofile); video download, not play die();//$this simple example of many things i've tried })->before('auth'); it works in pure php, reason not working in laravel.

loops - Expected ')' before ';' token C -

i'm trying make program prints out ^2, ^4, , ^(1/3) of numbers between 0 , 100. have. #include <stdio.h> #include <math.h> main(){ int a, b, c, i; (i=0; i<100; i=i+2;) = (1*1); b = (i*i*i*i); c = pow(i, (1/3)); printf("%d, %d, %d", a, b, c); return 0; } it's giving me error on line 6 says error: expected ')' before ';' token. this first day c i'm stymied right now. the following code shows suggested corrections posted code. inserted comments explain changes #include <stdio.h> // printf #include <math.h> // pow int main() // <-- use valid return type { int a; // value ^2 int b; // value ^4 double c; // value ^1/3 note: pow() returns double int i; // loop index // following loop calculates request values // 0 through 98. did want include '100'? (i=0; i<100; i+=2) // < corrected statement {

html - Have a link inside a div NOT have two hover states -

Image
i'm trying achieve 1 hover state, keep getting 2 because link inside div button! correct unhovered state - incorrect hovered state - correct hovered state - html - <li> <div id="checkoutbutton"> <p><a href="somegoogle.com">print pages</a></p> </div> </li> css- #checkoutbutton { width: 137px; height: 40px; background-color: #ffffff; moz-border-radius: 15px; -webkit-border-radius: 15px; border: 1px solid #f49131; padding: 5px; color: #f49131; } #checkoutbutton:hover { background-color: #f46800; color:white; } #checkoutbutton { color: #f49131; vertical-align: middle; } #checkoutbutton { width: 137px; height: 40px; background-color: #ffffff; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px; border: 1px solid #f49131; padding: 5px; color: #f49131; text-align:center; curs

regex - Using grep to find keywords, and then list the following characters until the next ; character -

i have long list of chemical conditions in following form: 0.2m sodium acetate; 0.3m ammonium thiosulfate; the molarities can listed in various ways: x.xm, x.x m, x m where number of x digits vary. want 2 things, select numbers using grep, , list following characters until ; . if select 0.2m in example above, want able list sodium acetate . for selecting, have tried following: grep '[0-9]*.[0-9]*[[:space:]]*m' file so there arbitrary number of digits , spaces, ends m . problem is, selects following: 0.05mrbcl+mgcl2; i not quite sure why selected. ideally, want 0.05m selected, , list rbcl+mgcl2 . how can achieve this? (the system os x yosemite) it matches because: [0-9]* matches 0 . matches character (this . in case, meant escape it) [0-9]* matches 05 [[:space:]]* matches empty string between 05 , m m matches m as how want: think if don't want numbers printed output, require either lookbehind assertion or ability print specif

How to check the type of method parameter when use reflection in java -

i have method that: public void get(date date) and use reflection, , want check type of parameter, make sure whether type of java.util.date, that: class<?> parameterstype = method.getparametertypes(); // check if (parameterstype[].equals(java.util.date.class)) { // } i want know, there other way? if want know if method has single parameter of type date can do class<?>[] parameters = method.getparametertypes(); if (parameters.length == 1 && parameters[0] == date.class)) { // } if might better do if (parameters.length == 1 && parameters[0].isassignablefrom(date.class)) because find out if method has single parameter accept date . example, parameter of type object , cloneable or comparable<?> , still pass date .

xml - IMPORTXML: is this xpath_query correct? -

i'd know if following formula correct? =importxml(" http://publications.elia.be/publications/publications/imbalancenrvprice.v1.svc/getimbalancenrvprices?day=2014-04-14 ","//pneg") it gives error #n/a googling teaches me importxml fickle thing. should import list of 24 values, starting 57.48 , since error want sure problem caused function , not xpath_query being wrong, because first time tried this. this works: =transpose(regexextract(importdata("http://publications.elia.be/publications/publications/imbalancenrvprice.v1.svc/getimbalancenrvprices?day=2014-04-14"),rept("<pneg>(.*)<\/pneg>.*",96)))

When config vpn point to site of azure, how to get url of vpn client package -

i configed vpn point sit client azure virtual network no have 2 versions 64bit , 32bit vpn client package the question how url of file downloading thanks everyone, quyen pham i don't think can without using api. when click download portal dynamically generate new file 1d expiration date. anyway, need download package, same everyone, , distribute file , proper certificate users.

java - Trying to use Android internal storage for a high score array. -

using link http://developer.android.com/guide/topics/data/data-storage.html#filesinternal i trying build high scores array app game. want store internally. have started , i'm getting errors can't figure out. wanted test make sure create file. using eclipse java code , andengine. please help!! my errors are: method openfileoutput(string, int) undefined type gamescene syntax error on token "write", identifier expected after token package com.example.game; import java.io.fileoutputstream; import java.util.timer; import org.andengine.engine.camera.camera; import org.andengine.engine.camera.hud.hud; import org.andengine.engine.handler.timer.itimercallback; import org.andengine.engine.handler.timer.timerhandler; import org.andengine.entity.entity; import org.andengine.entity.ientity; import org.andengine.entity.modifier.delaymodifier; import org.andengine.entity.primitive.rectangle; import org.andengine.entity.scene.ionscenetouchlistener; impo