Posts

Showing posts from August, 2013

html - how to change single li element in a menu using lists? -

i created navigation bar @ website using in-line list , has been styled. each <li> same want last 1 have different size wish change width , padding of it. i have no idea how able this, i've tried multiple ways experienced lots of problems along way. tried adding styling in <li> tag on html page, changed absolutely nothing, tried using last-child selector worked extent. allowed me change padding of not width. didn't change last 1 first one. css: .dropdown{ position: relative; margin: 0 auto; float: right; top: 20px; font-size: 13px; } .dropdown li { float: left; width: 155px; background-color:#373737; position: relative; border-bottom:1px solid #575757; border-top:1px solid #797979; } .dropdown li { display: block; padding: 10px 8px; color: #fff; position: relative; z-index: 2000; text-align:center; } .dropdown li a:hover, .dropdown li a.hover{ background: #cf5c3f; position: relative; } .dropdown :last-child li a{ padding: 0px; w

mysql - After filling in the form I dont receive anything back. [PHP register/login] -

you dont need anymore: * after filling in form dont receive site. tried fill in random letters doesnt answer passwords doesnt mach or so. made mysql table this: img url: http://i.imgur.com/gyc6flf.png me? skip ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ edit: i found new script login script seems working fine. register doesn't work here. doesn't tell if dont fill in field. nothing if fill fields in. skip (new) register.php <? session_start(); ?> <font face=verdana size=1> <? if($_session['login'] == "true"){ print " have allready account.";//because logged in stupid } include('connect mysql database link'); if(!isset($_request['submit'])){ ?> <form method=post acion=""<? $_server['php_self'] ?>""> <table> <tr> <td> <font face=verdana size=1>username: </td> <td> <input type="text

node.js - How to use Poet with Node, Express and EJS template engine -

i discovered poet blog engine , know how use ejs template engine. also, documentation, don't understand how create new post, in format, , how it's rendered in webpage. there's old pr examples using ejs instead of jade. it's pretty examples in examples/ dir , except change express' view engine ejs , use ejs templates instead.

linear layout is not working in android.got error of The markup in the document following the root element must be well-formed -

this code of linear layout in android when tried use multiple linear layout got error of "the markup in document following root element must well-formed". <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:orientation="horizontal" tools:context=".mainactivity" > <edittext android:id="@+id/edit_message " android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android

c# - Click on dynamically generated element after body onload using Selenium -

Image
i'll best convey situation date can give limited. there button inside webpage when clicked creates new tab html source below. <html><head><meta content="ie=5.0000" http-equiv="x-ua-compatible"> <title>report viewer webpage</title> <meta content="text/html; charset=windows-1252" http-equiv=content-type> <script src="javascript1.js"></script> <script src="javascript2.js"></script> <script src="anotherjavascript.js"></script> </head> <body onload="callinit('abc_defg_hijkl_1_',''); window_onload();" onhelp=common_showhelp() leftmargin=0 topmargin=0 bgcolor=#c6c6c6 currjshelpvar="help_reports_viewer_dlg"> <object id=crviewer codebase="/viewer/activexviewer/activexviewer.cab#version=9,2,0,442" classid=clsid:1123452wduihed:1325726gdujbea:12r432vd width="100%" height="99%&quo

Segmentation fault caused in perl script from regex -

i'm executing perl script runs tests in root directory , subdirectories of script. reason though i'm getting segmentation fault when test in sub directory. know has regex code it's stipping out before last / , leaving file. use strict; use warnings; @files = glob("*.hml"); push(@files, glob("*/*.hml")); use file::compare; $hml = $hml . '/thing.exe '; $int = 0; @failedtests = qw(); print "running $hmlfile ... :: "; if ($hmlfile =~ s:.*/([^/]+):$1:){ } $file = substr($newhmlfile, 0, index($newhmlfile , '.')); $log = $file . '.log'; $cmd = $hml . $newhmlfile; $cmd = $cmd . ' > ' . $log . ' 2>&1'; system ($cmd); $reflog = 'reflogs/' . $file . '.log'; if (compare($log, $reflog) == 0) { print "$hmlfile passed\n"; unlink $log; } else { $int++; push(@failedtests, "$hmlfile

jsf - Why is my function not found? -

here code <html (...) xmlns:of="http://omnifaces.org/functions"> ... <c:set var="formatteddate" value="#{of:formatdate(now, 'dd/mm/yyyy')}" /> when run it, error: value="#{of:formatdate(now, 'dd/mm/yyyy')}" function 'of:formatdate' not found javax.faces.webapp.facesservlet.service(facesservlet.java:606) here pom.xml ... <dependency> <groupid>org.omnifaces</groupid> <artifactid>omnifaces</artifactid> <version>1.7</version> </dependency> here web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="

php - Apache2 setting up mod_rewrite and restricting access without .htaccess file -

i following tutorial: http://www.phpro.org/tutorials/model-view-controller-mvc.html the tutorial states should use htaccess file. however, apache2 documentation advises enter .htaccess rules standard configuration files better performance. i'm working in /etc/apache2/sites-available/default . this have far: <directory /var/www/> options indexes followsymlinks multiviews allowoverride order deny,allow deny </directory> <directory /var/www/> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?rt=$1 [l,qsa] </directory> <location /index.php> order allow,deny allow </location> with these rules, index.php accessible, index.php?rt=blog still works, , index/blog or /blog not. doing wrong? but index.php?rt=blog still works you don't have rules make doesn't work and index/blog or /blog not you don't have rules make

php - What is the quickest way to check invalid login attempts in Symfony2 FOSUserBundle? -

i using fosuserbundle in symfony2 handle user registration , authentication. want lock out user accounts after 3 invalid login attempts . so, quickest way check invalid login attempts in symfony2 fosuserbundle? solution far maybe have define $attempts attribute on user object identify invalid login attempts count. can use authenticationhandler class handle login attempt ( using onauthenticationsuccess() , onauthenticationfailure() )

Sharepoint 2013 : some REST API's are not working -

i have sharepoint 2013 server on created site , shared demo users. users can activities adding conversation , replying it. other activities "like", "follow", etc available. but when try fetch data using rest api's doen't work. some api works (like "social.following/my/followers") , doesn't (like "social.feed/my/likes", "social.feed/my/feed") kindly me , let me know if missing anything.

opengl - 4D and GLSL, are there any support for matrix 5x5? -

i want transform , project on screen 4d graphics glsl vertex shader. have matrix 5x5 , 5d vectors support or extensions it? , if not, how send 5x5 matrices , etc shader? no, glsl has 2-, 3-, , 4-vectors , equivalent matrices ( https://www.opengl.org/wiki/data_type_%28glsl%29#matrices ). if want 5x5 matrices sent shader can defining structs of floats or doubles , passing them uniforms, or if need lot, share them buffer of floats , read them in groups of 25. keep in mind though you'll need implement math functions need these types yourself.

CSV file cannot be accessed via BufferedReader in Android -

i trying read csv file using bufferedreader in android. program works fine in java when try read data android following error get. 01-31 17:09:58.466: w/system.err(15912): java.io.filenotfoundexception: /users/sabbir/documents/workspace/testcsv/src/file/input.csv: open failed: enoent (no such file or directory) following code using here. public double getlongitudes() { bufferedreader br = null; string line = ""; string cvssplitby = ";"; string[] nextline; double longitudes = 0; try { br = new bufferedreader( new filereader( "/users/sabbir/documents/workspace/testcsv/src/file/input.csv")); while ((line = br.readline()) != null) { // use comma separator string[] country = line.split(cvssplitby); longitudes = double.parsedouble(country[5]); log.d("worked", "worked"); // system.out.println("latitude &qu

python - Find root of a function in a given interval -

i trying find root of function between [0, pi/2] , algorithms in scipy have condition : f(a) , f(b) must have opposite signs. in case f(0)*f(pi/2) > 0 there solution, precise don't need solution outside [ 0, pi/2] . the function: def dg(thetaf,psi,gamma) : return 0.35*((cos(psi))**2)*(2*sin(3*thetaf/2+2*gamma)+(1+4*sin(gamma)**2)*sin(thetaf/2)-‌​sin(3*thetaf/2))+(sin(psi)**2)*sin(thetaf/2) based on comments , on @mike graham's answer, can check change of signs are. given y = dg(x, psi, gamma) : x[y[:-1]*y[1:] < 0] will return positions had change of sign. can iterative process find roots numerically error tolerance need: import numpy np numpy import sin, cos def find_roots(f, a, b, args=[], errtol=1e-6): err = 1.e6 x = np.linspace(a, b, 100) while true: y = f(x, *args) pos = y[:-1]*y[1:] < 0 if not np.any(pos): print('no roots in interval') return roots err = np.a

python - startup files inheritance in ipython -

suppose have ipython profiles , b. both define own configuration files ( a/ipython_config.py , b/ipython_config.py ) , startup files ( a/startup/startup.py , b/startup/startup.py ). want b inherit stuff, in b/ipython_config.py include following line: load_subconfig('ipython_config.py', profile='a') that's fine. startup files part couldn't find useful hint. know how it? there's no official support running startup files profile, can make startup script find files in profile_a/startup/ , execute them.

history.js - Best way to pass a single-use value between requests using JavaScript -

i need trigger page reload, via js, preserving vertical scroll position. i'm using solution described in another question : calculate current scroll position add current position querystring argument, redirect when page reloads, read value querystring & adjust scroll pos however, i want restore scroll position on first redirect . if user scrolls around page , triggers manual reload using ctrl-r, not want re-scroll saved position. is there way of passing single-use, visible-to-the-next-request-only value using javascript? or removing value document.location.href without redirecting? should using html 5 history api "clear" position value after i've consumed it? save value sessionstorage. once use it, delete value cannot read on manual refresh. sessionstorage.setitem("scroll_position", "300"); sessionstorage.getitem("scroll_position"); // 300 sessionstorage.removeitem("scroll_position"); sessi

javascript - Jquery dynamic image change from selection -

trying create nice dynamic selection process. there 2 parts selection process: choose category, choose name. form process works fine. want display image based on name chosen. can't seem figure out, here's code: <form action="file.php" method="post"> <select id="first-choice" name="cardset"> <?php foreach ($data $row): ?> <option><?=$row["name"]?></option> <?php endforeach ?> </select> <select id="second-choice" name="card"> <option>please choose above</option> </select> <img src="" name="image-swap"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script language=javascript > $(document).ready(function() { $("#first-choice").change(function() { $

Instantiate an stdClass object from json schema specification in PHP -

i have set of json requests must send restful api in order response objects, know, usual thing webapp, these api request objects documented json schema specification each, load schema files , create stdclass object instances based on info automagically . is there way library or in php? (don't want reinvent wheel) thanks! edit: have @ this schema file contains example of want load , build object instances from. disclaimer: know json_encode / json_decode not i'm looking for. using i'd need traverse through returned schema object , create object/array based on schema read, not want. i don't think there's built-in way of doing this, should relatively trivial implement: function createobj( $json ) { $obj_schema = json_decode($json, true); $new_obj = new stdclass; foreach($obj_schema['properties'] $property) { $new_obj->{$property} = null; } return $new_obj; }

javascript - Hashchange to show divs -

i have number of divs on page, hidden default. jobs can selected links (to "#job8, example). i'm trying use hashchange in script check url specific hash , display appropriate div. this example div <div class="job-details" id="job8" data-jobid="8"> <p>job 8</p> </div> this script. $(document).ready(function(){ $('.job-details').hide(); }); $(window).bind('hashchange', function() { if (location.hash.substring(0,4) == "#job"){ var jobid = location.hash.substring(0); $('.job-details').hide(); $('[data-jobid="' + jobid + '"]').show(); } }); your line: var jobid = location.hash.substring(0); assigns '#' jobid . presumably isn't want? want: var jobid = location.hash.substring(4);

c - Running multiple concurrent GMainLoops -

are users of glib allowed run multiple gmainloop instances concurrently in multiple threads, each thread running own instance? i've found "yes" , "no" answers on place. realize question has been asked before in forum (december 2011) . however, able run 2 gmainloop instances @ same time without apparent issue. test code simple: create gmainloop in main() create timeout source default context , main loop using g_timeout_add create gthread in main() run main loop using g_main_loop_run [thread context]: create context using g_main_context_new [thread context]: set context thread default using g_main_context_push_thread_default [thread context]: create loop using g_main_loop_new , give new context [thread context]: create timeout source, , attach new context via g_source_attach . [thread_context]: have thread invoke g_main_loop_run doing this, see both instances of gmainloop working fine. timeout callbacks invoked corre

php - Is it a bug that 'assert' ignores the current namespace? -

should following problem considered normal behavior or bug? <?php namespace ns; function func () { echo "hello\n"; return true; } func(); // ok assert('func()'); // "call undefined function func()" assert assume behaving same way eval in switches execution global namespace when code passed evaluated. specifying namespace in call works expect: <?php namespace ns; function func () { echo "hello\n"; return true; } func(); // ok assert('ns\func()'); i believe normal behavior; assert built in function, , you're passing string evaluated. when execution passes inside of assert function, in different namespace (mainly global namespace).

plsql - Does converting Oracle .rdf files to .rep do anything different than changing the extension? -

i'm using oracle forms , reports 11g. when told how compile reports (the .rdf files) told convert them .rep files. didn't think check in report builder conversion tool, went , renamed extension of file. it turns out else goes reports builder, , exports .rdf file .rep file. i'm wondering if doing way somehow different renaming extension i've been doing? yes does. .rdf definition format of oracle reports. .rep compiled format of oracle reports. the runtime can execute both. running .rep files bit faster, because precompilation done.

why should we use native php gettext instead of gettexxt library -

i'm including gettext library in application. but, our team decided go native php gettext. gettext library accepts string , converts using "translate" function defined in library. how can shift native lib? performance? suggestions on using native lib. in advance. it performance , ease of use. when use external library inside php using system() e.g., pros able use of options, make power user. cons that, each time run it, have parsing of return string , figure out results , stuff, hassle , pretty error prone. when use language-binding of external library, cons confined api calls binding provides. pros return values, error status etc defined within api calls handling calls easier. this tradeoff , vary case case whether 1 should use native interfaces or execute library directly.

javascript - How to replace html button with plain text -

how replace button whatever words on button before? looking @ answer similar question, said use like: var mybtn = document.getelementbyid("buttonid"), myspan = document.createelement("span"); myspan.innerhtml = mybtn.innerhtml ; mybtn .parentnode.replacechild(myspan, mybtn); but had made other buttons change. know way change button regular text? i know that code works itself, doesn't work code reason, don't care what's wrong code. i'm wondering if knows way it. thanks <!doctype html> <head> <title></title> </head> <body> <div id="mydiv"> <input type="button" value="change text" id="submit" onclick="change()"> <!--button input trigger event named change--> </div> </body> </html> <script type="text/javascript"> function change(){ //function run when click on button... var

iis 7 - ASP.NET application, long delay in IIS in AuthenticateRequest -

we have http module measures how long server requests spend in individual states. in 1 of our servers see requests take large amount of time in authenticaterequest state - seconds, minutes. this windows 2008, iis 7, integrated pipeline, .net 3.5 asp.net application we not use authentication. "anonymous authentication" 1 enabled. any suggestion @ appreciated.

doctrine2 - zf2 doctrine 2 - Output OnetoOne Unidirectional -

after annotating onetoone unidirectional, want output joined column, without using form. one people entity has got column store id of country entity. what can do: can store id of country people entity using form dropdown select, bound country entity. problem: can not enter value country of the, correct, joined table. people entity: <?php namespace people\entity; use doctrine\orm\mapping orm; // ... /** * people entity. * * @orm\entity * @orm\table(name="icd_people") * @property int $id // ... * @property string $ic_hq_country */ class people implements inputfilterawareinterface { protected $inputfilter; /** * @orm\id * @orm\column(type="integer"); */ protected $id; /** * @orm\column(type="integer") * @orm\onetoone(targetentity="country") * @orm\joincolumn(name="ic_hq_country", referencedcolumnname="id") */ protected $ic_hq_country; // getter , setter } the country entity: <?php namespace people\e

c# - Using dictionary to convert string to char -

i've got code static string wordmap(string value) { var strings = value .select(c => { string word; if (!wordmap.trygetvalue(c, out word)) word = c.tostring(); return word; }); return string.join("", strings); } and dictionary - static dictionary<char, string> wordmap = new dictionary<char, string>() { {'a', "alpha"}... } but instead of turning char words, want opposite. because i'm real beginner, couldn't figure out. i saw there confusion meant so: //i want input = alpha beta gama dalta output = abgd //i input = alpha beta gama dalta output = alpha lama pyhton hexa alpha... it looks want reverse mapping string char. assumes you've done work static dictionary<char, string> wordmap = new dictionary<char, string>() { {'a&

javascript - How to save a part of a HTML page to the user's computer -

i want let user save pre-defined part of website computer in pdf format different css styles applied. i have done same printing, couldn't find examples saving. how go doing this? the specific parts in respective divs , ids. thanks you'll need library this. depending on language you're using, there's lot of possibilities. google chrome print pdf html. give more details project

C# - List to hold hold multiple object types inherited from the same base class -

in below example able put instances of standardcar or racecar carcollection list cast them correct data type loop through carcollection list. i understand not possible in c#. can't find way around doesn't involve 1 class has attributes in single class. since numberofraces applies racecars seems messy having way? i'll know if i'm working standard cars or race cars when loop through collection. below if put standardcar list, loop through list , cast standardcar cast exception. note actual final class lot more complicated below. class car { public string name {get; set;} } class racecar : car { public int numberofraces {get; set;} } class standardcar: car { public bool childrenincar {get; set;} } class carcollection { list<car> collection {get; set;} } thanks help. it possible, can add list normal, cast need test types of car returned: // create cars racecar rcar = new racecar(); standardcar scar = new standardcar(); //

javascript - Problems Loading JSAPI from Google -

Image
we're using google's jsapi in our webapp (linked, not locally hosted). users have no problem. few, though, seem javascript doesn't load them. none of jsapi-dependent functions fire. when user clicks direct link api ( https://www.google.com/jsapi ), gets download / save window this: any thoughts might screwing here? browser setting? include jsapi in script block, not dynamically -- basic: <script type="text/javascript" src="https://www.google.com/jsapi"></script> thanks! you maybe calling api secure page i.e. https page.jsapi being called on https if in browser inspector see dynamically calling google input tools page http.most web browsers don't load such mixed content.

git - Remove a large file from GitHub repo -

this question has answer here: how remove/delete large file commit history in git repository? 13 answers i trying push local repo private github , got error saying file size exceeded 100mb. understand. don't need file, deleted if repository (actually deleted computer). when went push repository again (without large file since had been deleted) same error file deleted computer. added gitignore file. not sure why file still causing issues has been deleted computer. since have committed large file, in git history, , deleting not - git keeps should ever want rewind commit. what need rewrite history. easiest way kill last commit is: git reset --hard head~ if not last commit, may need kill more, or use git filter-branch . can find more rewriting history in git documentation .

sql server - SQL To Text Box -

simple enough, i'm trying take information out of column in sql database members_id equal integer users inputs textbox. sendfromid.text textbox containing members_id current_points textbox want hold/show sql column info u_g_studio sql column holding data only 1 row can match members_id it's primary key. this far i've managed code; after lost. if provide example in code i'd appreciate it. stcon = "connection string;" con = new sqlconnection(stcon) con.open() dim cmd new sqlcommand("select u_g_studio personsa members_id ='" & sendfromid.text & "'", con) cmd.commandtype = commandtype.text {edit 1} just want clarify, need download data from sql column into texbox. try this. using automatically takes care of disposing resources. parameterize query avoid sql injection attacks. stcon = "connection string;" dim strugstudio string dim sql string = _ "

string - What is the equivalent of stringByFoldingWithOptions:locale: in Java? -

i looking way normalise list of titles. title normalized stored in database sort , key. "normalize" means many things such converting lowercase, removing roman accent character, or removing preceding "the", "a" or "an". in ios or mac, nsstring class has stringbyfoldingwithoptions:locale: method folding version of string. nsstring class reference - stringbyfoldingwithoptions:locale: in java, java.uril.collator class seems useful comparing, there seems no way convert such purpose. you can use java.text.normalizer comes close normalizing strings in java. though regex powerful way manipulate strings in whichever way possible. example of accent removal: string accented = "árvíztűrő tükörfúrógép"; string normalized = normalizer.normalize(accented, normalizer.form.nfd); normalized = normalized.replaceall("[^\\p{ascii}]", ""); system.out.println(normalized); output: arvizturo tukorfurogep mor

PHP LI Form Post and return Value -

i stuck on last bit of have list , when 1 clicked form submits. dont understand how value of item clicked. how can echo or put variable use? or there better way achieve this? <head> <script type="text/javascript" language="javascript"> function submit(target) { document.forms['myform'].elements['target'].value = target; document.myform.submit(); } </script> </head> <body> <form name="myform" method="post"> <li><a href="#" onclick="submit('a');">a</a></li> <li><a href="#" onclick="submit('b');">b</a></li> <li><a href="#" onclick="submit('c');">c</a></li> <input name="target" type="hidden" value=""/> </form> </body> ok tried follo

c - Saving data from a file into arrays -

i trying scan in information: 00abcabc:abc123 01defdef:def456 02hijhij:hij789 into 2 arrays using code: file *datalogin; int i=0, numrecords; char username[100][10], password[100][10]; datalogin = fopen("login.dat", "r"); if (datalogin == null){printf("error");} else { while (fscanf(datalogin, "%s:%s\n", username[i], password[i])){i++;} fclose(datalogin); numrecords = i; for(i = 0; < numrecords; i++){printf("%s, %s\n", username[i], password[i]);} } printf("complete"); the program compiles , runs doesn't display anything. believe have isolated fault while loop stuck there. thanks! try with: while (fscanf(datalogin, "%[^:]:%s\n", username[i], password[i]) == 2){i++;} scanf returns number of field red, 2 until end of file. , need change "%s:%s\n" "%[^:]:%s\n" .

Select row to be deleted in csv file in python -

this maybe basic question, let's suppose 1 has csv file looks follows: a,a,a,a b,b,b,b c,c,c,c d,d,d,d e,e,e,e and interested in deleting row[1], , row[3] , rewrite new file not contain such rows. best way this?. module csv loaded in code, i'd know how within such scheme. i'd glad if me this. since each row on separate line (assuming there no newlines within data items of rows themselves), can copying file line-by-line , skipping don't want kept. since i'm unsure whether number rows starting 0 or one, i've added symbolic constant @ beginning control it. could, of course, hardcode it, rows_to_delete , directly code. regardless, approach faster using, example, csv module, because avoids unnecessarily parsing , reformatting of data being processed module has do. first_row_num = 1 # or 0 rows_to_delete = {1, 3} open('infile.csv', 'rt') infile, open('outfile.csv', 'wt') outfile: outfile.writelines(row row_n

Bulk Update in RethinkDB -

i'm trying update multiple documents in rethinkdb, based on precalculated values in hash. i.e. given table stats primary key slug data [{slug: 'foo', stats: {}}, {slug:'bar', stats:{}}] and given hash values updated_stats = { 'foo' => {a: 1, b: 2}, 'bar' => {a: 3, b: 4} } i can this updated_stats.each{|k,v| r.table('stats').get(k).update{|s| { :stats => v } } } so, why can't following? r.table('stats').get_all(*updated_stats.keys).update{|s| { :stats => updated_stats[s["slug"]] } } the rql shows nil value of updated_stats[s["slug"]]. appreciate on this. thanks. it's tricky problem. here's solution first. r.table('stats').get_all(*updated_stats.keys).update{|s| { :stats => r.expr(updated_stats).get_field(s["slug"]) } }.run() then updated_stats ruby hash when use brackets, it's usual bracket operator, ,

PHP and JavaScript together -

Image
complete revision: this code whole problem: function inbox() { #connecting: include('config.php'); $myconnection = new pdo('mysql:host=x;dbname=x', $dbusername, $dbpassword); $myconnection->setattribute(pdo::attr_errmode, pdo::errmode_exception); #collecting: $curuser = $_session['name']; #searching: $searchinbox = $myconnection->prepare("select * inbox = :username"); $searchinbox->bindparam(':username', $curuser); $searchinbox->execute(); $foundresults = $searchinbox->fetch(pdo::fetch_both); var_dump($foundresults); } as add in 'searching' code, 404 error, if tries refer webpage. a picture of database table 'inbox': when replace: $searchinbox = $myconnection->prepare("select * inbox = :username"); to: $searchinbox = $myconnection->prepare("select * inbox title = welcome"); i following error: fatal error: uncaught ex

c++ - How to defined constructor outside of template class -

this question has answer here: why can templates implemented in header file? 13 answers i linker error if define constructor\destructor of template class outside class. not allowed? use visual studio 2010. error 1>main.obj : error lnk2019: unresolved external symbol "public: __thiscall tree::~tree(void)" (??1?$tree@h@@qae@xz) referenced in function _main 1>main.obj : error lnk2019: unresolved external symbol "public: __thiscall tree::tree(void)" (??0?$tree@h@@qae@xz) referenced in function _main in .h file template <class t> class tree{ public: tree(void); ~tree(void); t x; }; in .cpp file #include "tree.h" template <class t> tree<t>::tree(void){ } template <class t> tree<t>::~tree(void){ } in main.cpp file #include "tree.h" int main(){ tree<int> t;

.net - How does System.ComponentModel.CancelEventHandler work? I dont understand what a cancelable event is? -

i strated developing forms in windows forms(c#) , having difficulty in understanding how system.componentmodel.canceleventhandler works , cancelable event means. this.txtname.validating += new system.componentmodel.canceleventhandler(this.txtboxempty_validating); this.txtaddress.validating += new system.componentmodel.canceleventhandler(this.txtboxempty_validating); i appreciate if can explain event handling. the implementation of textbox's validating event go like: string previoustext = this.text; string textthatwasentered = this.getinput(); // update text inputted value this.text = textthatwasentered; // validate inputted text, giving handlers chance cancel canceleventargs canceleventargs = new canceleventargs(); // call handlers, passing canceleventargs can set .cancel if needed this.onvalidating(this, canceleventargs); // if cancelled, reset text previous value if (canceleventargs.cancel) { this.text = previoustext; } so, it's way

css3 - CSS table no respect the class values over table -

i have css : table { margin: 10px 0 20px 0; width: 100%; text-align: center; } table th { color: #38a4fc; padding-top: 5px; background-color: #f9f9f9; width: 200px; height: 30px; border: 1px solid #d7d7d7; border-bottom: none; } table td { background-color: #fff; height: 35px; border: 1px solid #d7d7d7; padding: 10px; } table tr:hover td { background-color: #eee; } also have class other table : .web_table { width:90%; border:0px solid; } .web_table_td_left { width:50%; height:30px; font-family:arial; font-size:15px; color:#000000; } .web_table_td_right { width:50%; height:30px; font-family:arial; font-size:15px; color:#000000; text-align:center; } when use this: <table class="web_table"><tr><td class="web_table_tf_left"></td><td class="web_table_tf_right"></td></tr></table> the table use values of "table" in css , no class, don't know whats bad in code, think if use 1 cl

php - Insert doesn't work on SQL Server but no error -

i'm working on someone's else database creating simple php solution, running apache (xampp+windows 2003 server) connects ms sql server database running windows 2008 r2. i've been working few days, i've created few tables, i've inserted data on tables, i'm trying insert data existing table using php, table in particular insert statement doesn't work @ all, there no error message. here code. <?php include '../../includes/mssql.php'; $insereitem = "insert tbl_notas_faturamento_itens (cd_lancamento ......... ) values (26452,.....0)"; $stmt = sqlsrv_query( $conn, $insereitem); if( $stmt === false ) { die( print_r( sqlsrv_errors(), true)); } echo $insereitem . "\n"; ?> there no error message. as can see i've removed data insert statement doesn't use space here (there 88 values inserted). there no error message, there no error in apache logs, there no error in php logs data not commited

c++ - Using a typedef as a variable name not generating any error -

considering structure of data: typedef struct { float x; float y; } point; and i'm using function permute coordinates: point permute(point m) { point n; n.x = m.y; n.y = m.x; return n; } why declaring variable name ( point ) typedef not giving error? int main(void) { point a; point b; int point = 7; a.x = 0; a.y = 1; b = permute(a); printf("a (%.2f, %.2f)\n", a.x, a.y); printf("b (%.2f, %.2f)\n", b.x, b.y); printf("point = %d\n", point); return 0; } output: http://ideone.com/wcxbjd a (0.00, 1.00) b (1.00, 0.00) point = 7 scope. an identifier declared in outer scope (in case, @ file scope, i.e., outside function) may redeclared in inner scope (in case, inside main function). inner declaration hides outer declaration until reach end of inner scope. this applies declarations in general, not typedef names. a simple example: #include <stdio.h> typedef struct { int x, y; } point; int m

Loosing margin with javascript jquery -

why when add same html code javascript jquery loose margin ? try jsfiddle , understand me. jquery function addphone() { $( "#phonedetails" ).append( '<div >' + '<label>phone :</label>' + '<input type="text" /> ' + '<input type="button" onclick="addphone()"/>' + '</div>'); } html <div id="phonedetails"> <div> <label>phone :</label> <input type="text" /> <input type="button" onclick="addphone();"/> </div> </div> it isn't margin, space (i.e. when press space bar) between label , input . missing in code generated js. change: '<label>phone :</label>' + to: '<label>phone :</label> ' + // ^ space here

PHP stopping tamper data in html form -

back story: hey, i've @ few , couldn't quit find fix this, user's been spoofing value $price let's $5 firefox addon tamper data can change $_post value whatever wish $0.01, i'm trying prevent this. code: <?php $price = "5.00"; ?> <input type="hidden" name="cmd" value="_donations"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value="paypal@email.com"> <input type="hidden" name="item_name" value="ap"> <input type="hidden" name="amount" value="<?php if($price != "5.00") { $price = "5.00"; echo $price; } else { echo $price; } ?>"> <input type="hidden" name="notify_url" value="/ipn/ipn.php?user=<?php echo $username; ?>"index.php?thank=yes">

c# - How to fill form values which come from fiddler -

i want post data website https . when run app return same page without post data .i'm getting information fiddler webform rpslbox:postrpsl= rpslbox:postrpsl rpslbox:postrpsl:sourceradioselect= ripe_ncc rpslbox:postrpsl:rpslobject= post data here rpslbox:postrpsl:update= update javax.faces.viewstate= -8600675496086047392:1644420639838409291 how should fill javax.faces.viewstate ? because dynamic value.

Python - Generate binary list with itertools -

i want generate following output: [11000] combinations these numbers, no doubles [11000] [01100] [00110] [00011] [10100] . . . but cannot figure out how that. in problem list has 365 values 20 ones. you have 365 possible positions place 20 ones. 1 way approach making 20-length combinations of 365 positions. an example of how in code: from itertools import combinations n = 365 r = 20 indexes in combinations(range(n), r): base = [0]*n in indexes: base[i] = 1 print(base) since "n choose r" problem, you'll have lots of possible combinations! calculate how many, use: n! / (r!(n-r)!) = 365! / (20!(365-20)!) = 426112827338828179808453831565930.

javascript - Ajax MVC Partial Returning Correct Response Yet Fires the Error Handler -

this has me stumped. odd. i have ajax function defined: $.ajax({ type: 'get', datatype: 'text/html', url: getlicenseedetailsurl, success: function (response) { $('#licenseedetails').html(''); $('#licenseedetails').html(response); }, error: function (xhr) { alert('failed licensee details'); } }); and have calling controller has action like: public actionresult loadlicenseedetails(long licenseeid) { var model = new licenseedetailsviewmodel(); var licencesee = _licensingrepository.loadbyid(licenseeid); var licenses = _licensingrepository.loadlicenses(licenseeid); model.licencee = mapper.map<licensee, licenceeviewmodel>(licencesee); model.licences = mapper.map<ienumerable<license>, ienumerable<licenceviewmodel>>(licenses); return this.partialview("_licenseedetails", model); } this seems working expected without error

Bash shell alias not working as expected -

i'm trying write shell script uses libreoffice convert .odt document .pdf, getting stuck on alias issue. have following line in ~/.bash_profile : alias soffice='/applications/libreoffice.app/contents/macos/soffice' there's following line in shell script: soffice --headless --convert-to pdf $filename that creates "line 14: soffice: command not found" error. i'm not sure what's going on because can call $ alias alias soffice='/applications/libreoffice.app/contents/macos/soffice' and $ soffice --headless --convert-to pdf thefile.odt also works fine. know why alias isn't working in script , can it? thanks. the other answers try solve globally, add answer solve problem in current script (without aliases, shouldn't used in scripts). the appropriate answer question might add directory path, i.e. adding ~/.bashrc @palec suggested. make alias unnecessary. if want solve this script can add path right in script! put

https does't work but http works fine -

when try download file internet, found same link download fail https success http. e.g. wget https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear4/filesequence0.ts --2014-01-31 16:01:05-- https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear4/filesequence0.ts resolving devimages.apple.com.edgekey.net (devimages.apple.com.edgekey.net)... 23.73.64.225 connecting devimages.apple.com.edgekey.net (devimages.apple.com.edgekey.net)|23.73.64.225|:443... connected. error: certificate of ‘devimages.apple.com.edgekey.net’ not trusted. error: certificate of ‘devimages.apple.com.edgekey.net’ hasn't got known issuer. but if change https http, works fine: wget https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear4/filesequence0.ts --2014-01-31 16:01:05-- https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear4/filesequence0.ts resolving devimages.apple.com.edgekey.net (devimages.apple.com.edgekey.net

java - Connection timed out: connect for Eclipse JAX-RS program -

i learning jax-rs web-services , trying implement simple web-application based on example given in book - java web services , running 2nd edition . i have html page makes ajax call jsp using jquery . jsp takes back-end java class display data user. java class jax-rs client calls xml file present @ http://www.w3schools.com/xml/cd_catalog.xml . here html file: <html> <head> <title>json</title> <script type = "text/javascript" src = "http://code.jquery.com/jquery-latest.min.js"> </script> <script type = "text/javascript"> $.getjson('http://localhost:8081/rest/getcds.jsp', function(response) { var cds = response.catalog.cd; alert(json.stringify(cds)); $.each(cds, function(ind, val) { $('#container').append('<li>' + cds[ind].title + ': ' + cds[ind].a

c++ - Passing a string from a DLL to C# -

i have c# application accesses functions unmanaged c++ libary using cli dll. problem can't text c++ library passed through c# application correctly. code have far follows: c# [dllimport("wrapper.dll", entrypoint = "getnamelength", callingconvention = callingconvention = callingconvention.cdecl)] public static extern bool _getnamelength( int index, out int size); [dllimport("wrapper.dll", charset = charset.ansi, entrypoint = "getname", callingconvention = callingconvention.cdecl)] public static extern bool _getname( out stringbuilder name, int size, int index); private void testfunction() { int size = 0; _getnamelength(2, out size); stringbuilder str = new stringbuilder(size + 1); _getname(out str, str.capacity, 2); btnname.text = str.tostring(); } cli // in header. #define dllexport __declspec( dllexport) extern "c" { dllexport bool __cdecl getnamelength( int index, int& size); dllexpo

c++ - Multithreaded inline assembly -

i'm trying create large number of sha256 hashes on t4 machine. t4 has 'sha256' instruction allows me calculate hash in 1 op code. created inline assembly template call sha256 opcode: in c++ code: extern "c" { void processchunk(const char* buf, uint32_t* state); } pchunk.il: .inline processchunk,8 .volatile /* copy state */ ldd [%o1],%f0 /* load 8 bytes */ ldd [%o1 + 8],%f2 /* load 8 bytes */ ldd [%o1 +16],%f4 /* load 8 bytes */ ldd [%o1 +24],%f6 /* load 8 bytes */ /* copy data */ ldd [%o0],%f8 /* load 8 bytes */ ldd [%o0+8],%f10 /* load 8 bytes */ ldd [%o0+16],%f12 /* load 8 bytes */ ldd [%o0+24],%f14 /* load 8 bytes */ ldd [%o0+32],%f16 /* load 8 bytes */ ldd [%o0+40],%f18 /* load 8 bytes */ ldd [%o0+48],%f20 /* load 8 bytes */ ldd [%o0+56],%f22 /* load 8 bytes */ sha256 nop std %f0, [%o1] std %f2, [%o1+8] std %f4, [%o1+16] std %f6, [%o1+24] .end things working great in single threaded en

c++ - Two scenarios of strcmp -

i have write buggy server crash due off 1 error. my doubt why below code gives segmenation fault char wbuff[5]; char abuff[5]= "12345"; strcpy(wbuff,abuff); but below code doesn't char buf[bufsize]; char wbuf[5]; n = read(connfd, buf, bufsize); // read input string client strcpy(wbuf,buf); // strlen(buf) greater 5 the first 1 copies non-null-terminated string (abuff) other string. walks off end of abuff until finds 0 byte, quite ways, , causes segfault. other 1 copies properly-terminated string (buf) undersized string wbuf, , stops copying after copies strlen(buf)+1 bytes. first more cause segfault, both errors.