Posts

Showing posts from April, 2013

html - Mobile Button Menu (Drop Down Menu) goes on to of content -

the button when clicked makes menu appear although not push content down, goes on top of , can't see it. i've tried changing position of .navbar nothing works, removed background colour of navbar see whether sidebar , main have disappeared or whether behind (it behind). in advance! <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="styles.css"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="script.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!--[if lt ie 9]> <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> <![endif]--> </head> <body> <header> <i

responsive design - What type of device is viewing my site? -

hi trying make responsive website, , want find way check whether device viewing page pc, tablet or phone. so far, solution find variations of this: # mobile screen , (min-width: 480px) # tablet screen , (min-width: 768px) # desktop screen , (min-width: 992px) # huge screen , (min-width: 1280px) correct me if i'm wrong, difference in pixel-density in devices big, can't guarantee anything, , require regular updates based on development of new screens higher pixel-density. i hoping there function give screens size in real physical inches, or variable call, tell type device is. the goal have piece of code, never have update, works no matter type of device. i'm language, i'm best @ html, css , javascript. thank in advance! you use media-queries: media-queries or try: responsive webdesign via media-queries @ stackoverflow

dom - moving an object created by JQuery -

i'm sure has come before, can't seem search right wording find related. i have object created jquery. (will 3rd party plugin created it) since created after dom formed, it's not found object jquery. i want appendto() created object. isn't there jquery command says "check if new elements have been added dom? there js mutationobserver method can detect dom tree update. can check if update correspond added object. other helpful question here .

Run JUnit tests in Android studio -

i created new android project , tried run tests (junit) , had follow result: 15:28:53: executing external tasks 'cleantest test --tests com.binomv.rimidalv.tt.*'... failure: build failed exception. what went wrong: problem occurred configuring root project 'tt'. could not resolve dependencies configuration ':classpath'. artifact 'kxml2.jar (net.sf.kxml:kxml2:2.3.0)' not found. searched in following locations: https://jcenter.bintray.com/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar try: run --stacktrace option stack trace. run --info or --debug option more log output. build failed total time: 0.512 secs artifact 'kxml2.jar (net.sf.kxml:kxml2:2.3.0)' not found. searched in following locations: https://jcenter.bintray.com/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar but if use test through device - ok. thank you. -----update----- build.gradle file: apply plugin:

javascript - Drop down value depends on radio button selection -

i have 2 radio button name='bb' , have drop down button name='size' should have 2 different option depends on checked radio button. code below ---------------------------------------- <input type="radio" name="bb" id="bb" checked required="true" value="home" > <div>home</div> <input type="radio" name="bb" id="bb" value="office"> <div>office</div> <label>size</label> <select name="bedroom" id="bedroom" style="color: #8e9092; /*height: 38px;width: 228px;*/" > home--- <option value="1 bedroom (350 700 sq ft)">1 bedroom (350 700 sq ft)</option> <option value="2 bedroom (700 1300 sq ft)">2 bedroom (700 1300 sq ft)</option> <option value="3 bedroom (1300 2000 sq ft)">3 bedroom (1300 2000 sq ft)</option> <option

java - Swing: JComboBox removing/adding duplicates -

my problem has able add , remove items combobox. items can duplicates. manage add them: jcombobox1.additem(dodatek); remove first: if (jcombobox1.getitemcount() > 0) { jcombobox1.removeitemat(0); or selected one: if (jcombobox1.getselecteditem() != null) { jcombobox1.removeitemat(jcombobox1.getselectedindex()); problem occurs when having items removed, , 1 of them duplicate. in case last item remains selected in combobox though list empty! http://imgur.com/smf2hwg it throws exception when trying remove selected item: exception in thread "awt-eventqueue-0" java.lang.arrayindexoutofboundsexception: array index out of range: -1 @ java.util.vector.removeelementat(vector.java:562) @ javax.swing.defaultcomboboxmodel.removeelementat(defaultcomboboxmodel.java:152) @ javax.swing.jcombobox.removeitemat(jcombobox.java:759) this happens when removing items among there duplicates selected item , selected index don&

c# - Displaying the value of a property from a class according to selected item in listbox -

i made class named product , added different products class in main program this: product1 = new product(); product1.name = "product1"; product1.price = 3.50; product product2 = new product(); product2.name = "product2"; product2.price = 4; and i've got listbox fill method: private void fillproducts(string item) { lstproducts.items.add(item); } so when use method this: fillproducts(product1.name); now want achieve when press button (btnconfirm) see product has been selected in listbox , price of product , display in label lblconfirm.text = "the price of product1 is: " + *the price of product1*; so need display price of product1 in label , don't want use if-statements every single product because there on 200 if-statements. if unclear in question please tell me. just populate listbox product , not string: private void fillproducts(product item) { lstproducts.items.add(item); } use prope

STL VS13 C++: Error C4996 not disabling -

i have code in vs13: double distance(vector <double> point) { return sqrt(inner_product(point[0], point[4], point, 0)); } int main() { vector < double > point {2, 2, 2, 2}; cout << distance(point); cin.get(); } which invokes error c4996 ('std::_inner_product2': function call parameters may unsafe - call relies on caller check passed values correct. disable warning, use -d_scl_secure_no_warnings) c:\program files\microsoft visual studio 12.0\vc\include\xutility(372): error c2825: '_iter': must class or namespace when followed '::' c:\program files\microsoft visual studio 12.0\vc\include\xutility(372): error c2039: 'value_type' : not member of '`global namespace'' c:\program files\microsoft visual studio 12.0\vc\include\xutility(372): error c2146: syntax error : missing ';' before identifier 'value_type' c:\program files\microsoft visual studio 12.0\vc\include\xutilit

Incorrect plotting of data on Choropleth map with ggplot2 in R -

Image
i trying make choropleth map of germany using ggplot2. data .csv file 2 rows ( rs= containing numbers 1 16 each german state & tariff= 16 random positive , negative numbers ). rs tariff 1 01 -5.25 2 02 7.16 3 03 6.65 4 04 3.10 5 05 3.69 6 06 2.49 7 07 1.89 8 08 3.93 9 09 -5.84 10 10 -2.61 11 11 -0.21 12 12 2.35 13 13 -5.94 14 14 -7.54 15 15 -3.27 16 16 -8.75 also have shape file germany shape file . want plot positive , negative numbers onto map of germany each state, 2 colors (positive=green , negative=red). below code library(xlconnect) library(sp) library(rgdal) library(ggplot2) library(plyr) library(rcolorbrewer) library(datacombine) library(rgeos) library(maptools) #### eeg data read #### eeg<-read.csv(file = "data/testdata1.csv", skip = 0, sep = ",", dec=".", header=true) colnames(eeg)<-c("rs", "tariff") eeg$rs<- c("01","02","03&

mysql - phpMyAdmin search and replace multiple fields condition -

i want sure before press button... i want search , replace. row has column meta_key , column meta_value. condition meta_key has product_page , want replace in meta_value oldtext- newtext-. when want search , replace in 1 column can do update `wp_postmeta` set `meta_value` = replace ( `meta_value`, 'oldtext-', 'newtext-'); but put condition check in meta_key column? in where clause: update `wp_postmeta` set `meta_value` = replace(`meta_value`, 'oldtext-', 'newtext-') meta_key = 'product_page';

netty - channelReadComplete called before channelRead0 when ssl is used -

i have set junit test starting server first , connecting client. response comes should. add ssl , response still comes client, reason seems channelreadcomplete method called twice before channelread0. it's easy avoid exceptions creates on null object attempted relayed next handler firechannelread(msg) , testing null before calling firechannelread(msg) , if there can avoid behavior please enlighten me. ssl handlers set in telnet example. using 4.0.25.final. here ssl code server: channelpipeline cp = ch.pipeline(); selfsignedcertificate cert = new selfsignedcertificate(); sslcontext cont = sslcontext.newservercontext( cert.certificate(), cert.privatekey()); cp.addlast("ssl", cont.newhandler(ch.alloc())); and client: channelpipeline pipeline = ch.pipeline(); sslcontext cont = sslcontext.newclientcontext(insecuretrustmanagerfactory.instance); pipeline.addlast(cont.newhandler(ch.alloc(),host, server_secure_port)); here junit test: public class myssltest {

Is there any way to record HTTP POST data in Result Tree in Jmeter? -

i looking way record data i'm posting jmeter. normal configuration, in result tree can see: post data: --ybhhptoxmguqjy2d0z2xchfz_bpa77-- in specific case, need debug rest service, need see actual body i'm sending down server. i'm wondering if there property/ configuration suitable this... it tooks time find solution.. in order see data posting, need uncheck "use multipart/form-data post"

Create random string with a char + 2 numbers - python -

two questions: how create char+number random string. 1 char , 2 digit numbers example: u12 or w82 how create random 5 digit number no 0 @ beginning: 02345 , 03243 1) import random, string "%c%02d" % (random.choice(string.uppercase), random.randint(0, 99)) 2) import random random.randint(10000, 99999)

model view controller - Simple PHP error MVC structure -

for school assignment have make website piece of back-end in it. learned mvc structure clean , logic overview of our folders/classes in php. however, when try 1 item database, browser gives error 'undefined variable'. after 1,5 days of failed attempts decided give shot on stackoverflow. i'm willing screenshare if me. explaining code in here not make problem clear i'm affraid :/ thx in advance, bernd

string - Does echo in PHP starts printing on a new line? If no then why it's happening in my case? -

i've following php code: <!doctype html> <html> <body> <?php echo "<h2>php fun!</h2>"; echo "hello world!<br>"; ?> </body> </html> i'm not understanding why without adding <br> @ end of first echo statement next echo statement printing data on new line? the same not happening in below example : <!doctype html> <html> <body> <?php echo "jumbo"; echo "hello world!<br>"; ?> </body> </html> i'm getting output jumbohello world! why so? mean @ 1 place echo takes new line charcter before start printing text , @ place it's not. please clear concept me in detail manner. thanks. when "new line" referring visually when viewing page in browser. in html have block-level elements, default appear on own line, , there line breaks, defined <br> echo not add other tell output. <h2> b

postgresql - Triger update function when column updates in Postgres -

i have users table columns status_id (int), additional_status(int) , status_changed(date). i want autoupdate status_changed field every time when status_id or additional_status changes. here have now: create or replace function update_status_changed() returns trigger $$ begin new.status_changed := current_timestamp; return new; end $$ language plpgsql; create trigger set_update_status_changed after insert or update of status_id, additional_status on users each row execute procedure update_status_changed(); i'm not sure if syntax correct. when change status_id phppgadmin - status_changed stays null. i'm missing?, pls.

php - unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) error -

in registration script, error keeps popping up. code such: try { $dbh = new pdo("mysql:host=$hostname;dbname=booter", $username, $password); echo 'connected database<br />'; /*** insert data ***/ $count = $dbh->exec("insert members(username, password, email) values ('$_post['username']', '$hashedpassword', '$_post['email']')"); /*** close database connection ***/ $dbh = null; } catch(pdoexception $e) { echo $e->getmessage(); } any fixes (as tips security) appreciated. the problem line: ('$_post['username']', '$hashedpassword', '$_post['email']') which quotes inside post arrays need removed. however, isn't safe @ , should using prepared statements, leaves open sql injection . first assign variable post arrays: $username = $_post['username']; $hashedpassword = "the way you're getting from"; $email = $_post[&

image - How to create a flood fill figure animation using python? -

how create flood fill figure animation using python? i saw image online , wondering how go these types of animation. think useful technique can used in maps, presentations, etc , curious it. the image: http://i.imgur.com/zasxkli.gif i researched these questions: flood fill in python how flood-fill part of bitmap enclosed black border chosen color? python: floodfill algorithm minesweeper flood fill algorithm python looked @ resource: http://inventwithpython.com/blog/2011/08/11/recursion-explained-with-the-flood-fill-algorithm-and-zombies-and-cats/ questions: can point me working code type of exercise? which libraries considered standard use now? how logic behind fill exercise work? can point me more information/resources (maybe docs libraries) how integrate concept matplotlib? can point me example? thank much!

mysql - Specified key was too long: max key lenth is 3072 bytes -

i need this, have relation tables instantiated when im going create relationship table sends me "error: 1071 specified key long: max key lenth 3072 bytes" my code until now: create table tablahechos( id_almacenf varchar(255) not null, id_productof varchar(255) not null, id_categoriaf varchar(255) not null, id_transaccionf varchar(255) not null, id_tipo_serviciof varchar(255) not null, id_mensajerof varchar(255) not null, id_clientef varchar(255) not null, id_tiempo_fecha_orden varchar(255) not null, id_tiempo_fecha_reserva_entrada varchar(255) not null, id_tiempo_fecha_reserva_salida varchar(255) not null, id_tiempo_fecha_inventario_entrada varchar(255) not null, id_tiempo_fecha_inventario_salida varchar(255) not null, id_tiempo_fecha_envio varchar(255) not null, id_tiempo_fecha_facturacion varchar(25) not null, id_tiempo_fecha_cancelada varchar(255) not null, para_regalo varchar(45) not null, monto_unitario varchar(255) not null, monto_total varchar(45) not null, can

PL/SQL update with function -

hi need use update in combination function , cant understand how possible. think update should : update counting set rate = function(count_id) date = '....' do u think can write update in way , because in function have use same fields.

git - checkout remote git code into Android Studio imported project with Gradle build -

i've got code imported android studio. it's got gradle build (which didn't have previously). need git pull . however, given directory structure has changed i'm not sure how go ahead this. the android studio directory structure under app/src/main looks similar original, e.g.: android studio [main]$ ls androidmanifest.xml assets java res [main]$ ls java/ license.txt readme.md com the original $ ls androidmanifest.xml readme.md res license.txt assets src $ ls src/ com under com it's pretty similar except reverse domain path different (e.g. com/original , com/new ). i.e. seems significant file androidmanifest.xml that's in different location. however, if git pull it's going put androidmanifest.xml in different place , check out com/original on top of com/new . any suggestions how deal this? you need reorganize first files in order match target (that current gradle structure) clone re

java - How to save data with gson in a json file? -

in web application succeed in displaying data in html table using mybatis. want save records of mysql table in json file , create array of users, used gson, problem 1 record saved in file. thanks. here result in file.json : {"data": [ {"id":2,"name":"mike"} ] } servlet.java sqlsession session = mybatissqlsessionfactory.getsession(); list<user> users = session.selectlist("dao.userdao.findall"); (user u : users) { gson gson = new gson(); try { jsonwriter writer = new jsonwriter(new filewriter("c:\\file.json")); writer.beginobject(); writer.name("data"); writer.beginarray(); writer.beginobject(); writer.name("id").value(t.getid()); writer.name("name").value(t.getnom()); writer.endobject(); writer.endarray(); writer.endobject(); writer.close(); } catch (ioexception e) { e.p

Creating exclusive ranges in kotlin -

i starting kotlin . want create range 1 n n excluded . found out kotlin has ranges , can use them follows 1..n but inclusive range includes 1 , n . how create exclusive ranges. not sure if best way can define int extension creates intrange (lower bound +1) (upper bound - 1). fun int.exclusiverangeto(other: int): intrange = intrange(this + 1, other - 1) and use in way: for (i in 1 exclusiverangeto n) { //... } here can find more details how ranges work.

Xcode build fails for react-native AwesomeProject -

i'm running xcode 4.6.3 on os x 10.7.5. i've set ios deployment target 6.1 in xcode , selected iphone 6.1 simulator. when hit run react packager appears , says ready. xcode fails build 4 parse errors related rctimagedownloader.m , there 9 target integrity warnings: /users/sm/awesomeproject/node_modules/react-native/libraries/adsupport/rctadsupport.xcodeproj ios deployment target '7.0' newer sdk 'ios 6.1' in target rctadsupport what options resolving problem? the tools not support building newer deployment target sdk supports. need lower deployment target 7.0 6.1 or use newer tools (which require newer version of osx well).

java - How to update from JDK8u20 to JDK8u40? -

i have jdk1.8.0_20 , upgrade jdk1.8.0_40. mistakenly, updated java version 1.8.0_40 thinking update jdk too, updated jre. 1 need separately download , install new jdk version , remove old 1 or should update automatically or what? i've searched , searched somehow couldn't find hint. either i'm missing , simple or it's not discussed lot. in advance. you need install new jdk deparately have change process use new one. as have not mentioned how using jdk bit hard know needed in general should able change java_home , path variables point newly installed jdk. eg if using eclipse change jvm entry in eclipse.ini or change path in installed jre configuration in window/preferences.

php - Javascript for HTTPS -

i've been going through google, bing, etc etc trying find out how can scripts run correctly, google chrome says it's attempting load scripts unauthenticated sources, , i'm not 100% sure means that. here's login page runs fine on localhost, chrome doesn't running script. <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script> $(function () { $('#login').on('submit', function (e) { e.preventdefault(); $.ajax({ type: 'post', url: 'calls.php', data: $('#login').serialize(), success: function (data, response) { if(data==1) { window.location.href = "/account.php"; return false;} else{ $( ".result" ).html( data );} } }); }); }); </script> <div style="background-image

c# - WebRequest.KeepAlive property doesn't exist in .net 2.0 -

i trying set keepalive property true, doesn't exist. if try set adding in header, following error: header must modified using appropriate property. is there method set keepalive property true? changing framework isn't option. thank you.

Scala: How to mask the first N characters of a string -

given string represents credit card number... val creditcardno = "1111222233334444" ... how mask first 12 characters * ? val maskedcreditcardno = "************4444" replace digit symbols unless 4 characters remain: creditcardno.replaceall("\\d(?=\\d{4})", "*")

mysql - #1241 Operand should contain 1 column(s) in Insert into Select -

hey guys m working on sql , got error first ll show code insert historiqueequipement (datemhs,codeequipement,nomenclature) values (2015-03-28, (select codeequipement,nomenclature equipement numero_serie =241)); i got error #1241 - operand should contain 1 column(s); , if use insert historiqueequipement (datemhs,codeequipement) values (2015-03-28, (select codeequipement equipement numero_serie =241)); it work where's problem want insert many columns not 1 i think getting error rows returned select more one. can use insert table select this: insert historiqueequipement (datemhs,codeequipement,nomenclature) select curdate(), codeequipement, nomenclature equipement numero_serie =241;

Rails: set locale for a specific path -

i want specify locale specific path. in whole application have default local e set :es config.i18n.default_locale = :es that works in normal fashion whole application, want know how can specify specific locale set of paths... i integrated third party application called maily_herald , in order make it's paths available application have add line routes.rb file mount mailyherald::webui::engine => "/maily_webui" the problem there not translations locale :es, not work properly... want let paths under /maily_webui have locale :en third party application work in english while application still work in :es any idea how this? class applicationcontroller < actioncontroller::base ..... before_filter :set_locale def set_locale if request.fullpath == "some_path" i18n.locale = :some_locale else i18n.locale = params[:locale] || i18n.default_locale end end end

Permutations in JavaScript? -

i'm trying write function following: takes array of integers argument (e.g. [1,2,3,4]) creates array of possible permutations of [1,2,3,4], each permutation having length of 4 the function below (i found online) taking string argument, , returning permutations of string i not figure out how modify make work array of integers, (i think has how of methods work differently on strings on integers, i'm not sure...) var permarr = [], usedchars = []; function permute(input) { var i, ch, chars = input.split(""); (i = 0; < chars.length; i++) { ch = chars.splice(i, 1); usedchars.push(ch); if (chars.length == 0) permarr[permarr.length] = usedchars.join(""); permute(chars.join("")); chars.splice(i, 0, ch); usedchars.pop(); } return permarr }; note: i'm looking make function return arrays of integers , not array of strings . i need solution in javascript. i've figured out how in python

vim - How to change VIMRUNTIME directory after build from sources -

how can change $vim , $vimruntime directory after building sources? seems both directory follow vim.exe , gvim.exe directory. update : built in windows 8.1 x64 mingw32. something this: :echo $vimruntime /usr/share/vim/vim74 :let $vimruntime="/tmp" :echo $vimruntime /tmp or add .vimrc : let $vimruntime="/tmp"

ios - Layout looks bad even though constraints are added -

Image
i designed on table view cell , clicked "add missing constraints" it looks this but when run on iphone 5s simulator, looks this it doesn't fit layout , overflows how can make looks fit on iphone 4-5-6 ? xcode not know how set constraints cause ui "look good". looking subjective human judgment , computers can't that. "add missing constraints" make rough guesses, best xcode engineers able generate algorithmically. guaranteed sufficient resolve ambiguities in current set of constraints, not guaranteed smart keeping ui looking good. auto layout requires you, developer, thoughtful, careful consideration of how ui should under various circumstances. have set constraints achieve that. can't go on autopilot. have work. if, after setting constraints, still results wrong, need show specific constraints set up, how expected ui laid out in various circumstances, behavior got, , how differs wanted/expected. for example, scre

jquery - how to pass the param in $.ajax to be filtered in json? -

var type = $(this).attr('id'); $.ajax({ type: 'get', url: 'path/to/example.json', datatype: 'json', data: {type: "type"} //not working? ...... { json "name": "jh", "type": "zoologist, hobbyist" }, html <div class="filter"> <a href="?type=all" id="all">view all</a> <a href="?type=zoologist" id="zoologist">zoologist</a> <a href="?type=hobbyist" id="hobbyist">hobbyist</a> <a href="?type=judge" id="judge">judge</a> </div> not familiar $.ajax , frustrated quite long while, trying pass param filter type in json. filter link clicked on , attribute of id. want pass id data: {type: type}. wanted retrieve details of same type filtered no

angularjs - Angular image zoom always in center -

i have directive. there zoom on scroll image , can drag image. need, image default on center (div or screen) , image should on center when zoommed of mouse wheel. generally, center of image should on center of screen (and can drag image before). var app = angular.module('app', []); app.directive('mydraggable', ['$document', '$timeout', function($document, $timeout) { return function(scope, element, attr) { var startx = 0, starty = 0, x = 0, y = 0; scope.updatex = 0; scope.updatesize = 50; // scope.topsize = 1; function zoomcontroller (zoomtype, updatesize) { var default_scale = 50; var zoomtype = zoomtype; var updatesize = updatesize; if (zoomtype == 1 && updatesize > 150) { return updatesize; } else if (zoomtype == 1 && updatesize < 150){ return updatesize = updatesize * 1.02; } else if (zoomtype == 0 && updatesize &g

Entity Framework 5.0 - Delete object without retrieving it -

i want delete database entry this: public bool deletepersonbyid(int id) { var p = new person() { id = id }; //ctx.person.attach(p); ctx.entry<person>(p).state = entitystate.deleted; return true; } then invalidoperationexception following message: the key field 'firstname' cannot have value of null. non-null value required key fields defined on type 'person'. so, me doesn't matter if property can or cannot null in case, because want delete complete row/object. object loaded asnotracking() (from p in ctx.person.asnotracking() p.id == id select p).firstordefault(); ok, table didn't have primary key, after adding pk on db table , regenerating ef model, above code works.

TabBarIOS on React Native not working as expected -

i'm having problems on implementing tab bar react native. documentation not exist ( http://facebook.github.io/react-native/docs/tabbarios.html ) , example @ front page insufficient (e.g. missing required property icon). i managed implement code point-of-view , showed up. light blue box taking half of space on screen. my "working" code looked this: <tabbarios> <tabbarios.item title="wooden" selected={false} icon={require('image!wooden')}> <navigatorios initialroute={{ title: 'wooden' }} /> </tabbarios.item> </tabbarios> but said, end result not expected. has managed implement tabbarios successfully? tried search through source code there no gotchas would've helped me. answering own question, how got working: first need define tabbaritemios : var react = require('react-native'); var { image, stylesheet, text, view, tabbarios } = react; var tabbaritemios = tabbar

jquery - simple ajax POST with cross domain request -

i trying send simple form 1 parameter api made back-end programmer, told me need send 1 parameter given url via post using ajax. the problem no 'access-control-allow-origin' header present error. i've read through this question , tried implement first answer's solution no success. when test api via hurl works no problem. this code using send form $( document ).ready(function() { $('.btnenviar').click(function(){ $.ajax({ type: 'post', url: 'http://xxxxx.xxx/subscribers/subscribeemail', datatype: 'jsonp', async: true, success:function(){ try{ alert("ok"); }catch (e){ alert(e); } } }); }); }); and form: <form class="newsletter" method=

c++ - Geting a segfault on in a data stream processing program -

i writing program processes batches of updates graph in of new nodes , edges. incorporated sliding window scheme checks see if edges in graph in window, , if not deletes them. using edge , node class follows: class edge { public: uint64_t source; uint64_t target; unsigned type; std::string label; uint64_t timestamp; bool directed; bool extracted; edge(){} edge(edge *e); edge(uint64_t, uint64_t, unsigned, std::string, time_t, bool); bool operator ==(const edge *other) { return((this->source==other->source)&&(this->target==other->target)&& \ (this->type==other->type)); } }; class node { public: uint64_t id; unsigned type; std::string label; uint64_t timestamp; std::vector<edge *> adjacent_edges; node(){} node(node *); bool push_edge(edge *e) { try { adjacent_edges.push_back(e); } catch(std::bad_alloc&) { std::cout<<"error pushing edge"<<

ios - Scanning barcode from UIImage natively (i.e., not using ZBar) -

i've been using native barcode scanner functionality provided apple since ios7 , great, needed scan static images had automatically catalogue barcodes. i couldn't find way natively, used open source package called zbar, , part, works fine. however, returns false values , flat out fails find barcode. built c++ library scratch got same results in os x build. seems abandoned project. apple's native solution finds barcode on static image if scan image computer monitor! same thing goes images return false/incorrect values. so there anyway use apple's libraries scan uiimage? try this cidetector* detector = [cidetector detectoroftype:cidetectortypeqrcode context:nil options:@{cidetectoraccuracy:cidetectoraccuracyhigh}]; if (detector) { nsarray* featuresr = [detector featuresinimage:scannedimg.ciimage]; nsstring* decoder; (ciqrcodefeature* featurer in featuresr) { nslog(@"decode %@ ",featurer.messagestring); decoder = featurer

R .call argument in stop function -

what use of .call argument in stop function? the page (?stop) explains "call. logical, indicating if call should become part of error message.". could 1 explain .call argument intuitive example? thanks just try yourself: f = function () stop('foo') g = function () stop('bar', call. = false) f() # error in f(): foo g() # error: bar … , compare output. that’s difference. the use of argument when want hide irrelevant detail end user otherwise drown out actual error message or actively misleading. for instance, i have package contains following functions 1 : #' @export import = function (module, ...) { # … code here … module_path = find_module(module) # … more code here … } find_module = function (module) { # … code here … if (no_module_found) stop('unable load module ', module, '.', call. = false) } now, can see function import exported package, function find_module isn’t. conseq

chrome extension refuses to load Google analytics -

i've followed countless stackoverflow tutorials specifying how install google analytics correctly chrome extension nothing has seemed work me far. right have google analytics tracking code inside of main js file: (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'ua-xxxxxxxx-1', 'auto'); ga('set', 'checkprotocoltask', function(){}); ga('require', 'displayfeatures'); ga('send', 'pageview', '/override.html'); my content_security_policy looks this: "content_security_policy": "script-src 'self' https://query.yahooapis.com https://google-analytics.com; object-src

android - simple way to share and read contents on the web -

i'm kinda new android. i'm making app creates groups of people. each group's data represented simple 2-dimensional int array. i'm looking way share arrays contents on web, such every app user in group change shared data(from inside app). i thought of using google docs document. is , possible idea? if is, how? if not- is? (you can point me in right direction i'll read rest). thanks!

sql - How to save variable acquired from method for later use in Java? -

i have 3 classes, main, pin, , employee. (more classes added in future) the main class runs program prompts use enter password method in pin class. password sent using sql database verified methods in employee , pin classes. if password matches, returns id of employee. the problem having saving id. retrieved id, want able use id rest of program. want save in employee class returned in method pin class. how able save id used employee class, or class? hmm, if understand correctly may want composition of employee , pin? employee e = ... e.setpin(pin); or problem, don't know how assign specific pin employee, still assigned employee in next run of application? update: after receiving more information: need create application context program. seems standalone application 1 user @ time, can static field in class. if application multi-user application, context needs static per user. if application web-application, application scope session , terminated during lo

javascript - Applying a CSS transition when adding a class via JS -

i creating button, when clicked, reveal email input user fill out. working, want smooth transition action not "jerky". this html button , form <button id="work" onclick="workyes()">sign up!</button> <div id="workyes" class="invisible"> <form><input type='email'></form> </div> the css i'm using: button { border: 0; background: #5786c1; color: white; padding: 8px 14px; font-weight: bold; font-size: 18px; text-decoration: none; display: inline-block; /* needed anchors */ position: relative; box-shadow: 1px 0px #3a587f, 0px 1px #4171ae, 2px 1px #3a587f, 1px 2px #4171ae, 3px 2px #3a587f, 2px 3px #4171ae, 4px 3px #3a587f, 3px 4px #4171ae, 5px 4px #3a587f, 4px 5px #4171ae, 6px 5px #3a587f, 5px 6px #4171ae; -webkit-transition: 1s; /* safari 3.1 6.0 */ transition: 1s; max-height: inherit; } but

angularjs - Allowing variable length arguments to Angular's $resource? -

here's issue, have multiple api calls make along lines of: www.domain.com/foo/bar?token=12345 there may more subdirectories in-between, there may less. i'm using $resource agentapp.factory('apifactory', function($resource) { return $resource('www.domain.com/v1/' + ':folder', { 'query': { method: 'get', isarray: true } }); which gets called follows: apifactory.query({folder: 'foo', token: '12345'}, function() {...}) i make more extensible have need change isarray value false , , amount of subdirectories in url unknown on occasion, i'd prefer not use $resource 's :token structure, , rather have 1 takes string. is there service create allow me make call follows: apiservice.query(urlstringandqueries, booleanforisarray).then(function(response) { ...do response }); so far i've attempted following, doesn't give me want, i'm not sure how $re

python - How to get Object as String in Django? -

i'm trying simple thing couldn't find how to. i have function defined in model class : def __unicode__(self): return "object name = " + self.name so in template page, or in views.py, want string. in template, tried these , didn't work : {{ my_object }} {{ str(my_object) }} {{ my_object.self }} what correct way of doing this? thanks ! there 2 functions __unicode__ , __str__ python class. str function, in template, calls __str__ . class object(object): name = "i'm object" def __str__(self): return "object name = %s" % self.name def __unicode__(self): return u"object name = %s" % self.name

javascript - Warning: Unable to write "..." file (Error code: UNKNOWN). Livereload option -

i want use grunt-contrib-watch livereload option. if change in file before opened browser compiles right. once opened browser no longer rewrites files. maybe problem because i'm using windows os? run server> while (true) {changing code - compiles fine} > run browser run server> run browser > changing code - unknown error. running "fest:templates" (fest) task compiling "templates/game.xml" "public_html/js/tmpl/game.js"...warning: unable write "public_html/js/tmpl/game.js" file (error code: unknown). use --force continue. here gruntfile.js : module.exports = function (grunt) { grunt.initconfig({ shell: { /*grunt-shell*/ options: { /*настройка задачи*/ stdout: true, stderr: true }, server: { command: 'java -jar 2dcontra-1.0-jar-with-dependencies.jar 8080' } }, fest: { /*grunt-fest*/ templates: { /*Подзадача*/ files: [{

ajax - Allow CORS in Ruby on Rails -

in config/application.rb file, have code, config.action_dispatch.default_headers = { 'access-control-allow-origin' => '*', 'access-control-request-method' => 'get, patch, put, post, options, delete' } but not allow me send post request route on sever safari gives error: http://localhost:3000/studentsfailed load resource: server responded status of 404 (not found) http://localhost:3000/studentsfailed load resource: origin http://localhost:4200 not allowed access-control-allow-origin. localhost:1xmlhttprequest cannot load http://localhost:3000/students. origin http://localhost:4200 not allowed access-control-allow-origi and in rails server console: started options "/students" ::1 @ 2015-03-28 21:00:45 -0500 actioncontroller::routingerror (no route matches [options] "/students"): i spent time working on , can tell reliable solution use rack-cors. see: https://github.com/cyu/rack-cors

mongodb - db.dropUser("user") returning false when logged in as root -

i logged in following: { "_id" : "admin.root", "user" : "root", "db" : "admin", "roles" : [ { "role" : "root", "db" : "admin" } ] } the following happens: > use mydb switched db mydb > db.dropuser("mydbreadwrite") false i suspect not have roles, root? it correct, user dropped before without notifying me(hmm...). returned false user did not exist.

java - How to reuse an executor objects after threads shutdown -

i have java 7 program parallel processes chunks of data , use executor service api create threads: pool = executors.newfixedthreadpool(size > 0 ? size : thread_max); and wait threads finish up: try { pool.shutdown(); // todo 60 seconds sufficient process route? pool.awaittermination(60l, timeunit.seconds); } catch (interruptedexception e) { e.printstacktrace(); pool.shutdownnow(); // todo consider rerunning handlehashes! } { release(); } but once termination happens, need re-instantiate executor. i'd rather reuse created threads after previous chunk of data has been processed. make profiling easier me. after .shutdown() how can reuse executor object , threads inside instead of re-instantiating? perhaps, there 3rd party executor apis have feature? maybe restructure program processing threads don't shut down. parent thread gives child threads data process. process , wait more data. don

windows - Download patches from WSUS for workgroup server -

my server not on domain cannot use group policy. read article update registry key on machine: https://serverfault.com/questions/316372/how-to-configure-workgroup-to-receive-updates-from-wsus i not wish change registry key on server, later on server join domain , download patches wsus using group policy. don't want registry key cause problem later on. is there way connect wsus without changing registry key on server? example, lets have registered server wsus, wsus knows ip address of server. can manually run command on server server downloads patches wsus? in opinion, if change couple of registry settings related updates not affect others services, easy undo. in case of interest drop configuration wsus using registry. windows registry editor version 5.00 [hkey_local_machine\software\policies\microsoft\windows\windowsupdate] "accepttrustedpublishercerts"=dword:00000001 "elevatenonadmins"=dword:00000001 "targetgroup"="your gr