Posts

Showing posts from April, 2012

c# - WPF Application Has Lost Windows 8 Style And Reverted to a XP Like Look -

for no reason can think of - there have been no code changes, wpf application has stopped showing window frame in windows 8 style , seems have reverted windows xp style (weird grey border around main window , grey, raised buttons minimize,maximize , close in top right corner. if try , resize window can see win8 style buttons trying draw "underneath" before grey button style draws on it. (that's best can describe it) does know why might happening?

c# - How can I use WebClient.DownloadString from a secure URL (https)? -

the code i'm using webclient webclient = new webclient(); string xmlresult = webclient.downloadstring("https://kat.cr/usearch/ubuntu/?rss=1"); i'm bit confused url seems tunnel through secondary page kastatic.com:443 , kat.cr:443 (if i'm understanding fiddler correctly). the server certificate seems fine adding following code nothing helpful servicepointmanager.servercertificatevalidationcallback = (sender, certificate, chain, sslpolicyerrors) => { return true; }; i've tried setting useragent headers on webclient object in case need identify browser or don't think i'm on right track. edit: response "12a9" 2 odd ascii characters trailing (a question mark symbol , white circle black border. if @ headers in fiddler, response gzip-encoded (compressed). see this answer how deal this, since there's no "quick , easy" way we

php - Insert into not creating new row -

i've been trying mess around registration system. when try insert information database. no new row generated. i'm not getting errors, , code seems legitimate. there don't know insert into? $username = $_post['regusername']; $email = $_post['regemail']; $password = $_post['regpassword']; $cpassword = $_post['regpasswordcon']; $firstname = $_post['regfirstname']; $lastname = $_post['reglastname']; //check username weird symbols if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $username)){ // 1 or more of 'special characters' found in string //header("location: /register.php"); echo "your username should contain letters , numbers"; exit; } //check if username taken $check = $con->prepare("select * accounts username=:user"); $check->bindparam(':user',$username); $check->execute(); $result = $check->fetch(pdo::fetch_assoc); if

wordpress plugin - How do you add custom columns for these custom post types? -

i've been developing plugin involves custom post types , taxonomies. i'm struggling @ moment getting custom post fields display in 'all reservations' screen. can columns display, cannot life of me fields within columns populate data database. my custom post code below: function reservations_init() { $labels = array( 'name' => _x( 'reservations', 'post type general name' ), 'singular_name' => _x( 'reservation', 'post type singular name' ), 'add_new' => _x( 'add new', 'reservation' ), 'add_new_item' => __( 'add new reservation' ), 'edit_item' => __( 'edit reservation' ), 'new_item' => __( 'new reservation' ), 'all_items' => __( 'reservations' ), 'view_item'

jquery - Form validation error message not working -

i had custom code added shopping cart worked beautifly. @ point, error message displays when required field not filled out, stopped working. here code: (revised html included) {% assign choices = "other, affiliate, returning customer, practitioner, dr. ulan, dr. shallenberger, dr. dennis courtney, wbai - take charge of health radio, chek institue, bodyhealth newsletter, yasmine marca, ben greenfield, steve ilg, tawnee prazak, abc4u, natural awakenings, email advertisment, facebook, twitter, google, forum, friend, letter, optimum healt report, townsend letter, autism avenue" %} {% assign required = true %} <div class="form-vertical"> <p> <select style="margin-left: 0px;" class="six columns" id="how-did-you-hear-about-us" name="attributes[how-did-you-hear-about-us]" > <option value=""{% if cart.attributes.how-did-you-hear-about-us == "" %} selected{% endif %}>please make sele

Rails: render_to_string without escaping HTML chars (i.e. < and >) -

i need export strings in markdown format (that lie in database) ms word docx format. decided use pandoc this. i have registered new mime type docx , can stuff in show.docx.erb file: # <%= @boilerplate.title %> ## <%= @boilerplate.class.human_attribute_name :intro %> <%= @boilerplate.intro %> ## <%= @boilerplate.class.human_attribute_name :outro %> <%= @boilerplate.outro %> then pandocruby.convert render_to_string(options), to: :docx . creates nice word document. but has problem: escapes html chars < , > , when have e.g. html code blocks in source, brackets escaped &lt; . i need unescaped string render_to_string(options) . possible? related issue: https://github.com/alphabetum/pandoc-ruby/issues/14 try <%= raw @boilerplate.into %> instead.

python - compressing a string with repeating symbols -

i'm learning python , challenged exercise compress string. input goes ' aaaabbcccca ' output has ' a4b2c4a1 '. did it, have feeling solution rather clumsy. know, answer task. code is: a = input() l = int(len(a)) c = int() b = str() = 0 while c <l: if a[i] == a[c]: c += 1 else: b += (a[i] + str(c-i)) = c b += (a[i] + str(c-i)) print(b) here alternative one(ish) liner: import itertools = "aaaabbcccca" print "".join(["%s%u" % (g[0], len(g)) g in [list(g) k,g in itertools.groupby(a)]]) which prints: a4b2c4a1 to see how works, can split line components get: groups = [list(g) k,g in itertools.groupby(a)] print groups lengths = ["%s%u" % (g[0], len(g)) g in groups] print lengths print "".join(lengths) this prints following: [['a', 'a', 'a', 'a'], ['b', 'b'], ['c', 'c', 'c', 'c'

Windows command line - write N characters to file with > operator -

could please tell if possible write file n characters using > operator echo "helloooooo" > file.txt will write whole string, there way write "he" example? @echo off setlocal enableextensions set "_write=helloooooox" > file.txt ( rem extract first 2 characters: echo(%_write:~0,2% rem extract last 3 characters: oox echo(%_write:~-3% rem etc. etc. ) read entire set /? or variables: extract part of variable (substring)

java - How set List in Spring Rest -

i'm developing first application uses spring rest , have class veiculo.class , agencia.class , contato.class . when created veiculo object, needs list contents agencia , spring generates correctly hypermedia my: entity @document public class veiculo{ @id private string id; @indexed(unique = true) private string nome; private string tipo; @dbref list<contato> contatos; @dbref list<agencia> agencias; //getters , setters } curl daniela.morais@tusk:~$ curl http://localhost:8181/api/veiculos/55a50d42ccf2bc55501419d6 { "nome" : "veiculo", "tipo" : "tipo", "_links" : { "self" : { "href" : "http://localhost:8181/api/veiculos/55a50d42ccf2bc55501419d6" }, "contatos" : { "href" : "http://localhost:8181/api/veiculos/55a50d42ccf2bc55501419d6/contatos" }, "agencias" : {

Bootstrap full carousel unwanted margins -

i can't figure out why can't rid of white margins on carousel. have carousel's pictures fill whole space left right. could tell me how correct code please? body { padding: 0; margin: 0; overflow-y: scroll; font-family: arial; font-size: 18px; } .carousel .item { width: 100%; /*slider width */ } .carousel .item img { width: 100%; /*img width*/ } .container { width: 100%; } <div class="container"> <div id="mycarousel" class="carousel slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#mycarousel" data-slide-to="0" class="active"></li> <li data-target="#mycarousel" data-slide-to="1"></li> <li data-target="#mycarousel" data-slide-to="2"></li> </ol>

php - upload directly to s3 from laravel -

i using laravel 5.1 on homestead developing locally. working on established laravel source code. changed filesystem config use s3. having issue making code upload directly s3, or upload s3 @ all. here current code: <?php class imagehandler { public static function uploadimage($image, $folder, $filename = '', $type = 'upload'){ return call_user_func ( config::get('site.media_upload_function'), array('image' => $image, 'folder' => $folder, 'filename' => $filename, 'type' => $type) ); } public static function getimage($image, $size = ''){ $img = ''; // placeholder image $image_url = config::get('site.uploads_dir') . 'images/'; if($size == ''){ $img = $image; } else { switch($size){ case 'large': $img = str_replace('.' . pathinfo($image, pathinfo_extension), '-large.' . pathinfo($ima

c# - InternetSetCookie returns ERROR_INVALID_OPERATION -

i'm trying expire cookie on machine. when call wininet.dll internetsetcookie returns false , error code 4317 generic error_invalid_operation . [dllimport("wininet.dll", setlasterror = true)] private static extern bool internetsetcookie(string lpszurlname, string lpszcookiename, string lpszcookiedata); public void main() { internetsetcookie("http://example.com","cookiename","somevalue;expires=mon, 01 jan 0001 00:00:00 gmt") } is there anyway more info on operation invalid? is there anyway more info on operation invalid? no there not. however, getting error_invalid_operation because trying set cookie has been set ( couldn't edit cookie using internetsetcookie() ). had clear cookies using function . need declare first: [dllimport("wininet.dll", setlasterror = true)] private static extern bool internetsetoption(intptr hinternet,int dwoption,intptr lpbuffer, int lpdwbufferlength); then can use

bencoding - Bencoded string length in java -

Image
i bit confused bencoding. according specification when bencode string need use following format: length:string string spam becomes 4:spam my question: 4 qty of symbols of bencoded string, or qty of utf-8 bytes? for instance, if going bencode string gâteau what number should specified length of string? i think have specify 7 , , final form should 7:gâteau it because symbol â took 2 bytes accoring utf-8 encoding, , rest symbols in string took 1 byte according utf-8 encoding. also heard not recommended store bencoded data in java string instance. in other words, when bencode data block, should store byte array , should not convert java string value avoid encoding issues. are assumptions correct? according specification , bencoded string sequence of bytes, , have specify qty of bytes sequence it's length. and, specification: " all character string values utf-8 encoded ". and case "gâteau" should specify 7 length, because

wpf - DataTrigger C# in resourceDictionary -

i have searched topics on stackoverflow, none seem work me. i set datagrid columns based on columns in resourcedictionary. (this dictionary consists of datagridtemplatecolumn's.) 1 of these columns contains binding boolean value. not want 'true' or 'false', want have '√' or ''. this not seem work me ( datatrigger textblock ). still keeps 'true' or 'false'. this textblock inside template: <textblock text="{binding booleanvalue}" textalignment="center"> <textblock.style> <style targettype="{x:type textblock}"> <style.triggers> <datatrigger binding="{binding booleanvalue}" value="true"> <setter property="text" value="√"/> </datatrigger> <datatrigger binding="{binding booleanvalue}" value="false">

java - How to finish a container-managed transaction before running a long task? -

i have task consists of 3 steps prepare , execute , update . prepare , update need work within transaction, whereas execute takes long (i.e. several minutes hours). task part of ejb, i.e.: @stateless public class task { public void dotask() { prepare(); execute(); update(); } } my question is, there (elegant) way commit , finish transaction after prepare , start new 1 before update ? i'd rather use container-managed transactions , possibly not switch use usertransaction . it possible split tasks single ejbs if gains advantage, note suspending transaction execute (i.e. using @transactional(txtype.not_supported) not enough since still triggers timeout. i tried split taskexecute class has @asynchronous @transactional(not_supported) public void execute() , sending event when done. doesn't seem work either. is there way this? after further testing let me conclude: alexanders reply absolutely correct. understanding had altere

javascript - Unable to manipulate inherited scope in directive link (konami code directive implementation) -

edit: working plunker of directive (includes solution): http://embed.plnkr.co/uhfcva/ trying create directive enable debug mode listening keystrokes. reaches "debug mode toggle" message, understand use of scope object wrong. can't figure i've missed since "showdebug" variable made available in scope, it's not updated: app.directive('bpkonamidebug', ['$document', '$rootscope', function($document, $rootscope) { // pattern = konami code (↑ ↑ ↓ ↓ ← → ← → b a) var pattern = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]; // pattern = "debug" // var pattern = [100, 101, 98, 117, 103]; // keycodes "debug" var cursor = 0; return { restrict: 'a', link: function(scope, element, attrs) { // enrich parent scope // stackoverflow: variable set (works) scope.showdebug = true;

variables - PHP assign first not null, set and not empty value -

i partially solved line above setup variable different others got post method $myvar= $_post['myvar_a'] ?: $_post['myvar_b'] ?: $_post['myvar'] ?: null; but need take care of not set , empty value. when not set myvar_a , myvar_b take myvar, otherwise force null because have set in current execution. achieved nested if else pseudo if isset , !empty myvar = myvar_a else ... but shorten code. tips?

php - Get values from Select statement and Insert them in Temp table Stored procedure -

here stored procedure. here want select data table save in variable insert in other variable.but here select statement has where. in value day should come loop. means in loop dayname(datetime) particular day. on basis of want fetch values , use in insert statement. drop procedure if exists home_cleaner.getavailabledateandtime; create procedure home_cleaner.`getavailabledateandtime`(datetime date) begin declare datetime datetime default now(); declare datetimecounter int default 0; declare datetimecounterlimit int default 90; declare result varchar(255) default null; declare result1 varchar(255) default null; declare result2 varchar(255) default null; declare result3 varchar(255) default null; declare result4 varchar(255) default null; declare c cursor select group_concat( cleaner_calender.from, &qu

rest - Add verbs to resources of Rails's routing -

by default, resources keyword of rails routing creates 7 actions. for example resources :foos : ----------------------- | verb | action | ----------------------- | | index | | | show | | | edit | | | new | | put/patch | update | | post | create | | delete | destroy | ----------------------- how can add inside list options verb such as: -------------------------------- | verb | action | -------------------------------- | ... | ... | | options | member_options | | options | collection_options | -------------------------------- in other words , default, each resource, have use this: match '/foos/', via: :options, controller: 'foos', action: 'collection_options' match '/foos/:id/', via: :options, controller: 'foos', action: 'member_options', as: :foo resources :foos instead, prefer custom settings in order this: resource

Is it possible to read environment variables from php? -

the environment variable logonserver available cmd prompt echo %logonserver% is possible read variable php accessed via browser , not cmd prompt, means can't pass value in parameter. i know shell out cmd , way, wondering if there built-in php functionality this. yes. environment variables accessible through super-global $_server variable. try var_dump($_server) see what's inside.

Export an object of class ggmap in R -

i need use map load ggmap in lab there's no internet. wondering if there's read.table function type of object. this code i'have try: mtl <- get_map(location = c(lon = -73.705951 , lat = 45.541598), zoom = 11 , maptype = "terrain", source = "google", color = "color") save(mtl, file="mtlmap.rdata") test <- load("mtlmap.rdata") ggmap(test) and error: error: ggmap plots objects of class ggmap, see ?get_map thanks! perhaps use save , load ? myggmap <- get_googlemap(...) #add params here save(myggmap, file="tmp1.rdata") rm(myggmap) load("tmp1.rdata") ggmap(myggmap) or bit fancier: if(file.exists("tmp1.rdata")&file.info("tmp1.rdata")$size>0) load("tmp1.rdata")

javascript - using lodash to generate a dynamic table in nested object -

i have got nested object containing students' details below: data = [ { name: 'gill, jack', subjects: [ { name: 'mathematics', scores: [ { year: 7, collection: 1, score: 430, }, { year: 7, collection: 2, score: 500, } ] } } going generate dynamic table in webpage show last year's mark each student. unfortunately not working , prints n/a , think there wrong lodash new it. used static array instead of scoreatl , table had correct cell contents. //getting students id url $.get('/rest/report/' +

c - Adding const-ness to opaque handle -

if have created c module presents handle user pointer forward declared struct, so: typedef struct foo_obj *foo_handle; if declare function prototypes use const qualified parameter thusly: void foo_work(const foo_handle foohandle); how const -ness applied? const struct foo_obj *foo_handle // struct foo_obj *const foo_handle // b const struct foo_obj *const foo_handle // c or ub ? b. ( there no undefined behavior code presented. ) the function call void foo_work(const foo_handle foohandle); is equivalent void foo_work(struct foo_obj* const foohandle); variable foohandle in function becode const pointer non-const struct foo_obj object. not able add const qualifier foohandle make pointer const object. instead, if want have pointer const object, , keep struct hidden, must make typedef: typedef const struct foo_obj* foo_consthandle;

c# - Regex in PreviewTextInput: only decimals between 0.0 and 1.0 -

i'd have regex, allows digits between 0.0 , 1.0 in textbox. but should in method previewtextinput (c#, wpf project) so normal regex doesn't work regex regex = new regex(@"^0|0.0|0\.[0-9]*|1\.0|1$"); i've found regex, allows decimals in previewtextinput method: regex regex = new regex("^[.][0-9]+$|^[0-1.]*[.,]{0,1}[0-9]*$"); how can change regex accept decimals between 0-1? thanks. my method decimals: private void tb_previewtextinput(object sender, textcompositioneventargs e) { regex regex = new regex("^[.][0-9]+$|^[0-1.]*[.,]{0,1}[0-9]*$"); e.handled = !regex.ismatch((sender textbox).text.insert((sender textbox).selectionstart, e.text)); } my method decimals between 0-1 (doesn't work): private void tb_surface_previewtextinput(object sender, textcompositioneventargs e) { regex regex = new regex(@"^(0?\.[0-9]+|1\.0)$"); e.handled = !regex.ismatch(e.text);

How to change scrollbar repeatButton to image then thumb is moving. WPF xaml -

i have insert image in xaml, if thumb on top has 1st image , second image show, how has if thumb in middle, , 3rd - thumb in bottom. how it? put 2 images (yellow arrow top, gray arrow bottom), put 2 (yellow arrow bottom, gray arrow top)? code far: <window x:class="scroll4.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <window.resources> <solidcolorbrush x:key="background" color="gray" /> <style x:key="scrollbarpagebutton" targettype="{x:type repeatbutton}"> <setter property="snapstodevicepixels" value="true"/> <setter property="overridesdefaultstyle" value="true"/> <setter property="istabstop" value="false"/&

django - modifying python list inside iteritems modifies the dict itself -

this question has answer here: how clone or copy list? 14 answers dict = {1:[1,1,1], 2:[2,2,2]} mylist = [] print dict key, value in dict.iteritems(): mylist.append(value) item in mylist: = item[0]+ item[1] item.append(a) print dict the result of printing dict before operation {1: [1, 1, 1], 2: [2, 2, 2]} while doing after iteritems {1: [1, 1, 1, 2], 2: [2, 2, 2, 4]} why dict modified? you changing dict's value list , not copy of list for key, value in dict.iteritems(): mylist.append(value) id(mylist[0]) 70976616 id(dict[1]) 70976616 both dict[1] , mylist[0] referencing same memory space change in memory space affect both of them long referencing it dict[1] [1, 1, 1, 2] mylist[0] [1, 1, 1, 2] you use copy ,deep copy etc copy list or dict = {1:[1,1,1], 2:[2,2,2]} mylist = [] print dict key, value in dict.iterit

java - Custom view criteria in oracle adf -

i had created 1 search page using custom viewcriteria 5 parameters.in search page working perfect.i have 1 doubt,we entering parameters in search page details 1 table, here need values entered in boxes using values 1 java class. how values? maybe ,this link can you.you should glance http://www.awasthiashish.com/2013/07/implementing-custom-search-form-in-adf.html

php - How to get last date from all dates for each student -

i'm making query, takes driving courses students had in period , compares if student has driven courses paid for. need each student, last drives starttime, example - "martin paid 5 courses , in july had last course. did 20 other people. , administrator needs make report, in report, last course last day of fulfillment. my php <?php ini_set("display_errors","1"); error_reporting(e_all); include("../../config.php"); $down= array(); $xx=0; $query = "select jq.stud_id id, jq.subject name, jq.starttime endtime, (select sum(drives_count) jqcalendar stud_id=jq.stud_id , description in(5, 6, 14, 17, 18, 34)) drive_count jqcalendar jq left join csn_bills b on jq.stud_id=b.student_id left join csn_bills_details bd on b.id=bd.bill_id jq.starttime > '".

c++ - What is an empty template argument <> while creating an object? -

here valid syntax: std::uniform_real_distribution<> randomizer(0, 100); how work, automatically deduce object template? why necessary write <> @ end of type? can not remove <> , same? typically can used , works when first , succeeding, or only, parameter has default template argument (type or value if integral). additional case when there template argument pack , empty. the <> still needed identify template type. in case type declared as ; template <class realtype = double> class uniform_real_distribution; hence default realtype template class uniform_real_distribution double . amounts std::uniform_real_distribution<double> . with reference c++ wd n4527 , §14.3/4 (template arguments) when template argument packs or default template-arguments used, template-argument list can empty. in case empty <> brackets shall still used template-argument-list . [ example: template<class t = char> class string

apache - Unable to setup Gerrit code review: Service Temporarily Unavailable -

i trying setup gerrit on centos using http authentication getting " service temporarily unavailable " when tried access on " http://x.x.x.x/gerrit/login/ ". it seems configuration issue gerrit/apache. tried change settings no luck. as per understanding since gerrit on http authentication apache needs pass authentication gerrit , both should running on different ports(which trying do). i gone through other questions on here( another question ) http auth gerrit unable through. this gerrit.config [gerrit] basepath = git canonicalweburl = http://localhost:8081/gerrit [database] type = h2 database = db/reviewdb [index] type = lucene [auth] type = http [sendemail] smtpserver = localhost [container] user = gerrit2 javahome = /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79.x86_64/jre [sshd] listenaddress = *:29418 [httpd] listenurl = http://x.x.x.x:8081/ [cache] directory

ios - get UITableViewCell from NSIndexPath? -

i using multiple uitableview custom cells in single viewcontroller . custom cell have textfields , able edit textfields. want tableviewcell of exact uitableview in textfield delegate method when editing textfield ? remember there multiple tableviews want exact cell of exact table editing. help? you must have tag both tableview use below code in textfield delegate uitableviewcell *cell = (uitableviewcell *) textfield.superview.superview.superview; uitableview *curtableview = (uitableview *)cell.superview; nsindexpath *indexpath = [curtableview indexpathforcell:cell];

PostgreSql backup bat file not creating backup file -

i have created bat file take backup of postgresql database. following bat file like: @echo off /f "tokens=1-4 delims=/ " %%i in ("%date%") ( set dow=%%i set month=%%j set day=%%k set year=%%l ) set datestr=%month%_%day%_%year% echo datestr %datestr% set backup_file=backup_%datestr%.backup echo backup file name %backup_file% set pgpassword=password echo on bin\pg_dump -i -h localhost -p 5432 -u postgres -f c -b -v -f %backup_file% databasesample i created postgresqlbackup.bat , put inside c:\program files\postgresql\9.3\bin postgresql instalation directory. before setting pgjob scheduler i tried double click on bat file checking whether working or not. no backup files got created inside particular folder. please guide me. looking on different location?

functional programming - Extract only the number from a ref in erlang -

i'm new erlang. need take number returned make_ref(). so, if make_ref() returns :#ref<0.0.0.441> extract 441. any idea how this? try instead: unique_integer() -> try erlang:unique_integer() catch error:undef -> {ms, s, us} = erlang:now(), (ms*1000000+s)*1000000+us end. edit : main difference between solution , extracting integer using io_lib:format("~p", [ref]) speed. when solution takes around 40ns in r18, transformation list, regexp , integer takes 9µs. go 2 orders of magnitude faster solution.

multithreading - What is the most efficient way to write to multiple files on disk simultaneously in Java? -

i have system has n threads (1 < n < 10). each thread generates data, , data each thread needs written it's own file (so, n threads, n files). files huge , written hard drive (not ssd), , in cases raid array. i have chosen strategy of writing data each thread it's own buffer, , having single thread read buffer contents , write files (each buffer have it's own file). reasoning writing disk multiple threads less efficient (more disk head movement) , result in poor performance. my questions: q1) assumption correct, or should write directly each thread? q2) if assumptions correct, there libraries this? thanks i've implemented @ school in java teaching purposes , i've come conclusion better write in parallel on multiple threads. however, depends on number of threads, synchronization complexity, , size of buffer needs written. and more: cannot sure cpu run of threads in parallel, if create many threads, nothing. used threadpoolexecutor anywa

java - Connect to netty with a client which does not use the netty framework -

i use netty framework build async nio server. want connect android app server. im not able use netty wit android application, because there many functions not supportet android jvm. there way connect netty server using ssl/tsl android socket? there no reason why arbitrary client should not able speak netty-based server, long both parties implement same protocol. e.g. openssl s_client can talk netty-based ssl server. so, implement android code following myriad of ssl/tls tutorials blocking io, if find easiest, , should able talk server enough.

Send email to and then redirect in javascript -

i have website form in it. form takes name, phone, email, company , message. i want when user clicks submit, email send predefined email account , user send new page. the code have far this: <form method="post" action="mailto:test@test.com"> this opens email provider prompt. wouldn't bad, can't redirect user after wards then. is there way javascript, or easier use php? you can't solely on client side javascript. need use server language, such php, posted data , send email. have choice, redirect on server side or doing client side. here's php code (note didn't test it): // email posted data mail('your-address@mail.com', 'new message site', 'name: ' . $_post['name'] . 'phone: ' . $_post['phone'] . 'email: ' . $_post['email'] . 'company: ' . $_post['company'] . 'message: ' . $_post['message']); // redirect

How to use awk to print a particular section of input file -

i have input file this. # #mdrun part of g r o m c s: # #go rough, oppose many angry chinese serial killers # @ title "dh/d\xl\f{}, \xd\f{}h" @ xaxis label "time (ps)" @ s0 legend "dh/d\xl\f{} \xl\f{} 0.1" @ s1 legend "\xd\f{}h \xl\f{} 0.05" @ s2 legend "\xd\f{}h \xl\f{} 0.15" 0.0000 -33.8598 1.71168 -1.66746 0.2000 -34.3949 1.73192 -1.702 0.4000 -31.8213 1.61262 -1.56193 0.6000 -32.3563 1.63639 -1.59224 0.8000 -33.6158 1.69898 -1.65539 1.0000 -32.5242 1.65055 -1.59363 1.2000 -33.7464 1.70708 -1.6607 1.4000 -33.0552 1.68563 -1.60985 1.6000 -32.9946 1.66834 -1.62445 1.8000 -31.6345 1.60933 -1.54529 2.0000 -33.1246 1.67736 -1.62769 2.2000 -33.9822 1.71743 -1.67394 2.4000 -32.4887 1.64732 -1.59384 2.6000 -30.0927 1.5349 -1.46508 on till 100000.0000 i want generate new file containing particular section( complete lines) 1000.0000-2000.0000 line containing "@" , "#". suggested me use awk , suggested code.

linux - Logcat show invisible messages in Eclipse Mars -

Image
my pc running on debian jessie & logcat's messages invisible on eclipse mars. tried solution here , no help. now? ---------- update ---------- i tried followings: change logcat/ddms's metadata settings in com.android.ide.eclipse.ddms.prefs file. don't use gtk3 export swt_gtk3=0 but both failed fix situation. i had similar problem (eclipse mars on arch linux) , turned out gtk issue. solution add following 2 lines --launcher.gtk_version 2 in eclipse.ini right before the --launcher.appendvmargs line, explained in https://bbs.archlinux.org/viewtopic.php?id=200053 note location of eclipse.ini distro specific (in case under /usr/lib/eclipse) , multiple copies of file in different directories can override same setting, make sure adding lines in right place.

regex - bsd_glob behaving differently on different machines -

i using bsd_glob list of files matching regular expression file path. perl utility working on rhel , not on suse 11/aix/solarix , exact same set of files , same regular expression. googled limitations of bsd_glob , couldn't find information. can point what's wrong? below regular expression file path searching for: /datafiles/data_one/level_one/*/data* i need files beginning data, in directory present under 'level_one'. works on rhel box, not on other unix , suse linux . below code snipped using bsd_glob foreach $file (bsd_glob ( "$filename", glob_err )) { if ($filename =~ /[[:alnum:]]\*\/\*$/) { next if -d $file; $filelist{$file} = $permissions; $total++; } elsif ($filename =~ /[[:alnum:]]\*$/) { $filelist{$file} = $permissions; $total++; } else { $filelist{$file} = $permissions; $total++; } } in case facing issue, /datafiles/data_one/level_one/*/data*

java - Android About Region and Touch -

Image
i'm developing image-processing program. , i'm stuck here. have image this: i drew closed line (path) finger. now, want points in closed-region cut out image. there algorithm or method? how create circular imageview in android? this may you. user drawcircle() crop circle, maybe drawpath() can crop region...

sending html email using php not working -

trying sending html email using php mail function. below code using. public function sendactivationmail($activationcode="",$receiveremail=""){ $subject="registration confirmation"; $body="<html><body>"; $body.="<p>thank registering us. please activate account clicking activation link "; $body.="<a href=".$this->url()->fromroute('login/default',array('controller'=>'index','action'=>'activation','id'=>'abc121')).">activate</a></p>"; $body.="</body></html>"; $headers = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1'."\r\n"; $headers .= 'from: abc@gmail.com'."\r\n".'reply-to: abc@gmail.com'."\r\n" .'x-mailer: php/' . phpversion(); $s

php - Is it possible to add Jquery mobile loader on XMLHttpRequest() request? -

function uploadfile() { var fd = new formdata(); var count = document.getelementbyid('image').files.length; (var index = 0; index < count; index ++) { var file = document.getelementbyid('image').files[index]; fd.append('myfile', file); } var xhr = new xmlhttprequest(); xhr.addeventlistener("progress", updateprogress, false); xhr.addeventlistener("load", uploadcomplete, false); xhr.addeventlistener("error", uploadfailed, false); xhr.open("post", "savetofile.php", false); xhr.send(fd); } function updateprogress(evt) { /* event raised when server send response */ $.mobile.showpageloadingmsg(); } function uploadcomplete(evt) { /* event raised when server send response */ alert(evt.target.responsetext);

Android Design/Architecture: Static Reference vs Service -

suppose have recyclerview in activity a. recyclerview dynamic, , updated whenever there's new information (will explain more). upon clicking item, takes me activity b. so, suppose there new information activity a. receive information via (parse) notification. while on activity b, means should using update recyclerview on activity a, assuming want keep active time? currently, have static references adapter, , update updater using static reference activity b. feel not design/approach static references shouldn't used unless extremely necessary (right?). instance, service/serviceintent more useful/a better approach in case? thanks help! static reference vs service aside comparing apples bananas, doing wrong static reference, leading memory leak (try using leakcanary ...). should use eventbus (like greenrobot's , otto ) distribute data various components of application.

vba - Preserve text format when sending the content of a word document as the body of an email, -

i'm trying send content of word document body of outlook email, happens formats of texts (bold, color, etc) lost after inserted email. i have tried using word document envelop item, , did preserve original format .display method not work under such circumstances. below codes bodi = wddoc3.content wdapp.activedocument .saveas thisworkbook.path & "./past email/email generated on" & "-" & format(date, "dd mmmm yyyy") & ".doc" .close end set mail_object = createobject("outlook.application") set mail_single = mail_object.createitem(0) mail_single .display end signature = mail_single.body mail_single .to = arr2(2, 1) .subject = arr2(1, 1) .cc = arr2(3, 1) .bcc = arr2(4, 1) .body = bodi & vbnewline & signature and below code found on internet using envelop method, .display or .visible method not make outlook window pop up. directly send out email, not wanted.

C++ unix 32bit to Red Hat Linux running on an x86_64 chip (64-bit server) -

i working on project porting application in c++ 32 bit unix red hat linux running on x86_64 chip (64-bit server). facing issues related long data types.i wrote sample program print binary long , unsigned long value of 1. has 1 in middle: ul = 0000000000000000000000000000000100000000000000000000000000000001 l = 0000000000000000000000000000000100000000000000000000000000000001 string binary(unsigned long i) { int n = sizeof(unsigned long); string s; n *= 8; --n; while (n >= 0) { unsigned long mask = (1 << n); s += (mask & ? "1" : "0"); --n; } return s; } string binary(long i) { int n = sizeof( long); string s; n *= 8; --n; while (n >= 0) { long mask = (1 << n); s += (mask & ? "1" : "0"); --n; } return s; } int main() { unsigned long ul = 1; long l = 1; cout << "sizeof ul = " << sizeof ul << ", ul = &qu

forms - How to make Confirm Password field in Shopify? -

i'm creating shopify website, , i'm working on customer registration form. need make confirm password field. know how in shopify? just got working on register page: the 2 password fields: <div id="create_password_container"> <label for="password">your password<em>*</em></label> <input type="password" value="" name="customer[password]" id="create_password" {% if form.errors contains "password" %} class="error"{% endif %}> </div> <div id="password_confirm_container"> <label for="password_confirmation">password confirmation</label> <span class="password-match">passwords not match</span> <input type="password" value="" name="customer[password_confirmation]" id="password_confirm" /> </div> javascript: $(&#

file - Directory Authorization Issue on visual studio c# -

i create writing test check permission write. test is try { string filepath = string.format(path.combine(path, path.getrandomfilename())); file.writealltext(filepath, @"0"); file.delete(filepath); return true; } catch (ioexception uex) { //someerrormessage } catch (securityexception uex) { } catch (unauthorizedaccessexception uex) { } when try write on c:\windows\system32 normal user (i can't write here), file writealltext seems able write in directory if comment delete row, can't see file in directory ( use prompt administrator,too) , if wrote file.readalltext(filepath), can read file. why can create file in c:\windows\system32 , why can see file file.readalltext(filepath)?

mysql - Order By then Group? -

i have 2 tables, first, hotel_info has fields such as( hotel_id , hotel_name , location ) , second table rooms , has room information such as( room_id , room_name , hotel_id , rate , description ). want query returns minimum room rate hotel , information hotel hotel_info table. far have query working not returning minimum room rate. select a.hotel_id,a.hotel_name ,a.location, b.rate hotel_info left join rooms b on b.hotel_id=a.hotel_id group hotel_id how minimum room rate per hotel? you can use mysql function min() such as select a.hotel_id, min(b.rate) hotel_info left join rooms b on b.hotel_id = a.hotel_id group a.hotel_id;

c# - Thread safe assigning of the returned result of a threaded function to a variable -

i have function takes variable parameter , returns calculated result. function splits other functions each doing own calculation. need function run multi threaded. my code: for (int = 0; < pic.width; i++) { (int k = 0; k < pic.height; k++) { var localk = k; var locali = i; image bestpic; new thread(() => { bestpic = new bitmap(getbestpic(argb));//this wrong values assigned because of cross threading lock (thislock) { g.drawimage(bestpic, locali * bestpic.width, localk * bestpic.height, bestpic.width, bestpic.height); } }).start(); } } all need function getbestpic run multi threaded. how run function getbestpic multi threaded , make assigning of returned result bestpic variable atomic? my entire program if needed: montage program. using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; u