Posts

Showing posts from August, 2015

javascript - How to access element(s) and Remove a spefiic Class rooted within the DOM? -

Image
stackoverflow new me , first post :] could please advise best way create jquery code following objective? objective: need way remove class 'active' nav element when active: i have attempted create jquery code locate nav element contains class 'active' in turn remove given class selected nav element. please refer following image: thanks help! sorry poor post formatting welcome! $('#btndiv').toggleclass('active'); should fit needs. $( "#datatable tbody tr" ).on( "click", function() { // handler }); create handler on click event here.

python 3.x - Conditional statement with empty string -

why '' , not '123' evaluate '' instead of false , not '123' , '' evaluates false in python 3.4.3? the logical and/or operators stop evaluating terms (short-circuit) answer decided. examples and >>> '' , not '123' '' the first 1 false, and short-circuited , first 1 returned. >>> not '123' , '' false not '123' returns false . since false, and short-circuited , result of not '123' 1 returned. for same reason, following returns zero: >>> 0 , '123' 0 and following returns [] : >>> [] , '123' [] examples or >>> '' or '123' '123' >>> not '123' or 'hi' 'hi' >>> '123' or 'hi' '123' documentation this behavior specified in the documentation where: x or y defined if x false, y, else x x , y defined i

php - Why are single quotes in my $_POST associative array -

am writing code form , use php associative arrays users input. using code this: <input type="text" name="field['username']" id="username" class="editor" /> but when use foreach statement loop through array elements: foreach ($arrinputs $key => $input){ echo $key.'<br/>'; } it includes single quotes in associative array's index , like: 'username' (with quotes) when echoing $key in foreach loop..i don't need single quotes help? you need remove quotes form element, should be: <input type="text" name="field[username]" id="username" class="editor" />

Unable to show a hidden form in Visual C++ -

hey guys hoping shed insight why i'm unable toggle between showing , hiding form. quizmenu.h i've been working on simple quiz game application proceeds through series of questions in form, of well, forms! there main menu user can exit application: private: system::void exit_click(system::object^ sender, system::eventargs^ e) { //exits application quizmenu::close(); } or proceed first question hide main menu , open question1 form: private: system::void enter_click(system::object^ sender, system::eventargs^ e) { question1 ^question1 = gcnew question1(); question1->show(); this->hide(); } question1.h question1 prompts user answer question choosing between 2 possible answers through buttons. correct.h correct answer hides current form , opens indicates answer correct: private: system::void answer1_click(system::object^ sender, system::eventargs^ e) { correct ^correct = gcnew correct(); correc

bitbucket - Can I pre-check bit-bucket pull-requests for code style? -

lately i've been getting number of pull requests projects don't meet code style guidelines (bad formatting, missing documentation, etc). is there way in bitbucket enforce new pull-request must pass validation script or code-style enforcer or that? i not find related in atlassian docs. you trigger build on pull request (which done automatically when pull request raised). build configured checks referred to. if there wrong code under pull request, build fails! you configure bitbucket pull requests 'merge-able' when build succeeds.

ruby on rails - Error on migration: SQLite3::SQLException: no such table: main.users -

i'm still pretty new rails world. i've been working on skill @ time thought i'd give omni-auth twitter crack. i've been reading through tutorial on sitepoint: rails authentication oauth 2.0 , omniauth i'm find until point has me create user model , modify migration file before running rake db:migrate . here's migration file based on instructions: class createusers < activerecord::migration def change create_table :users |t| t.string :provider, null: false t.string :uid, null: false t.string :name t.string :location t.string :image_url t.string :url add_index :users, :providers add_index :users, :uid add_index :users, [:provider, :uid], unique: true t.timestamps null: false end end end but when run rake db:migrate throws error: sqlite3::sqlexception: no such table: main.users: create index "index_users_on_providers" on "users" ("providers")/us

ios - How to change app's NSProcessInfo environment dictionary from a unit test? -

i have following code in app. behaviour can altered setting "my_key" key in environment dictionary of process information. func mymethod() { var environment = nsprocessinfo.processinfo().environment if environment["my_key"] { /* /* } } i test in unit test. problem changing environment dictionary in unit test no affect dictionary in app. class myapptests: xctestcase { func testme() { var environment = nsprocessinfo.processinfo().environment environment["my_key"] = "my value" mymethod() // app's environment not change } end is possible change environment dictionary of app unit test? the environment provided nsprocessinfo read-only. can set environment variable using setenv c function (works fine swift), this: setenv("my_key", "my value", 1)

swift - How would I display HealthKit Data in my iOS app? -

i messing around healthkit , want make simple app read number of activecaloriesburned healthkit , print onto viewcontroller. unsure if accessing data in healthmanager class, , unsure how call healthkit data print in viewcontroller. i know have create class verify user allows app access healthkit data. first created class called healthmanager tackle first problem of verification, sure works properly: class healthmanager { let storage = hkhealthstore() init() { checkauthorization() } func checkauthorization() -> bool { var isenabled = true if hkhealthstore.ishealthdataavailable() { // explicitly requests calorie data let calories = nsset(object: hkquantitytype.quantitytypeforidentifier(hkquantitytypeidentifieractiveenergyburned)!) // requests authorization calorie data storage.requestauthorizationtosharetypes(nil, readtypes: calories as? set<hkobjecttype>) { (success, error)

apache - htaccess RewriteRule and Redirect 301 don't work -

we're trying set 301 redirects make sure google uses right category pages. can't set canonical , normal redirect 301 /n.html https://website.com/n.html doesn't work either, it's ignored. we're on opencart 1.5.5.1. issue 301s ignored, they're not implemented @ both redirect 301 , rewriterule # seo url settings rewriteengine on rewriterule ^/refrigeration/multidecks/fresh-meat-multidecks$ https://www.website.co.uk/multidecks/fresh-meat-multidecks [r=301,l] rewriterule ^/fresh-meat-multidecks$ https://www.website.co.uk/multidecks/fresh-meat-multidecks/ [r=301,l] like anubhava said, issue / after ^

mysql - Optimal Way to Setup Table Structure -

i designing new mysql backend system , faced issue , unsure of optimal way setup table. let's have table called cities . each city has relation table weather contains weather information every month. simple let's structure of cities table is: --------------- | id | name | --------------- | 1 | city1 | | 2 | city2 | | 3 | city2 | --------------- for weather, have approximately 50 fields. each month of year have high temp, low temp, avg temp, avg precipitation. having table 50 columns seems inefficient , seems difficult add new fields. other option can consider have table following setup: ---------------------------------------------------- | id | cityid | type | value | unit | month | ---------------------------------------------------- | 1 | 1 | high_temp | 50 | f | 1 | | 2 | 1 | low_temp | 35 | f | 1 | | 3 | 1 | avg_temp | 45 | f | 1 | | 4 | 1 | avg_prec | 10 | in | 1 | | 5 |

python - why am i getting “inconsistent use of tabs and spaces in indentation”? -

this code: x = []; y = []; xx = [] xy = [] # variable show if file openening worked opened = 0; # try open file try: readfile = open('xydata.txt', 'r'); # if open file worked opened = 1; except: # if opening file went wrong print('some error occured!'); #next line same if opened == 1 if opened: # read in data file line line line in readfile: # variable line holds 1 of lines # in data file # split in string 'line' based on whitespace splitup = line.split(); # x = splitup[0], y = splitup[1] # append arrays x , y x.append(splitup[0]); y.append(splitup[1]); xx.append(splitup[0]*splitup[0]); xy.append(splitup[0]*splitup[1]); # close file readfile.close(); print('done') there more @ point get: run lobf.py file "/users/paulbebb/desktop/pyscripts/lobf.py", line 56 x.append(splitup[0]);

android - How to set Custom Font for a TextView in RecyclerView? -

i using recyclerview populate data cloud. looks like, setting custom font textview not easy inside view. traditional way, tried : textview tx = (textview)findviewbyid(r.id.person_age); typeface custom_font = typeface.createfromasset(getassets(), "fonts/dancing script.ttf"); tx.settypeface(custom_font); but here , crashes app, looking fix, here code main activiy: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); parse.initialize(this, "app-id", "clientkey"); setcontentview(r.layout.activity_big_board); initializedata(); textview tx = (textview)findviewbyid(r.id.person_age); typeface custom_font = typeface.createfromasset(getassets(), "fonts/dancing script.ttf"); tx.settypeface(custom_font); adapter = new rvadapter(persons); rv=(recyclerview)findviewbyid(r.id.rv); linearlayoutmanager llm = new linearlayoutmanager(this); rv.setlayoutmana

logging - How to log operations in Couchbase? -

i want log every operation in couchbase, e.g: create data delete data update data who did , when if it's possible does couchbase provide function that? i dont believe couchbase offers sort of service @ moment. can have @ logs page ( couchbase logs ) said dont think it's need. perhaps better way go here write own frontend couchbase logs want.

python - Manipulating lists in objects, which again stand in a list -

Image
this question has answer here: “least astonishment” , mutable default argument 30 answers im new @ learning python (first programming language learned @ university c) , want write little card-game step step practice. more it's texas holdem poker game. i wrote class cplayer relevant attributes. class cplayer(object): def __init__ (self, id=0, name='', hand=[], credit=1000): self.id=id self.name=name self.hand=hand self.credit=credit then made list of playing cards, , shuffled it. deck=[] in range(0,4): j in range(0,13): deck.append([value[j], suit[i]]) shuffle(deck) further have list, filled 6 cplayer via for-loop. list_of_players=[] in range(players): x=cplayer() x.id=i+1 x.name=i+1 j in range(2): x.hand.append([0,0]) list_of_players.append(x) in first step, wa

DETACH DELETE Neo4j 2.3.x/Cypher -

what behaviour , purpose of new cypher operator detach delete added in neo4j 2.3.x? if want delete nodes, need delete relationships well. in previous versions need do: match (n) optional match (n)-[r]-() delete n, r now can say: match (n) detach delete n

linux - How to find rows in a file with same values for specific columns using unix commands? -

i have file large number of rows. each row contains 5 columns delimited tabs. want find rows have same value first 4 columns have different values 5th column. name age address phone city eric 5 add1 1234 city1 jerry 5 add1 1234 city2 eric 5 add1 1234 city3 eric 5 add1 1234 city4 jax 5 add1 1234 city5 jax 5 add1 1234 city6 niko 5 add1 1234 city7 the result table should be eric 5 add1 1234 city1 eric 5 add1 1234 city3 eric 5 add1 1234 city4 jax 5 add1 1234 city5 jax 5 add1 1234 city6 i tried using uniq -u -f4 after sort ignores first 4 fields in case return rows. i inclined use awk this. script.awk { x = count[$1,$2,$3,$4]++; line[$1,$2,$3,$4,x] = $0 } end { (key in count) { kc = count[key]

android - Facebook Login from Nested Fragment not working - Activity result fragment index out of range -

my app structure follows mainactivity(a viewpager contains 2 fragments - fragment 1 , fragment 2) | |--fragment 1 | (viewpager several fragments | app tutorial/intro) | |--fragment 2 (single fragment have custom facebook login button) at first, onactivityresult nested fragment not getting called. found solution using following code @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); log.d(tag, "onactivityresult"); list<fragment> frags = getsupportfragmentmanager().getfragments(); if (frags != null) { (fragment f : frags) { if (f != null) handleresult(f, requestcode, resultcode, data); } } } private void handleresult(fragment frag, int requestcode, int resultcode, intent data) { if (frag instanceof loginfragment) { // custom interface no signitures frag.onacti

How to draw a polygon around NA values in R? -

Image
i'm trying draw error region around data using base graphics. i've figured out how polygon, starts act badly if there na values in data. dat <- rnorm(10, mean = 1:10) depth <- 11:20 sd <- rnorm(10, mean = 1.5, sd = 0.5) col <- "blue" alpha <- .2 col <- adjustcolor(col, alpha.f = alpha) par(mfrow = c(1,2)) plot(dat, depth, type = "o", main = "no nas in dat or depth") x <- c(dat - sd, rev(dat + sd)) y <- c(depth, rev(depth)) polygon(x = x, y = y, col = col, border = na) dat[7] <- na plot(dat, depth, type = "o", main = "nas in dat or depth") x <- c(dat - sd, rev(dat + sd)) y <- c(depth, rev(depth)) polygon(x = x, y = y, col = col, border = na) this gives me following image: it seems na value divides lower polygon 2 polygons. i'd keep 1 polygon. here's possible solution using rle function: set.seed(123) # added reproducibility dat <- rnorm(10, mean = 1:10) depth &

c++ - Regarding ifstream: error ‘std::ios_base::ios_base(const std::ios_base&)’ is private -

i getting error in title, when try following. class test { private: std::ifstream file; public: test(); }; test::test() {} i know there many threads on stack issue. know can resolve issue simple as std::ifstream *file; the reason have posted question because instructor has told me should able without modifying first code block posted. i've researched this, , haven't found suggests can. ideas? as requested. class test { private: std::ifstream file; public: test(); }; test::test() {} int main() { test test = test(); return 0; } that example of can't compile. the line test test = test(); is problem since std::ifstream not have copy constructor or copy assignment operator. use: test test; if have c++11 compiler, can use: test test{};

Oracle select inside an IF statement in a stored procedure -

coming sql server background, trying grasp of oracle syntax. trying return records stored procedure getting error: create or replace procedure sp_getcustomers(username in varchar2) begin if username = 'all' select * customers c; else select * customers c c.created_by = username; end if; end; what missing? you missing clause, @ stage better use function return values , procedure perform action.

ios - library not found for -lCloudinary -

Image
library not found whenever added pod . i have added pod terminal. error: ld:library not found -lcloudinary clang: error: linker command failed exit code 1 (use -v se invocation) when perform pod install or pod update must use new <yourproject>.xcworkspace file instead of old <yourproject>.xcodeproj file. it happens because .xcworkspace contains .xcodeproj , pods . if run .xcodeproj pods missing.

msbuild - Solution files conditional elements -

Image
is possible make elements in visual studio file conditional. although oddly .sln not in msbuild or xml format love similar syntax project("{fae04ec0-301f-11d3-bf4b-00c04f79efbc}") = "helloproj", "helloproj.csproj", "{61729087-eea0-4c80-bf72-4205970239f9}" endproject would become project( condition="some condition stuff" "{fae04ec0-301f-11d3-bf4b-00c04f79efbc}") = "helloproj", ... so if "some condition stuff" evaluated false project helloproj not included when open solution. doubt feasible, i'm not sure if solution file has concept of properties/variable thought ask anyway. nothing exists aware of remove project being loaded when open solution. don't think intent of solution file, rather if need include/exclude projects based on criteria @ open time it's safe consider using multiple solution files each solution contains correct projects situation. however, c#/c++/c proje

Change Apache Roller URL Structure -

i have 1 existing website , want migrate apache roller cms. existing website url following http://www.xx.com/blog/2015/03/how_to_change_the_url_structure can able use same url structure in roller cms, otherwise problematic seo perspective? if solution problem highly appreciated if ok roller's url structure new blog entries written after migration, recommend set redirecting filter such apache + mod_rewrite, , redirect of requests older weblog entries roller's url structure. example, redirecting filter, request existing entry http://www.example.com/blog/2015/03/how_to_change_the_url_structure will redirected roller's url scheme: http://www.example.com/blog/username/entry/2015_03_how_to_change_the_url_structure you can set "anchor" of weblog entry (for example, anchor "2015_03_how_to_change_the_url_structure") in time of migration like. roller stores weblog entries in database table named "weblogentry" , stores anchor

for loop - passing positive results from multiple columns into a single new column in r -

i trying work out way create single column multiple columns in r. want r go through rows multiple columns , if finds positive result in 1 of columns, pass result 'amalgam' column (sorry don't know better word it). see toy dataset below x <- c(na, na, na, na, na, 1) y <- c(na, na, 1, na, na, na) z <- c(na, 1, na, na, na, na) df <- data.frame(cbind(x, y, z)) df[, "compcol"] <- na df x y z compcol 1 na na na na 2 na na 1 na 3 na 1 na na 4 na na na na 5 na na na na 6 1 na na na i need pass positive results each of columns compcol column while changing negative results 0. looks this. x y z compcol 1 na na na 0 2 na na 1 3 3 na 1 na 2 4 na na na 0 5 na na na 0 6 1 na na 1 i know if requires if else statement nested inside loop ways have tried result in errors don't understand. i tried following single column (i in 1:length(x)) { if (df$x[i] ==

c# - Use Up/Down keys to scroll a ListBox when a TextBox has focus without moving cursor -

i have textbox user can type search term , listbox displays results. there button display information based on item selected on click. i'm trying scroll through listbox using , down arrow keys user doesn't have click item, button. @ point might rely on double click event work since on item. however, i'm trying make more "keyboard friendly". following code works, 1 minor flaw: private void txtsearchterm_keydown(object sender, keyeventargs e) { if (e.keycode == keys.down && results.selectedindex < (results.items.count - 1)) { results.selectedindex++; } else if (e.keycode == keys.up && results.selectedindex > 0) { results.selectedindex--; } } with code, cursor still moves left , right along selected item changing. want remain (not forcing end). didn't have luck txtsearchterm.select(...) event, guess have missed something... there textchanged event, calls search function wrote popu

python - How to append columns based on other column values to pandas dataframe -

i have following problem: want append columns dataframe. these columns unique values in row of dataframe, filled occurence of value in row. looks this: df: column1 column2 0 1 a,b,c 1 2 a,e 2 3 3 4 c,f 4 5 c,f what trying is: column1 column2 b c e f 0 1 a,b,c 1 1 1 1 2 a,e 1 1 2 3 1 3 4 c,f 1 1 4 5 c,f 1 1 (the empty spaces can nan or 0, matters not.) i have written code aceive this, instead of appending columns, appends rows, output looks this: column1 column2 0 1 a,b,c 1 2 a,e 2 3 3 4 c,f 4 5 c,f 1 1 b 1 1 c 1 1 e 1 1 f 1 1 the code looks this: def newcols(x): i, value in df['column2'].iteritems(): listi=value.split(',')

symfony - Sonata admin: Display entity grandchildren in sonata_type_collection -

i have following entities: // appbundle/entity/contacts.php /** * @var collection * * @orm\onetomany(targetentity="nominations", mappedby="contact") **/ private $nominations; // appbundle/entity/nominations.php /** * @var contacts * * @orm\manytoone(targetentity="contacts", inversedby="nominations") **/ private $contact; /** * @var votes * * @orm\onetomany(targetentity="votes", mappedby="nomination") **/ private $votes; // appbundle/entity/votes.php /** * @var nominations * * @orm\manytoone(targetentity="nominations", inversedby="votes") **/ private $nomination; with following method in contacts entity, loops through nomination records , stuffs them in arraycollection want display in contactsadmin: // appbundle/entity/contacts.php /** * votes * * @return \doctrine\common\collections\collection */ public function getvotes() { $return = array(); foreach ($this-&

vector - Is there a more friendly RefCell-like object? -

i'm looking class vec<refcell<t>> , in ultimate owner & allocator of of data, yet different pieces of array can be mutably borrowed multiple parties indefinitely. i emphasize indefinitely because of course pieces of vec<t> can mutably borrowed multiple parties, doing involves making split can resolved after parties done borrowing. vec<refcell<t>> seems world of danger , many ugly if statements checking borrow_state , seems unstable . if wrong, kablammo! panic! not lending library like. in lending library, if ask book isn't there, tell "oh, it's checked out." nobody dies in explosion. so write code this: let mut = lendinglibrary::new(); a.push(foo{x:10}); a.push(foo{x:11}); let b1 = a.get(0); // <-- b1 option<refmut<foo>> let b2 = a.get(1); // <-- b2 option<refmut<foo>> // 0th element has been borrowed, so... let b3 = a.get(0); // <-- b3 option::none does such thing exist?

vba - How to make Text Body in VB <b> not working -

i have code send email excel. info taken cells. trying make "j4" bold says symtex error when use . sorry i'm pretty new vba please explain if i'm complete noob. code is: sub sendmassemail() row_number = 1 doevents row_number = row_number + 1 dim mail_body_message string dim full_name string dim twitter_code string mail_body_message = sheet1.range("j2") & vbnewline & sheet1.range("j3") & vbnewline & sheet1.range("j4") & vbnewline & sheet1.range("j5") & vbnewline & sheet1.range("j6") full_name = sheet1.range("b" & row_number) twitter_code = sheet1.range("d" & row_number) mail_body_message = replace(mail_body_message, "replace_name_here", full_name) mail_body_message = replace(mail_body_message, "promo_code_replace", twitter_code) msgbox

mysql - Error Code: 1064 on constraint -

create table boat (bid integer not null constraint c_bid primary key, bname varchar(40), color varchar(40) constraint c_color check (color in ('red','blue','light green','yellow'))); i use sql code on script using mysql workbench , word contraint red , error syntax error : unexpected 'constraint' (constraint). when run script get: error code: 1064. have error in sql syntax; check manual corresponds mysql server version right syntax use near 'color_c constraint check (color in ('red','blue','light green','yellow')))' @ line 5 0.000 sec

javascript - Math.sin() gives different results on server/client? -

i use meteor. uses javascript on both server , client. when run math.sin(356644061314425) * 10000 get: -9986.46139381927 on server and -9986.46115497749 on client / browser / app why this? how can prevent this? edit: proposed duplicate questions refer degrees / radians. think mine more runtime problem. i think answer "how prevent this?" "you can't". the answer "why this?" javascript implementation of math.sin not determined. see http://www.ecma-international.org/ecma-262/5.1/#sec-15.8.2.16 specifically "sin (x) returns implementation-dependent approximation sine of x. argument expressed in radians." (my italics). but experimentation suggests modern browsers use 1 of 2 implementations, chrome being different (and seemingly more accurate than) other browsers.

jquery - MongoDB (Java driver) - Query date in interval -

i'm new mongodb , trying make query java driver records within date interval. in shell when : db.messages.find({ "date" : { $gt: isodate("2014-01-01t00:00:00z"), $lt: isodate("2014-01-01t00:00:05z") } }); it returns 4 records. in java i'm doing this: try { simpledateformat dateformat = new simpledateformat("yyyy-mm-dd hh:mm:ss"); date d1 = dateformat.parse("2014-01-01 00:00:00"); date d2 = dateformat.parse("2014-01-01 00:00:05"); basicdbobject query = new basicdbobject(); query.append("date", new basicdbobject().append("$gte", d1).append("$lt", d2)); system.out.println(query); } catch (parseexception ex) { logger.getlogger(mongodbnavigationmessagedao.class.getname()).log(level.severe, null, ex); } if search query, no record. moreover, output of system.out.println(query); : { "date" : { "$gte" : { &quo

html - Can i make a Text to an input radio with CSS? -

i have radio button , want make each 1 text value, think yes , no. <input type="radio" name="tabgroup1" id="rad1" class="tab1" checked="checked"/> <input type="radio" name="tabgroup1" id="rad2" class="tab2"/> i want khnow if can css make text these radios? like : .tab1{ content:'yes'; } .tab2{ content:'no'; } inputs aren't supposed have pseudo-elements per w3c spec although browsers have decided implement them anyway. ideally should use actual text in label if chose not can use label anyway , put pseudo-element on that. .tab1 + label:before { content: 'yes'; display: inline-block; } .tab2 +label:before { content: 'no'; display: inline-block; } <input type="radio" name="tabgroup1" id="rad1" class="tab1" checked="checked" /> <label for=&qu

jquery - How to retrieve information from database based on some specific condition and load them into html table using PHP? -

i have search page 2 fields: state , city (both using html select tag), , using jquery validate 2 fields. i using jquery's $.post() retrieve data database follow: $.post('database.php', { state : $( '#state' ).val(), city : $( '#city' ).val() }, function(response) { alert(response); } ); and database query used in database.php is: select * my_tbl tb_state = '$state' , tb_city = '$city'; so far ok , result correctly shown $.post() response , want retreive information in php, instead of jquery. so question is: possible convert $.post() response php or retrieve response in php? if yes how can that? if no how can retrieve database values html table based on above database query using php without refreshing same page or loading new page? modify function follows $.post( "database.php", { state: $( '#state' ).val(), city: $( '#state'

html - In ng-app application css media queries not working properly on ie9 and ie10 -

in angularjs app, css media query not working on ie9 , ie10. media query defined small screen effecting globally. works when resize browser or inspect element. no issues in other browsers chrome , firefox. i've not tested in ie10+ browser. works in ie8+ when remove angularjs. here media query: @media (min-width: 0px) , (max-width: 767px) { .col-sidebar{ width:100%} .col-content{ width:100%} } in large screen on ie10 browser, sidebar shows 100% width. here global css large screen: .col-sidebar{ width:30%} .col-content{ width:70%} you used initial keyword which not supported in internet explore . i removed initial keyword , replaced default value. jsfiddle css body { margin: 0; padding: 0; overflow: hidden; } #header { height: 116px; background-color: #333; } #sidebar, #content { position: absolute; top: 7.2em; bottom: 0; overflow: auto; } #sidebar { width: 392px; overflow-x: hidden;

PHP and C# 3DES Encryption -

need convert following function php c# (asp.net) function encrypt_3des($message, $key){ // se establece un iv por defecto $bytes = array(0,0,0,0,0,0,0,0); //byte [] iv = {0, 0, 0, 0, 0, 0, 0, 0} $iv = implode(array_map("chr", $bytes)); //php 4 >= 4.0.2 // se cifra $ciphertext = mcrypt_encrypt(mcrypt_3des, $key, $message, mcrypt_mode_cbc, $iv); //php 4 >= 4.0.2 return $ciphertext; } where $message string encode , $key key the $key base 64 encoded , decoded before calling function $key = $this->decodebase64($key); $ciphertext = $this->encrypt_3des($message, $key); following c# code used: key = base64decode(key); ciphertext = encrypt_3des(order, key,true); where private string base64decode(string base64encodeddata) { byte[] base64encodedbytes = system.convert.frombase64string(base64encodeddata); return encoding.getencoding(28591).getstring(base64encodedbytes); // 28591 php compatibility

ios - Disabling the scrollview right side at some conditions -

i implementing horizontal scrollview 10 custom views each view having different ui. when user scroll left scrolling to  next view , on right scrolling previous view working fine till now.at conditions have restrict left scrolling , enable right scrolling. in below method getting scenarios when disable right scrolling -(void)scrollenabled:(bool)scrollenable { self.scrollview.scrollenabled = scrollenable; // scrollenable comes no @ conditions here have disable right scrolling. if(!scrollenable) { // registering pan gesture , detecting right swiping uipangesturerecognizer *pangesture = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(detectrightscroll:)]; [self.panview addgesturerecognizer:pangesture]; } } - (void) detectrightscroll:(uipangesturerecognizer *)gesture { cgpoint translation = [gesture translationinview:gesture.view]; if(translation > 0) // here detecting right scrolling , changing scrollview

How to backup table to local disk using mysql event -

i trying backup 1 database table local path .sql file using below mysql command, create event backupin_home_directory_sqlfile on every 1 day starts '2015-10-14 16:10:00' select * outfile 'c:\users\username\desktop/backupcehcking.sql' testingdb.table_test; but getting following error: error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'every 1 day starts '2015-10-15 13:10:00' select * outfile 'c:\users\user' @ line 1 what doing wrong? as per answer changed command, mysql> alter event backupin_home_directory_sqlfile select * outfile 'c:\ users\raghu_zanct\documents\dbbackup_checking\backupcehcking.sql' testing.m anitest; query ok, 0 rows affected (0.00 sec) mysql> alter event backupin_home_directory_sqlfile on schedule every 1 day start s '2015-10-15 15:28:00'; eventhough dont find backupcehcking.sql file in specific folder. why? i think

javascript - angularjs access web api through service -

i want return value inside web api javascript file, kept not data, can me find out problem? try using http://localhost:8584/api/testing/5 check whether there having result or not. //thsi javascript controller called service.js app.controller('maincontroller', function ($scope, service) { returndata(); function returndata() { var getdata = service.get(5); //the data return web api shown $scope.newmessage getdata.then(function (pl) { $scope.newmessage = pl.data }, function (errorpl) { $log.error('failure loading employee', errorpl); }); } } //this service.js app.service('service', function ($http) { var bseurl = 'http://localhost:8584/'; this.get = function (id) { return $http.get(baseurl + 'api/testing/' + id); } }); //thsi web api controller namespace angulartestone.controllers {

Is there a way to set NetBeans to run Chrome Incognito as default browser? -

Image
i trying set chrome incognito default browser, dont know how this. i'm running netbeans 8.0.2. idea? open options top menu (tools -> options) click on edit button right of web browser selector , configure in screenshot.

android - jcodec Permission Denied for NIOUtils.readableFileChannel -

i'm trying use jcodec frames mp4 on emulator. have following permissions in manifest: <uses-permission android:name="android.permission.write_external_storage"/> <uses-permission android:name="android.permission.read_external_storage" /> <uses-permission android:name="android.permission.write_internal_storage" /> <uses-permission android:name="android.permission.read_internal_storage" /> the file through adb shell looks this: root@generic_x86_64:/sdcard/download # pwd /sdcard/download root@generic_x86_64:/sdcard/download # ls -la -rwxrwx--x root sdcard_rw 19967250 2015-10-12 16:39 hummingbird.mp4 i've tried doing chmod 777 hummingbird.mp4, doesn't change last set of permissions reason? the following code produces exception below. string basedir = environment.getexternalstoragedirectory().getabsolutepath(); string fn = basedir + "/download/hummingbird.mp4"; // test dir make sure i

excel - Ensuring DatePicker is available in VBA -

i have question couldn't find answer google search. i'm working on vba assignment, 1 of sections requires user enter start , end date used filter through set of data. have been using datepicker package , has been working fine. emailed assignment (to myself) work on later on, , noticed datepickers don't show on forms. when open assignment, error message pops saying "could not load objects because not available on machine". now, date pickers installed on computer using, have added through menus in excel. anyway, wondering if there anyway can ensure date pickers available excel file submit. otherwise, have input dates through mechanism (which fine, date pickers provide nicer visual drop down lists of day, month, year. i hope question clear , thank excel not have date picker calendar control out of box seamlessly works in versions. there activex controls can used in earlier versions, won't work later versions. ron de bruin has written vba data p

Cannot assign PHP variable to mysqli query -

so i'm trying echo each row of users 1 of databases @ website set on wamp server, version 2.5. wrong, i've googled , search site's posts... don't think there's been problem quite 1 addressed yet. in practice of using php following tutorials/exercises, had of course found mysql prefers either pdo or mysqli these days, decided give shot @ using mysqli. the weird thing is, i've included php file configures mysql connection, , know connection variable being called properly, since i've printed out result of query variable being assigned to: mysqli_result object ( [current_field] => 0 [field_count] => 3 [lengths] => [num_rows] => 1 [type] => 0 ) above output when use: print_r($db_con->query("select * users")); yet when try assign result variable, $user_rs, , print value of variable, "notice: undefined variable: user_rs in c:\wamp\www\index.php on line 58." here files. dbconfig.php: <?php $db_con=

git - .gitignore won't let me upload files -

Image
i'm learning use github , here's problem. i uploaded program github (git add, commit, push). noticed files in 1 of folders missing, replaced .gitignore the contents of "src" folder should follows: src -> model, controller model -> x.java, y.java z.java controller -> w.java instead of above, there single .gitignore file in src. contents of file like: /model/ /controller/ why did happen , how can fix this? that can happen instance egit: preference settings under team > ignored resources can define "derived" flag, generate .gitignore. if model , controller folder considered "derived" (ie "generated"), egit might have generated .gitignore. to fix it, check preferences , also git add --force folders, delete .gitignore, commit , push.

c++ - How to prevent integers being assigned to char strings? -

i new @ programming in c++, , have come across problem can't solve. trying create error message whenever user inputs integers instead of characters. problem is, integers being accepted , assigned char strings reason.. thought point of defining strings int or char etc. let compiler know values accepted. let me know i'm doing wrong? int x, input = false; char check[size], str[size]; cout << "enter 1 word: "; cin >> str; while (!cin) { cout << "\nerror: must enter 1 word characters. \n\nre-enter: "; cin.clear(); cin.ignore(256, '\n'); cin >> str; } a char 1-byte interpretation of integer according ascii value (i.e. integer 68 ascii value character 'd'). other ascii values can found here . for code, need create function loops through inputted string , checks see if of characters not letters. for example: for (int = 0; < strlen(str); i++) { if ((int)str[i] < 65 || ((int)str[

arduino - Receiving iBeacon signal by RFduino -

Image
i working on project ibeacon tag , rfduino board (is arduino variant). my mission receive ibeacon signal info (rssi) on rfduino. first did, test if can receive data rfduino following code , works fine, receives bluetooth le data. but not know how receive ibeacon data information. my question: possible receive ibeacon signal (rssi) or ibeacon info rfduino if yes, how? if no possible receive ibeacon signal using normal arduino hc-05 board (regular bluetooth board)? the code void setup() { serial.begin(9600); rfduinoble.devicename = "device1"; rfduinoble.begin(); } void loop() { } void rfduinoble_onreceive(char *data, int len) { serial.println(data[0]); } rfduino reference link . after long time research , try , fail, short answer no . more details ibeacon bluetooth le broadcaster , can discovered central or observer. many bluetooth le devices here including rfduino device pure peripheral device, not possible use discover ibeacon.

javascript - Angularjs - `ng-model` in multi-dimension array -

i have object : [{ 'name': '2015', 'section': '001', 'subsections': [{ subsection:'aa', mainelements: ['cc','dd'] },{ subsection:'bb', mainelements: ['ee','ff'] }] }] and can display them in html <body> <button ng-click="new()">new</button> <ul> <li ng-repeat="audit in audits"> <span ng-hide="editing"><h5>{{audit.name}}</h5></span></br> <input ng-show="editing" type="text" ng-model="audit.name" size="30" placeholder="add name here"></br> <span ng-hide="editing">{{audit.section}}</span></br> <input ng-show="editing" type="text" ng-model="audit.section" size="30" placeholder="add