Posts

Showing posts from July, 2013

javascript - sessionStorage setItem returns true or false -

i'm trying figure out setitem method sessionstorage returns. far get, following code returns undefined : var set = sessionstorage.setitem('foo', 'bar'); console.log(set); i need know if item set or if failed. how can accomplish without knowing return? take @ sessionstorage specification . this line: setter creator void setitem(domstring key, domstring value); tells setitem doesn't return anything. ( void return value, there) you can check if item set this: if (sessionstorage.getitem('myvalue') == null){ // myvalue not set }else{ // myvalue set }

Define twig function for template include -

i have quick question: i use project many different elements. have editable group them , include them template this: {% include '::fields/special.html.twig' {'avg': 'avgvalue','class':'test','value':'myvalue'} %} is there possibillity make shortcut function this, like: {{ special(fieldvalues) }} if so, how can that? create twig function like: <?php // src\bw\mainbundle\twig\bwextension.php namespace bw\mainbundle\twig; use symfony\component\dependencyinjection\containerinterface; class bwextension extends \twig_extension { protected $container; public function __construct(containerinterface $container) { $this->container = $container; } public function getfunctions() { return array( new \twig_simplefunction('special', array($this, 'specialfunction')), ); } public function specialfunction($fieldvalues) {

php - tinymce plugin to upload images -

i using plugin tinymce upload images (justboil.com) i uploading images on sub.domain.com/upload.php and upload folder located at domain.com/file_dump/tinymce_file_upload i have put in config $config['img_path'] = '/file_dump/tinymce_file_upload'; // relative domain name $config['upload_path'] = substr($_server['document_root'],0,-3) . $config['img_path']; // physical path. [usually works fine this] it gets document_root , removes 3 characters (for subdomain) sub folder sub domain located in public_html folder i getting error saying upload path invalid when try upload images your upload path looks '//' domain.com // file_dump/tinymce_file_upload so remove '/' $config['img_path'] $config['img_path'] = 'file_dump/tinymce_file_upload';

unit testing - Parameter count mismatch on stub with lambda expression using Moq -

i 'parameter count mismatch' targetparametercountexception when want test tenant repository: the interface: public interface itenantrepository { iqueryable<tenant> get(expression<func<tenant, bool>> filter = null, func<iqueryable<tenant>, iorderedqueryable<tenant>> orderby = null, string includeproperties = null); } the test code: var tenantrepository = new mock<itenantrepository>(); tenantrepository .setup(p => p.get(it.isany<expression<func<tenant, bool>>>(), it.isany<func<iqueryable<tenant>,iorderedqueryable<tenant>>>() , it.isany<string>())) .returns(new func<expression<func<tenant, bool>>, iqueryable<tenant>>(expr => tenants.where(expr.compile()).asqueryable())); tenant testtenant = tenantrepository.object.get( t => t.tenantid == tenant2.tenantid, null, null).firstordefault();

node.js - How to run sails.js application on port 80 with example? -

i have put sails.js in port 80, apache using it. how can put both (sails.js , apache) on same port 80? need because in company ports blocked except port 80. (this realtime application nodejs , socket.io (websockets) , in other side php application). lot you have run sails on free port (1337, example) , use apache mod_proxy . make sure it's loaded in apache config, virtual host this: <virtualhost *:80> servername www.youserver.com proxypass / http://localhost:1337/ proxypassreverse / http://localhost:1337/ </virtualhost> see mod_proxy documentation more details.

c++ - Dependency Walker shows up @x after function names -

i'm writing plugin dll piece of software , dll compiles fine, software not able access dll's functions. know software aware of dll though. when examine dll in dependency walker, function names have @x appended end, e.g. foo@4 means foo has 1 parameter (number of function parameters multiplied 4). however, when examine plugin dll known work dll functions not have @x appended @ end. since dll known work , dll not work, think has it. the dll works uses __declspec(dllexport) __stdcall on exported functions. note have source code of dll. know works because have dll file itself, haven't compiled myself. far know compiled in borland ide, it's eclipse specific problem here? does know might wrong and/or how can make dll work properly? edit should point out i'm using eclipse ide, mingw compiler. the names dependency walker shows true names. decorated names , presence of @<num> indicates __stdcall function exported __declspec(dllexport) .

xsockets.net - XSocket.net. how to send a message to a client from an object which is not a controller -

i have class starts server: public class socketserver { private static ixsocketservercontainer server = null; public socketserver() { server = xsockets.plugin.framework.composable .getexport<ixsocketservercontainer>(); } public bool startservers() { try { server.startservers(); return true; } catch { return false; } } this class has method: public void sendeventmessagetoallclients(string message) { xsockets.core.xsocket.helpers.xsockethelper .sendtoall<mycontroller>(new mycontroller(), message, "events"); } where mycontroller own controller, implemented , server can find , method work. now expand functionality new method allows me send event specific client: public void sendeventmessagetoclient(string clientid, string message) { xsockets.core.xsocket.helpers.xsockethelper .

facebook - Why does FB Insights API return different values but the same dates when segmenting by days_28 / week / day / lifetime? -

these 3 api calls return values same dates (jan-1st - jan-30th). /50813163906/insights/page_impressions_paid_unique/week?since=1388552400&until=1391144400 /50813163906/insights/page_impressions_paid_unique/day?since=1388552400&until=1391144400 /50813163906/insights/page_impressions_paid_unique/days_28?since=1388552400&until=1391144400 however values each date hugely different. /week gives {value: 635756,end_time:"2014-01-01"},,{value: 479251,end_time: "2014-01-02"},{value: 396633,end_time: "2014-01-03"}... /day gives {value: 110598,end_time:"2014-01-01"},{value: 458,end_time: "2014-01-02"},{value: 4,end_time: "2014-01-03"}... /days_28 gives {value: 411634,end_time:"2014-01-01"},{value: 407725,end_time: "2014-01-02"},{value: 403430,end_time: "2014-01-03"}... what these date segments supposed total , when when? i'm pretty sure values given totals end

Replace UrlEncodedFormEntity with stringEntity Android -

i want ask question setheader in android , trying modify setentity : httppost.setentity(new urlencodedformentity(params, "utf-8")); to : stringentity stringentity = new stringentity("name=value1&price=value2$=&description=value3", "utf-8"); httppost.setentity(stringentity); in sever , _post can't receive information util add header httppost : httppost.setheader("content-type","application/x-www-form-urlencoded;charset=utf-8"); i same httpurlconnection , change "name=value1&price=value2&description=value3" bytes write in outputstream , _post can receive information . why have setheader httppost ?

Comparing string with "enumeration" of strings in php -

i wanna compare string "enumeration", can simplier in solution bellow? first know enum type not implemented in php. problem question is: string s equal 1 of strings? since php don't have enum, values of enum in array or that. //$min_s string value of minute value example "15". if((strcmp($min_s, "00")== 0 || str_cmp($min_s,"15") == 0 || strcmp($min_s, "30")== 0 || strcmp($min_s, "45") == 0) { // ok} goal: make ifs more readable specific example , others in future when wanna compare string "enum". to answer question literally: $fifteens = array('00', '15', '30', '45'); if (in_array($min_s, $fifteens)) { ... } but use arithmetic: if ($min_s % 15 == 0) { ... }

asp.net - textbox in gridview needs rich text editing; superscript, greaterthanequalto etc -

i've got asp.net page vb.net backend. has gridview, , users need able edit values in it. it's dollar amount ranges entering, , need able add superscript numbers @ end on occasion. standard asp.net textbox not support these features, nor there way users enter greater or equal symbols. i'm looking straight forward solution, had been using fckeditor, incredibly clunky, , trying find more inline editing of ckeditor duration. the newer version of ckeditor seems built textarea, , not asp:textbox, gridview uses edit template field. know quick solutions getting functionality gridview edit mode textbox? additionally - settle end conversion, user enter "=<" , change appropriate symbol before storing in db... however, using httputility.htmlencode(strvalue.replace("=<", "&#8804;")) just gives me "&#8804;$500,000.00" worse... here's did solve this: had users enter "<=" or whatever ranges

windows - Optimize Disk Enumeration and File Listing C++ -

i writing c++ code enumerate whole hdd , drive listing, takes more 15 minutes complete disk enumeration of drives (hdd capacity 500gb). , compile response in binary file. however, have 3rd party executable gives me listing of whole disk in less 2 minutes ... can please code , suggest me performance improvement techniques. enumfiles(cstring folderpath, cstring searchparameter,win32_find_dataw *fileinfodata) { cstring searchfile = folderpath + searchparameter; cstring filename; hfile = findfirstfilew(searchfile, fileinfodata); // \\?\c:\* if (hfile == invalid_handle_value) { // error } else { { filename = fileinfodata->cfilename; if (fileinfodata->dwfileattributes & file_attribute_directory) { if (! (filename == l"." || filename == l".."

sql - Merge identical databases into one -

we have 15 databases of 75 tables avarage of million rows. same schema different data. have been given requirements client bring 15 1 database. each set of data filtered user’s login. the changes application have been completed filtering. left task of merging databases one. the issue conflicting pk , fk pk’s , fk’s of type int have 15 pk ids of 1. one idea use. net , dbml insert records new records new database letting linq deal pk , fk , using code deal duplicate data. what other ways there this? it's never trivial job integrate databases when records don't have unique primary keys in databases. few weeks ago built similar integration script decided use entity framework. first good news . ef's dbcontext api it's ridiculously easy insert complete object graph , make ef take care of newly generated primary keys foreign keys. reason why easy when object's state changed added all of adhering objects become added , ef figures out right order o

search - Is it possible to use vimgrep for a visual selection of the current file? -

i search vimgrep within visual selection of current file , not whole file. possible , how? couldn't find case google or in vim help. the reason why want because need result in quicklist ( copen ) , :g/foo showing matching lines @ bottom not doing job. yes, can, vim has special regular expression atoms mark positions, , start , end of visual selection marked '< , '> . there atoms on / before / after mark, need combine cover entire range of selected lines: on selection start | after selection start , before selection end | on selection end. to limit search current file, special % keyword used. :vimgrep/\%(\%'<\|\%>'<\%<'>\|\%'>\)foo/ %

elasticsearch - Logstash not parsing multiple named capture groups -

i have started playing around logstash, elasticsearch , kibana visualisation of logs , experiencing problems. i have log file being gathered logstash , want extract fields log entries before writing these elasticsearch. i have define filter number of named capture groups in logstash config file @ point first of named capture groups matching. my log file looks following: [2014-01-31 12:00:00] [field1:somevalue] [field2:somevalue] and logstash filter looks follwing: if[type] == "mytype { grok { match => [ "message", "(?<timestamp>regex)", "message", "(?<field1>regex)", "message", "(?<field2>regex)" ] } } i have verfied regexes fields correct when go kibana dashboard field1 , field2 not appearing. if shed light on grateful. thanks kevin grok's default behavior stop processing after first match. you can change setting break_on_match false:

objective c - How to define object within a line of code? (noob) -

sorry noob question, how can write in 1 line? nsinteger minuteinterval=5; [countdownpicker setminuteinterval:minuteinterval]; thanks this work: [countdownpicker setminuteinterval:5];

Solving simple string expressions (1+2*3) in Java [Almost Done] -

i'm trying solve simple string expressions e.g. 1+2*3/4, without brackets. i'm done simple integer part, above expression work perfectly, i'm stuck decimal values, example 1.1/2.2*4.4 want push whole decimal number stack (double), i'm working on quite time not quite getting it, appreciated. current code is: import java.util.stack; import java.text.decimalformat; public class evaluatestring { public static double evaluate(string expression) { char[] tokens = expression.tochararray(); decimalformat df = new decimalformat("#.##"); // stack numbers: 'values' stack<double> values = new stack<double>(); // stack operators: 'ops' stack<character> ops = new stack<character>(); (int = 0; < tokens.length; i++) { // current token whitespace, skip if (tokens[i] == ' ') continue; // curre

Create an empty symbolic matrix and predefine the dimension in Matlab? -

i want want string calculation using matlab, , stored value in matrix. for numerical study, predefined dimensions in matlab using zeros create 4*4 array. a = zeros(4) now want same thing symbolic matrix. zeros didn't work @ time. i tried copy official tutorial @ page http://www.mathworks.com/help/symbolic/sym.html a = sym('0' ,4) % error still didn't work. now have use ugly code this a = sym('[0 0 0 0; 0 0 0 0; 0 0 0 0; 0 0 0 0]'); since use iterations, , dimension of matrix grows every time. method not convenient. do have ideas? lot! num = sym(num) converts number or numeric matrix num symbolic form. a=sym(zeros(4,4))

html - Javascript return id of the element that triggert the event -

i have range of divs (projects) have display:none-ed overlay container inside of them, containing additional info. if mouse enters outer div, overlay container should recieve class making visible. on mouse leaving class should removed. solved using onmouseover="setactive('div id')", made code pretty messed tried switch eventlisteners. won't work though , can't figure out why. script far: // init eventlisteners each container window.addeventlistener("load", start, false); function start() { var project_containers = document.getelementsbyclassname('content-project') (var = 0; < project_containers.length; i++) { project_containers[i].addeventlistener("mouseover", setactive(), false) project_containers[i].addeventlistener("mouseout", setinactive(), false) } } // if mouse on container, add overlay_active class fun

java - Why are pseudorandom bits not cached when only one bit is used per "draw" (e.g. a call to nextBoolean)? -

i going through source code math.random , have noticed source code nextboolean() public boolean nextboolean() { return next(1) != 0; } calls new draw of pseudorandom bits, via next(int bits) "iterates" lc-prng next state, i.e. "draws" whole set of new bits, though 1 bit used in nextboolean . means rest of bits (47 exact) pretty wasted in particular iteration. i have looked @ prng appears same thing, though underlying generator different. since multiple bits same iteration used other method calls (such nextint() , nextlong() , ...) , consecutive bits assumed "independent enough" 1 another. so question is: why 1 bit used draw of prng using nextboolean() ? should possible cache, 16-bits (if 1 wants use highest quality bits), successive calls nextboolean() , mistaken here? edit: mean caching results this: private long booleanbits = 0l; private int c = long.size; public boolean nextboolean(){ if(c == 0){ booleanbits = nextlong

objective c - Live bytes growing with ARC over 200 MB on iPhone -

Image
when run iphone app instruments, shows live bytes growing when go , forth displaying modal view controller, app doesn't killed after using on 200 mb. what happening here? i'm consuming lot of memory? btw, using ios 7 arc. the image below shows live bytes. thank you. update: code in modal view controller - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"actioncell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; // configure cell... action *action = self.actions[indexpath.section][indexpath.row]; cell.textlabel.text = action.title; cell.textlabel.textcolor = self.sectioncolors[indexpath.section]; customcellbackgroundview *customcellbackgroundview = [[customcellbackgroundview alloc] init]; customcellbackgroundview.bordercolor = self.sectioncolors[indexpath.section]; cu

c# - How to bind innergrid in datagrid? -

basically new databinding here tried insert inner grid in each row displaying marks. can 1 me how achieve one. xaml code: <grid> <datagrid x:name="datagrid" autogeneratecolumns="true" rowdetailsvisibilitymode="visiblewhenselected"> <datagrid.rowdetailstemplate> <datatemplate> <datagrid itemssource="{binding marks}" autogeneratecolumns="true"/> </datatemplate> </datagrid.rowdetailstemplate> </datagrid> </grid> below code contains 2 classes 1 students , marks code: public partial class mainwindow : window { public mainwindow() { initializecomponent(); datagrid.itemssource = getstudentsinfo(); } private list<student> getstudentsinfo() { list<student> stdcoll = new list<student>(); stdcoll.add(new student() { id = 1, name = "a

javascript - button onclick dialog table -

i have jquery script: $(document).ready(function () { $( "#details" ).dialog({ autoopen: false, show: { effect: "slide", duration: 500 }, hide: { effect: "slide", duration: 500 } }); }); $(document).on('click' ,'.popup' , function() { $( "#details" ).dialog( "open"); }); i want appear table class details when <button class="popup" id="$row[0]"> clicked this jquery script not working. first throught needed document.ready() didn't help. try this: $(document).ready(function() { $('.popup').click(function () { $('.details').dialog('open'); // use instead; mentioned <div id="details"> in comment! $('#details').dialog('open'); }); }); since button class popup use . . and $(document).ready(function () { required when need lo

javascript - Disabling an iframe in a spoiler -

i've got question concerning html, iframes. english not native language , i'm kinda bad @ html, please have mercy (: so: have spoiler using tag: <script type="text/javascript"> function spoiler() { var st = document.getelementbyid('spoiler').style; st.display = (st.display == 'none' || st.display == '') ? 'block' : 'none'; } </script> <input value="open" onclick="spoiler();" type="button" /> <p id="spoiler" style="display:none;"> iframe </p> the iframe chatbox, want disable iframe while spoiler closed don't have hear sound time while not being in chatbox. know possibility? thanks lot! hiding in dom via style.display = 'none' hide it, if sound launch played. i advise remove dom , add if needed: removing child node in javascript to add have create iframe ,

mariadb - Replace Into Table in MySQL InnoDB extremely slow -

using mysql (mariadb exact though). have following script needs run every other day update database, it's unbearably slow. each table updated takes hours run. it's shell script: cmd_mysql="${mysql_dir}mysql --local-infile=1 --default-character-set=utf8 --protocol=${mysql_protocol} --port=${mysql_port} --user=${mysql_user} --pass=${mysql_pass} --host=${mysql_host} --database=${mysql_db}" ### update mysql data ### ## table name lowercase tablename=`echo $file | tr "[[:upper:]]" "[[:lower:]]"` echo "uploading ($file) ($mysql_db.$tablename) replace option..." ## let's try replace option $cmd_mysql --execute="load data local infile '$file.txt' replace table $tablename character set utf8 fields terminated '|' ignore 1 lines;" ## need erase records, not updated today echo "erasing old records ($tablename)..." $cmd_mysql --execute="delete $tablename datediff(timestamp, now()) < 0;" y

python - Writing a Function that Creates and Returns a List -

i trying write function creates , returns list of specified length, containing repetitions of specified value. i'm unsure of how function create list arguments inputted. appreciated! i'm not asking code written me, simple explanation of python functions should using or point me in right direction. code have far this, know wrong: def makelist(a,b): mylist = [] mylist = makelist return mylist edit: since said wanted use loop: >>> def makelist(a, b): ... mylist = [] ... _ in range(b): ... mylist.append(a) ... return mylist ... >>> makelist('a', 12) ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'] >>> makelist(3, 12) [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3] >>> actually, because solution quite short, easiest way explain demonstration: >>> def makelist(a, b): ... re

python - cygwin path usage. I just can't figure this out -

i'm using cygwin , trying run python script. when i'm in script's folder runs fine when try run using whole path doesn't work. following error no such file or directory this works ./prepare_receptor4.py this doesn't /cygdrive/c/program files/mgltools-1.5.6/lib/site-packages/autodocktools/utilities24/prepare_receptor4.py i know need escape space character doesn't work either /cygdrive/c/program\ files/mgltools-1.5.6/lib/site-packages/autodocktools/utilities24/prepare_receptor4.py this doesn't work either "/cygdrive/c/program files/mgltools-1.5.6/lib/site-packages/autodocktools/utilities24/prepare_receptor4.py" i'm going insane, don't it. please help. it better run python script in way. no ` . python /cygdrive/c/program\ files/mgltools-1.5.6/lib/site-packages/autodocktools/utilities24/prepare_receptor4.py . alias current folder. ./ means in current directory script. if use ./cygdrive/c/program\ files/

Cloud IDE for java? -

i’m developing code meant interact api of bitcoin exchange algorithm deciding whether buy or sell , all. however, can’t have laptop running 24/7, wondering, if there exist option, sort of online/cloud ide java, had workspace handle files, , run program me - possibly small fee? thank :) what looking how deploy java applet . here nice tutorial. http://docs.oracle.com/javase/tutorial/deployment/applet/index.html if want applet available anywhere, have embed on page hosted on internet . getting page hosted costs money, if don't host yourself, there thousands of well-known companies provide service. can't provide advice on 1 best, fear of being swallowed alive stackoverflow. once have page hosted, can embed java applet following tutorial. http://www.echoecho.com/applets01.htm

jquery - updating portion of asp.net MVc 4 view with partial view -

i working on asp.net mvc 4 application. have action link on main view this: @ajax.actionlink("get linkedin profile","linkedin", new ajaxoptions { updatetargetid="partialdiv", // <-- dom element id update insertionmode = insertionmode.replace, // <-- replace content of dom element httpmethod = "get" // <-- http method }) <div id="partialdiv"></div> and in controller, have action result performs redirection linkedin , returns action result. public actionresult linkedin() { return redirect("https://www.linkedin.com/uas/oauth2/authorization?response_type=code&redirect_uri=" + httputility.htmlencode("http://127.0.0.1:81/account/linkedinauthorized")); } now linkedinauthorized want return partialview or contents should inserted in partialdiv, doing this:

ios6 - IOS7 upgrade - Status bar not hiding on iPad -

hi i'm upgrading universal app ios6 ios7. i'm hiding status bar using inside .plist file: -> status bar hidden = yes -> view controller-based status bar appearance = no then inside appdelegate didfinishlaunchingwithoptions: added: [[uiapplication sharedapplication] setstatusbarhidden:yes withanimation:uistatusbaranimationnone]; [[uiapplication sharedapplication] setstatusbarhidden:yes]; the statusbar correctly hidden when running on: ios6 [iphone,ipad] ios7 [iphone] i have issues on ipad/ios7. can't hide here! any help? make sure xcode project not target iphone. in case, xcode project target iphone, , i'm building project in ipad 2x zoom non of hide statusbar solution worked me. here solution, change device type ipad under deployment info column. , apply this status bar hidden = yes view controller-based status bar appearance = no into info.plist

javascript - Single Threaded Event Loop vs Multi Threaded Non Blocking Worker in Node.JS -

node.js biggest advantage it's non blocking nature. it's single threaded, doesn't need spawn new thread each new incoming connection. behind event-loop (which in fact single threaded), there "non blocking worker". thing not single threaded anymore, (as far understood) can spawn new thread each task. maybe misunderstood something, advantage. if there many tasks handle, wouldn't non blocking working turn blocking worker? thanks christian you need read libuv , "magic" behind node's non-blocking i/o. the important thing take away libuv book libuv uses host os's asynchronous i/o facilities ; it not create new thread every connection. libuv tells os know changes (connection state, data received, etc) happen on particular set of sockets. os deal managing connections. os may create 1 or more threads accomplish that, that's not our concern. (and won't create thread every connection.) for other types of operations

fetching required data using joins in mysql -

my tables : mysql> select * professor; +-------+--------+--------+--------+------+ | empid | name | status | salary | age | +-------+--------+--------+--------+------+ | 1 | arun | 1 | 2000 | 23 | | 2 | benoy | 0 | 3000 | 25 | | 3 | chacko | 1 | 1000 | 36 | | 4 | divin | 0 | 5000 | 32 | | 5 | edwin | 1 | 2500 | 55 | | 7 | george | 0 | 1500 | 46 | +-------+--------+--------+--------+------+ 6 rows in set (0.00 sec) mysql> select * works; +----------+-------+---------+ | courseid | empid | classid | +----------+-------+---------+ | 1 | 1 | 10 | | 2 | 2 | 9 | | 3 | 3 | 8 | | 4 | 4 | 10 | | 5 | 5 | 9 | | 6 | 1 | 9 | | 2 | 3 | 10 | | 2 | 1 | 7 | | 4 | 2 | 6 | | 2 | 4 | 6 | | 2 | 5 | 2 | | 7 | 5 |

c# - pinvoke c function - System.BadImageFormatException -

im trying call c function c# im getting badimageformatexception. here c function header: extern "c" { __declspec(dllexport) bool validate(char key[]); } here how im calling c# [dllimport("mydll.dll")] static extern bool validate(char[] key); whats wrong here. when calling native methods, should compile c# code 64 or 32 bit explicitely. project/properties/build/platform target

payflowpro - PayPal Payflow: How to verify in one request, and then authorize in another without saving CC info? -

i'm building book store , building checkout using paypal payflow . checkout flow: shipping info --> billing info |verify cc using paypal| --> order summary --> submit |authorize cc using paypal| shipping info: fill out shipping address, nothing special here billing info: fill out billing address + credit card info. don't save credit card info since it's against standards, instead send cc number, expiration date, , cvv directly paypal verify. paypal approves. order summary: order sees summary of order before submits order. presses submit , request paypal sent authorize funds. however, cc info vanishes after #2, how persist data #3 can send paypal again? can use origid point pnref ? documentation says have full request whole params list (including cc info, cvv, exp date, etc). trxtype=a&tender=c&pwd=x1y2z3&partner=paypal&vendor=supermerchant&user=s upermerchant&acct=5555555555554444&expdate=0308&amt=123.00&comment

html - Reducing the height of my div element contiuned -

this question exact duplicate of: reducing height of div element i embedded style tag css , have added max-height:90% suggested div element still overflowing other elements. doing wrong??? hard without part of code... still possible guide bit can use css overflow proprety: myelement{ overflow-y : scroll; } or myelement{ overflow-y : auto; }

protocol buffers - sending binary body with Jmeter -

i'm using jmeter 2.10. i'm looking way send binary post body (protobuf payload) http request. clear - i'm not uploading file. maybe there way encode byte codes in body data textarea? thanks in advance! try http raw request sampler in jmeter plugin: http://jmeter-plugins.org/wiki/rawrequest/ . can via set of jmeter plugin: http://jmeter-plugins.org/wiki/extrasset/

css - replace content/icon when jquery accordion is active/open -

i'm trying replace + sign - when accordion active/open, got stuck doing it. @ moment i'm trying css :after if have better ideas, please share! jfiddle html <ul id="mobile-accordion-container"> <li> <h2 class="title">heading 1</h2> <div class="mobile-content"> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. phasellus dapibus varius urna, ac venenatis arcu convallis consequat. in augue est, posuere auctor facilisis varius, dictum ac risus. donec nibh justo, aliquam sed tempus quis, lobortis sed orci. aliquam condimentum, erat eget luctus commodo, mauris velit porta nulla, cursus placerat lectus tortor ac enim. phasellus scelerisque luctus ligula, consequat orci posuere rutrum. sed ipsum nisi, ullamcorper eget fermentum a, dignissim sed dolor. nam arcu nulla, aliquam non molestie vitae, condimentum @ lorem. nam et consectetur aug

homebrew - how to get my mac to use brew's installed python ? -

i think have 2 versions of python on system, correct steps and/or controls version of python system using ? can run python3 , py3 run, bu t should setup in general ? [jd@mbp ~]$ python --version python 2.7.5 [jd@mbp ~]$ ls /usr/local/cellar/python3/ ./ ../ 3.3.3/ [jd@mbp ~]$ you shall keep python pointing python 2.x install, whereas python3 points python 3. because there still applications and/or libraries system relying on fact python python2, , may things broken. in case can't run python3 command line, should make sure you've got /usr/local/bin in echo $path , if not: export path=$path:/usr/local/bin and can add ~/.bashrc . if still not have python3 callable command line, should run: brew link python3 that populate /usr/local/bin python3 installation's scripts, step being done automatically @ brew install python3 (just tested right now).

perl - How can I change a log4perl appender's filters at run time? -

i'v been trying figure out if can change appender's filter @ run-time i've defined via configuration file. log4perl.filter.m1 = log::log4perl::filter::levelmatch log4perl.filter.m2 = log::log4perl::filter::levelmatch log4perl.filter.m1.leveltomatch = info log4perl.filter.m1.acceptonmatch = true log4perl.filter.m2.leveltomatch = warn log4perl.filter.m2.acceptonmatch = true log4perl.filter.myboolean0 = log::log4perl::filter::boolean log4perl.filter.myboolean0.logic = m1 log4perl.filter.myboolean1 = log::log4perl::filter::boolean log4perl.filter.myboolean1.logic = m1 || m2 log4perl.appender.screen.filter = myboolean0 i'd change filter myboolean0 screen myboolean1 , after program has started running. poking @ appender_by_name hash screen using data::dumper shows following: $var1 = bless( { 'appender' => bless( { 'filter' => 'myboolean0',

angularjs - How do I toggle field required attribute after ng-click? -

i have dropdown list in repeater should toggle custom "required" attribute. tried ng-show display="none" attribute added. options are:- 1- add/remove input field , set bird.stuff, not hide because still required. 2- add/remove 'required' attribute on input field. js $scope.validateparticipants = function (type) { if (type == "single") { this.donation.participants = "1"; } else this.donation.participants = ""; } html <div ng-repeat="bird in animaltest.birds"> @(html.dropdownlist("type", (ienumerable<selectlistitem>)viewbag.birdlist, new { ng_model = "bird.type", ng_change = "validaterequired(bird.type)", required = "type required" })) ... <input data-ng-show="bird.type == 'endangered'" id="stuff" type="number" data-ng-model="bird.stuff" required = "number

javascript - Enforcing strict mode retroactively -

i'd enforce function level strict mode (i.e. toggle strict true in project's .jshintrc) on legacy javascript project. there way aside adding "use strict"; line @ start of every single function in project? for project (new or old) seems lot of avoidable boilerplate. how people (if @ all) typically handle it? ...aside adding "use strict"; line @ start of every single function in project? yes, can add @ top of every file in project (this "code compilation" level); applies functions within file (code compilation unit). this true inline script in web pages, fwiw, e.g.: <script> "use strict"; // strict mode code function foo() { // } </script> <script> // isn't </script>

.net - How can I figure out why MSMQ messages are not being delivered? -

i have application reads message queue, work message, submits message output queue. let's call sender side. i use dedicated server msmq. let's call server side. the problem messages never shows in output queue. i've enabled end2end logging on sender , server. in sender side says "message sent on network", , in queue server side says "message came on network". message leaves sender, , received server, not put in output queue. in code (.net 4.5.1) i've tried enabling dead letter journal-ling. here's code sending message: // enqueue object. public static void enqueueobject(object obj, messagequeue queue) { using (message msg = new message(obj, queue.formatter)) { msg.usejournalqueue = false; msg.usedeadletterqueue = true; lock (queue) queue.send(msg); } } i find messages show in journals of other queues earlier in process, nothing shows in dead letter journals of sender or server.

linux - How to flush out the Shared function data from CPU cache -

i creating shared data 2 processes , after reading data cpu cache, want flush out shared function data cpu cache. able find starting address of particular shared data in cache memory unable find last address. i can flush address using clflush(address) cpu cache. challenge how flush function , , know starting address of function. is there way find last address of shared data/function in cpu cache? using gcc under linux.

c# - ExecuteReader: Connection property has not been initailized -

the error executereader: connection property has not been initialized giving me fit. think have set right. show how create mssql connection , requesting, , class created read/write , open/close connection. (three different parts of app lumped them see actual logic flow hope.) what missing, or supposed put connection? example? appreciate help! here using statement start with: using (mssql mssqldb = new mssql(constants.mssqlserver, constants.mssqldb, constants.mssqluid, constants.mssqlpswd)) here "hey, me data using mssql class" using (var results = mssqldb.read("select top 1 * alertlog order alarmid desc")) { results.read(); legacyalert = int32.parse(results["alarmid"].tostring().trim()); } here mssql class class mssql : idisposable { public mssql(string server, string database, string uid, string pswd) { string mssqlconnectionstring = @"data source=" + server + ";initial catalog=" + database

objective c - CGContext Erase Error -

i keep getting error: jan 31 13:56:51 michaels-macbook-air.local cocoadrawing[2129] <error>: function 'cgcontexterase' obsolete , removed in upcoming update. unfortunately, application, or library uses, using obsolete function, , thereby contributing overall degradation of system performance. my program doesn't call method directly, , frustratingly, can't find documentation on function. this happens blank (cocoa) xcode project. why getting error? i had problem. caused outdated wacom tablet driver. if have such driver installed i'd recommend removing it, reinstalling more recent driver. did trick me.

c# - Send Object as parameter to Dll function -

i have class library (dll) holds operations reports. dll needs object fill desired report. the problem can't convert object main .exe same object in dll. [a]mymainexe.model.myobject can't converted [b]myclasslibrary.model.myobject type cames 'mymainexe', version=1.0.0.0, culture=neutral, publickeytoken=null' in context 'default' @ 'c:\fakepath\dummyname.exe'. type b cames 'myclasslibrary', version=1.0.0.0, culture=neutral, publickeytoken=null' in context 'default' @ 'c:\fakepath\dummyname.dll' i'm trying pass this: doworks(myobjectname); and receive this: public void doworks(object myobject) { myobject thing = (myobject) myobject; //do } i know how pass using array or list why can't objects?/what doing wrong? since both objects of same name different namespace, think have serialize/deserialize object mymainexe.model.myobject xml/binary myclasslibrary.model.myobject

c# - Work backwards from an xslt to create an xml -

so, have quite few xslt files need generate preview for, not have corresponding xml files. wondering if possible go through xslt file , create list of required fields xslt? example, <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title" /></td> <td><xsl:value-of select="artist" /></td> </tr> </xsl:for-each> </xsl:template> </xsl:stylesheet> i want go xslt this: "/catalog/cd/title, /catalog/cd/artist" fields required xslt, or set default value of them outputs "/catalog/cd/title" title , "/catalog/cd/artist" artist. just give shot, won't work multiple templates: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/t

Changing text input size with Zurb Foundation (Rails 4.0) -

Image
i attempted following: <%= f.text_field :text, :style => "font-size:40px"%> this increases font size, not input box without foundation. there way within foundation without changing global default? i want 1 input field. if not mistaken, think can set size. try <%= f.text_field :text, :size => 20 %>

Trouble setting plot axis limits with matplotlib / python -

Image
i have code: def print_fractures(fractures): # generate ends line segments xpairs = [] ypairs = [] plt.subplot(132) in range(len(fractures)): xends = [fractures[i][1][0], fractures[i][2][0]] yends = [fractures[i][1][1], fractures[i][2][1]] xpairs.append(xends) ypairs.append(yends) xends,yends in zip(xpairs,ypairs): plt.plot(xends, yends, 'b-', alpha=0.4) plt.plot() plt.xlabel("x coordinates (m)") plt.ylabel("y coordinates (m)") plt.ylim((0,400)) def histogram(spacings): plt.subplot(131) plt.hist(np.vstack(spacings), bins = range(0,60,3), normed=true) plt.xlabel('spacing (m)') plt.ylabel('frequency (count)') #plt.title("fracture spacing histogram") def plotci(sample, cihigh, cilow, avgints): plt.subplot(133) plt.plot(sample,cihigh) plt.plot(sample,avgints) plt.plot(sample,cilow) plt.legend(['m

xmpp - How can I tell the difference between the JID of a user and a JID of MUC? -

suppose have 2 jids: jid 1: bob@example.com jid 2 room@chat.example.com jid 2 refers chat server, chat server isn't going have word chat or conference in it. is there way, using smack libraries, tell 1 which? you cannot tell looking @ jid. have keep enough context in given protocol exchange know talking to. typically on startup, client send disco#items query server: <iq type='get' to='shakespeare.lit' id='items1'> <query xmlns='http://jabber.org/protocol/disco#items'/> </iq> to find of local services, send disco#info query each of services find out more service. once find muc server : <iq from='chat.shakespeare.lit' type='result'> <query xmlns='http://jabber.org/protocol/disco#info'> <identity category='conference' name='shakespearean chat service' type='text'/> <feature var='h

sql - freebase query with inner joins on the statment -

can create inner join on free base use other query.. i try create join between 2 querys: the first, select artist genre same nirvana without nirvana: [{ "id": null, "name": null, "name!=": "nirvana", "type": "/music/artist", "genre": [{ "name|=": [ "punk rock", "grunge", "alternative rock", "rock music", "hardcore punk" ] }] }] the second, select genre of nirvana: [{ "name": "nirvana", "type": "/music/musical_group", "/music/artist/genre": [] }] i want create query not work.. [{ "id": null, "name": null, "name!=": "nirvana", "type": "/music/artist", "genre": [{ "name|=": [{ "name": "nirvana", "type&

java - How to use Hash of a passphares to encrypt -

so basically. want use hash of passphrase encrypt masterkey. moment code used this try { //conservazione delle chiavi! //secure prng securerandom m = securerandom.getinstance("sha1prng"); //secure hash messagedigest hash = messagedigest.getinstance("sha-1"); //keygenerator keygenerator keygenerator = keygenerator.getinstance("des"); keygenerator.init(m); //want obtain random masterkey need encrypt key key = keygenerator.generatekey(); //get des cipher cipher cipher = cipher.getinstance("des"); //and now? cipher.init(cipher.encrypt_mode, key); // that's problem. } catch (nosuchalgorithmexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (nosuchpaddingexception e) { // todo auto-generated catch block e.printstacktrace(); } the key hash of pa

node.js - Is possible to bind to express callback promise? -

is possible bind express callback promise ? var express = require('express'); var app = express(); app.param('test', some_function); and have function has functionality of som_function returns promise. how bind promise url ? you have wrap function has signature required express. var express = require('express'); var app = express(); app.param('test', function (req, res, next, id) { some_function().done(function (err, data) { if (err) { res.send(500); // boo return; } next(); // yay }); });

javascript - How to asynchronously do multiple REST API requests in node.js? -

what want do multiple remote rest api requests, want each request done sequentially, 1 after another. read async.js way this. as not know how many times have request, using async.whilst() . idea stop requesting once api returns 0 posts. here code far (for testing purposes limited loop run 5 times only). var request = require('request'); var async = require('async'); var apikey = 'api-key-here'; var = 0; var continuewhilst = true; async.whilst( function test() { return continuewhilst; }, dothiseverytime, function (err) { // done } ); function dothiseverytime(next) { requrl = 'http://api.tumblr.com/v2/blog/testsite.com/posts/text?api_key=' + apikey + '&offset=' + i*20; request( requrl, function (err, resp, body) { if(!err && resp.statuscode == 200) { var resultasjson = json.parse(body); console.log(requrl); console.log("request #" + + "

php - Eloquent and Pivot Tables in Laravel 4 -

i have poll table, students table, , pivot table between them includes token , 3 votes. public function students() { return $this->belongstomany('student', 'polls_students')->withpivot('token','first','second','third'); } while working out saving poll results, came across odd behavior don't quite understand. i'm hoping can explain i'm missing: $poll = poll::find(input::get('poll_id')); foreach($poll->students()->where('students.id', '=', input::get('student_id'))->get() $student){ var_dump($student->pivot->token); } $student = $poll->students()->where('students.id', '=', input::get('student_id'))->get(); var_dump($student->pivot->token); in above code, foreach loop display token, second 1 throws exception undefined property: illuminate\database\eloquent\collection::$pivot