Posts

Showing posts from January, 2012

mysql - Spring Social Facebook App Setup for getting the user information -

i working on spring social login facebook. need user information(firstname,lastname , email).is there specific app setup these details??? the spring social facebook project extension spring social enables integration facebook https://spring.io/guides/gs/accessing-facebook/

Android SIP configuration doesn't work -

i little confused configuration of sip account. think here, clarify issues, based on sip stack documentation . all works fine, want add configuration working account. note, other methods protocol works fine. want use, configure methods: retryintervalsec() , delaybeforerefreshsec() , timeoutsec() . problem, methods doesn't work, below example of setting config. based on doc above delaybeforerefreshsec has value of 5 sec. registration refreshing after 5 sec, , when getting base value default config, it's equal default setting. but! refreshing doesn't firing after 5 sec! do ready magic? as can see, methods name "delaybeforerefreshsec", means use input seconds (for ex. delaybeforerefreshsec(5)). but, when setting methods value long (for ex. delaybeforerefreshsec(100000)), refreshing start firing every 5 sec! note, value above 500, start working periodic 5 sec! i know, maybe there verification , setting base value in source, if it's more higher val

ffmpeg - Purpose of XOR-ing with 0? -

so have static hash table , before adding code in table, index being xor-ed 0. why case if index of table declared integer? h = 0; h ^= (i << lzw_hash_shift); if (h >= lzw_hash_size) { h -= lzw_hash_size; } s->tab[h].code = i; s->tab[h].suffix = i; s->tab[h].hash_prefix = lzw_prefix_empty; this source code part of ffmpeg lzw encoder lib. in original code, hash function called other places in code, , makes no sense duplicate function avoid 1 line in special case when line nothing. thus, nothing when called cleartable (wasting negligible amount of time), sensible when called parameter not zero. in case, sole purpose showcase how blind copy-pasting bad, suppose :)

ios - How to make a tableview snap to cells centers ? (with gif animation illustration) -

Image
the thing want achieve gallery, can contain 300 images, using uiscrollview result in non optimized ram/cpu usage since doesn't pooling (correct me if i'm wrong), , has limitation on width, can't make 300 times width of screen (again correct me if i'm wrong). so right choice use uitableview 1 - how make scroll horizontally in gif ? 2 - how make snap cells centers ? edit i'm using this, gives result want has problem, has no tolerance how should swipe move next cell, still need help.. func scrollviewdidenddragging(scrollview: uiscrollview, willdecelerate decelerate: bool) { // find collectionview cell nearest center of collectionview // arbitrarily start last cell (as default) var closestcell : uicollectionviewcell = collectionview.visiblecells()[0]; cell in collectionview!.visiblecells() [uicollectionviewcell] { let closestcelldelta = abs(closestcell.center.x - collectionview.bounds.size.width/2.0) let celldelta

sqlite - Manually executing sql query in Android -

i have database in app using 3rd party library . library doesn't seem have drop table functionality. thinking directly change using sqliteopenhelper api. possible? i have created class extends sqliteopenhelper , give same db name 1 used in library. public class sqlitedatabasehelper extends sqliteopenhelper { // database info private static final string database_name = "mydatabase"; private static final int database_version = 1; private context context; public sqlitedatabasehelper(context context) { super(context, database_name, null, database_version); this.context = context; } @override public void oncreate(sqlitedatabase db) { } @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { l.w("old: " + oldversion + ", " + "new: " + newversion); if (oldversion != newversion) { db.execsql("drop table if exists &q

curl - How to write PHP code to execute two functions -

i have php script (for docker remote api), i'm using stopping container "remotely": <?php $cid = trim(file_get_contents('cid')); echo "$cid\n"; function httppost($url) { $ch = curl_init(); curl_setopt($ch,curlopt_url,$url); curl_setopt($ch,curlopt_returntransfer,true); curl_setopt($ch,curlopt_post, true); $output=curl_exec($ch); curl_close($ch); return $output; } $url = "http://172.17.0.1:2375/containers/$cid/stop?t=5"; echo "$url\n"; echo httppost($url) ?> it works! have piece of code "stop" two docker containers, instead of one. i thinking this: $cid = trim(file_get_contents('cid')); $pid = trim(file_get_contents('pid')); then how rest of code like, stop both of them? switch part: $url = "http://172.17.0.1:2375/containers/$cid/stop?t=5"; echo "$url\n"; echo httppost($url) to this $url1 = "http://172.17.0.1:2375

python 2.7 - maximum recursion depth error? -

so i'm new (3 days) , i'm on code academy, i've written code 1 of activities when run it displays maximum recursion depth error, i'm running in python console of code academy , simultaneously on own ipython console. hint on page not helpful, can explain how fix this? def hotel_cost(nights): return (nights * 140) def plane_ride_cost(city): if plane_ride_cost("charlotte"): return (183) if plane_ride_cost("tampa"): return (220) if plane_ride_cost("pittsburgh"): return (222) if plane_ride_cost("loas angeles"): return (475) def rental_car_cost(days): cost = days * 40 if days >= 7: cost -= 50 elif days >= 3: cost -= 20 return cost def trip_cost(city, days): return hotel_cost(nights) + plane_ride_cost(city) + rental_car_cost(days) maybe: def plane_ride_cost(city): if city == "charlotte": return (1

node.js - How do I check if the exact string I am searching for is listed in a file? -

i trying write function search given string(exact string) in file , prompt if listed in file in node.js. have tried below script lists string if search string listed substring in file. have message.txt include following words: bat bait can cat my script search string in file var fs = require('fs'); fs.readfile('message.txt', function (err, data) { var searchstr = "bat"; if (err) throw err; if(data.indexof(searchstr) < 0){ console.log("string not found"); } else{ console.log("string found!"); } }); so, here searching bat using searchstr apparently output "string found". now, problem is, if give at search string, output "string found" because "at" substring of bat , cat per file. but, i'd function output "string not found" when search at . you can use regular expression here: /\bat\b/ will match a

html5 - How can I replicate this with css? -

Image
so playing around css, , wanted give titles specific style. thinking image made here: i tried google people wanted same, couldn't find looking for. this have far: .test { position: relative; font-size:40px; height:40px; width:400px; } .test>span { display: block; overflow: hidden; position: absolute; left: 0; width: 100%; height: 60%; color: #31ff5a; } .test>.top{ z-index:2; top:0; } .test>.bottom{ color: black; height: 100%; z-index:1; bottom: 0; } <div class="test"> <span class="top">text</span> <span class="bottom">text</span> </div> any 1 of can me out? or atleast in right direction :p thanks! use border radius property. .test { position: relative; font-size:40px; height:40px; width:400px; } .test>span { display: block; overflow: hidden; position: absolute; left

xml - I want the android screens like this the upper trapeziam shape and the picture should be changed dynamically -

Image
enter image description here ` <!-- colored rectangle--> <item> <shape android:shape="rectangle"> <size android:width="100dp" android:height="50dp" /> <solid android:color="#fad55c" /> </shape> </item> <!-- these rectangles right side --> <item android:top="63dp" android:bottom="-40dp" android:right="-25dp"> <rotate android:fromdegrees="-42"> <shape android:shape="rectangle"> <solid android:color="#ffffff" /> </shape> </rotate> </item> ` i want make trapezium shown @ upper half please me in making screen greatfull if want vector drawable: trapezium.xml <vector android:height="24dp" android:viewportheight="300.0" android:viewportwidth="480.0&qu

ruby on rails - Assignment Branch Condition is too high -

my code is: def send_deliverer_push_notification(order_fulfillment, parse_events) shopper_id = order_fulfillment.shopper_id order = order.find_by(id: order_fulfillment_id) user_id = order.user_id role_name = shopper.find_by(id: shopper_id).roles.pluck(:name).first batch_id = batch.find_by(shopper_id: shopper_id).id message = "order # #{order_fulfillment.order_id} ready pick-up" parsehelpers.publish_batching_status(user_id, *parse_events, message) { shopper_id: shopper_id, role: role_name, task: order_fulfillment.shopper_status, batch_id: batch_id, fulfillment_number: "#{order.order_number}-#{order_fulfillment.store_id}" } end end and assignment branch condition size send_deliverer_push_notification high. [16.16/15] . how can fix it? from example clear don't need many of intermediary variables , therefore assignments. param

Websphere ejb pool -

the documentation here http://www.ibm.com/support/knowledgecenter/ss7jfu_7.0.0/com.ibm.websphere.express.doc/info/exp/ae/rejb_ecnt.html mentions minimum of 50 , maximum of 500 instances created default per ejb. lets @ given point of time 500 clients trying use service. mean here after @ time there 500 instances? or server destroy instances after period of time , when there no incoming clients? after reading further came across called hard limit h forces/tells container not create more specified maximum number of instances. so understood in case of 50,500 at point there max number of instances(500). if more clients trying connect, server create new instance(501, 502, 503....) per client , destroy after serving client. can tell me if right? pooling ejb instances allow save system resources. let's need 100 instances of ejb @ given point. initialize beans, process logic , destroy them. if need additional 100 instances after that, need on again. puts strain on

python 3.x - Removing strings that match multiple regex patterns from pandas series -

i have pandas dataframe column containing text needs cleaned of strings match various regex patterns. current attempt (given below) loops through each pattern, creating new column containing match if found, , loops through dataframe, splitting column @ found match. drop unneeded matching column 're_match'. while works current use case, can't think there must more efficient, vectorised way of doing in pandas, without needing use iterrows() , creating new column. question is, there more optimal way of removing strings match multiple regex patterns column? in current use case unwanted strings @ end of text block, hence, use of split(...)[0] . however, great if unwanted strings extracted point in text. also, note combining regexes 1 long single pattern unpreferrable, there tens of patterns of change on regular basis. df = pd.read_csv('data.csv', index_col=0) patterns = [ '( regex1 \d+)', '((?: regex 2)? \d{1,2} )', '( \d{0,2

c# - How to distinguish between two classes with the same name (and namespace) in 2 DLL's? -

Image
i've got 2 dll's - common.dll , cfw.infrastructure.sdk.dll . both dll's contain following class: cfw.common.hashing.blockhasher i have test project references both dll's. when try test blockhasher, following error: i test 1 in cfw.infrastructure.sdk.dll . because qualified names same can't fix 'normal' using. external aliasses can used. 1. add alias dll reference open solution explorer. navigate dll , add alias it. 2. reference alias add following the c# file (must on top): extern alias sdk; 3.add usings distinguish: i've added classes gave problems usings: using blockhasher = sdk.cfw.common.hashing.blockhasher; using signingalgorithm = sdk.cfw.common.hashing.signingalgorithm; 4.done! got idea extern alias walkthrough .

Is it a better practice to use Reference types or primitive types in Java? -

this question has answer here: when use wrapper class , primitive type 9 answers is considered better practice use , manipulate reference types instead of primitive types in java ? we see java programs mixing both of them, better use primitive types or reference types ? or mix them according needs , criteria choose between primitive or reference type ? thanks assuming mean primitive wrapper types ( integer , boolean , etc.) , not reference types in general: when have choice (often don't: e.g. using api requires 1 or other, or use them generic type arguments, or want nullable), prefer primitive types, because on whole make code simpler , faster. be careful if need switch 1 another, because == still compile give different results... usually.

django - pip install askbot error - Command "python setup.py egg_info" failed with error code 1 -

i want install askbot app ( http://askbot.org/doc/install.html ). encountered error during installation. i've did below actions. 1) made virtual environment under ananconda (python 3.5.2 / ubuntu 14.04) 2) installed django 1.9.8 3) made django project myproject 4) modified settings.py connect mariadb 5) installed mysql client # sudo apt-get install libmysqlclient-dev # pip install mysqlclient 6) migrated python manage.py migrate 7) registered app installed_apps = [ 'myproject', ] but when try install askbot below, found error. (envask)root@localhost:~/vikander# pip install askbot collecting askbot downloading askbot-0.10.0.tar.gz (8.6mb) 100% |████████████████████████████████| 8.6mb 116kb/s complete output command python setup.py egg_info: traceback (most recent call last): file "<string>", line 1, in <module> file "/tmp/pip-build-vppvsnhk/askbot/setup.py", line 135 *********

ruby .map! or each for modifying an array in place -

i have following: article_results.keys |key| article_results[key].map! |a| a[:filename] = c.filename a[:sitename] = c.site_name end end as want add each element of each array within hash dynamically, reason a[:filename] , a[:sitename] blank when used. so want know if should using .each instead. guess i'd know what's main difference since both can used side-effects. i'm adding fyi, i'm using ruby 1.8.7 nice know how differs between versions (1.8.7 - 1.9+) well. p.s. know difference between .each , .map is, i'm asking .map! . #map has bit different semantics hashes has arrays (and think it's not consistent between versions of ruby). in general if looking array result of operation - #map friend, if want hash result of operation - you're better off #reduce : article_results.reduce({}) |hash, (key, value)| hash.merge(key => value.merge(filename: c.filename, sitename: c.sitename))

ios - Bridging headers importing framework into viewcontroller -

Image
i new ios coding , trying use aws sdk written in objective c. after trying day sdk working simple table scan in swift, trying use objective c. i set using aws mobile manager has headers , framework in project so working in ratesongsviewcontroller.swift file , want import frame work , write code access dynamodb in objective c. i thought import , start writing on obj c in swift file this: import foundation import uikit #import <awsdynamodb/awsdynamodb.h> class ratesongsviewcontroller: uiviewcontroller { but getting th error: consecutive statements on line must separated ';' what doing wrong? , have create new objective c files grab data aws or able because of header import write in objective c in swift file? thanks first, make sure project has swift header, if not can create manually from, build settings > swift compiler > objective-c bridging header then import objective-c classes bridging header file want access in .swift classe

xml - Remove extra value using XSL -

how remove value being generated after transformation. input: <response status="200"> <idlist> <idlists> <idsec> <idfield> <idfields> <id>123456</id> <idstate>done</idstate> </idfields> <idfields> <id>12345634</id> <idstate>failed</idstate> </idfields> </idfield> </idsec> </idlists> <code>56</code> <msg>yet</msg> </idlist> </response> xsl transforming it: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" version="1.0" encoding="utf-8

Sample SCALA code to convert xlsx file to csv -

i have excel files , have convert csv using spark scala can upload code or give link should spark scala code. and later have convert csv avro format using spark scala only. solution appreciable both thanks as said @maytham use apache poi this, there 1 project under development still in starting till use poi

Display django form error for each field in template and each correct data in template -

i new django , trying validate form data , if error occurs transfer data template page old values display in form. if possible want error message each data in dictionary views.py from django.shortcuts import render .forms import regform # create views here. def login(request): return render(request, 'login.html') def registration(request): if request.method == 'post': form = regform(request.post) if form.is_valid(): print "form valid" print form.cleaned_data user_data = { 'firstname':form.cleaned_data['firstname'], 'lastname':form.cleaned_data['secondname'], 'username': form.cleaned_data['username'], 'mail':form.cleaned_data['mail'], 'password': form.cleaned_data['password']} print user_data else:

python - Check if programm runs in Debug mode -

i use pycharm ide python programming. is there possibility check, whether i'm in debugging mode or not when run proframm? i use pyplot plt , want figure shown if debug programm. yes, have global boolean debug set myself, sexier solution. thank support! according documentation, settrace / gettrace functions used in order implement python debugger: sys.settrace(tracefunc) set system’s trace function, allows implement python source code debugger in python. function thread-specific; debugger support multiple threads, must registered using settrace() each thread being debugged. however, these methods may not available in implementations: cpython implementation detail : settrace() function intended implementing debuggers, profilers, coverage tools , like. behavior part of implementation platform, rather part of language definition, , may not available in python implementations. you use following snippet in order check if debuggin

php - Grocery Crud url redirection via javascript -

i trying use custom redirect on grocery crud on save button edit screen. can redirect using url fragment example below: $the_catalogue_id = $this->uri->segment(count($this->uri->segments)); $this->grocery_crud->set_lang_string('update_success_message', 'your data has been stored database.<br/>please wait while redirecting list page. <script type="text/javascript"> window.location = "'.base_url('catalogues/edit').'/'.$the_catalogue_id.'"; </script> <div style="display:none">' ); i need add window.location.hash end of redirect url, can't seem work. have far: $this->grocery_crud->set_lang_string('update_success_message', 'your data has been stored database.<br/>please wait while redirecting list page. <script type="text/javascript">

php - There was an error running the query [Unknown column 'test' in 'where clause'] -

this question has answer here: when use single quotes, double quotes, , backticks in mysql 10 answers i have database row called "username". need show value of other row depending on username logged in. so, have following script: $db = new mysqli('', '', '', ''); if($db->connect_errno > 0){ die('unable connect database [' . $db->connect_error . ']'); } $sql = <<<sql select * `users` username = $username sql; if(!$result = $db->query($sql)){ die('there error running query [' . $db->error . ']'); } while($row = $result->fetch_assoc()){ $text_cli = $row['text_cli']; $text_trad = $row['text_trad']; } and value of $username stored previously. and finally: <div id="text_cli"><?php echo $text_trad ?></d

sql server - Update Active Directory from PHP -

i have linked sql server active directory , trying use php create odbc connection pull in data. can read active directory fine when try , update using sql update, error msg 7390, level 16, state 2, line 1 requested operation not performed because ole db provider "adsdsoobject" linked server "adsi" not support required transaction interface. i know have use php's ldap functions not sure how rewrite ldap string use in php. best guess be: i tried (example string): ou=staff,dc=example,dc=internal but doesn't work. question is: assuming there no way of updating active directory sql view, how go updating ldap php?

apache spark - Move a C++ library to all executor nodes from driver -

i have c++ library in spark driver. move executor nodes, library called. how can that? assuming c++ library cannot rewritten in more spark friendly language ever reason, best/reliable approach be, wrap c++ library service preferably exposing rest interface. then use native rest calls access functionality.

sql server - Inserting a character in the beginning of a string in SQL -

i need change 'postalcode' column strings setting character 'a' @ beginning of string. i've tried this: update customers set postalcode = stuff(postalcode , 0 , 1 , 'a') but nothing... ideas? you can try use concat update customers set postalcode = concat('a', postalcode )

scala - Reading in multiple files compressed in tar.gz archive into Spark -

this question has answer here: read whole text files compression in spark 1 answer i'm trying create spark rdd several json files compressed tar. example, have 3 files file1.json file2.json file3.json and these contained in archive.tar.gz . i want create dataframe json files. problem spark not reading in json files correctly. creating rdd using sqlcontext.read.json("archive.tar.gz") or sc.textfile("archive.tar.gz") results in garbled/extra output. is there way handle gzipped archives containing multiple files in spark? update using method given in answer read whole text files compression in spark able things running, method not seem suitable large tar.gz archives (>200 mb compressed) application chokes on large archive sizes. of archives i'm dealing reach sizes upto 2 gb after compression i'm wondering if there effic

Factorial in D Language -

i have started d , trying write simple factorial program in d. there vectors of c++ in d? wanted use vectors create dynamic function compute factorial. why don't use std.bigint ? - it's optimized arbitrary-precision numerics. ulong ( 2^64 ) can compute factorial until 20 , use-case inline-table might make more sense. here's example bigint : import std.bigint : bigint; bigint factorial(int n) { auto b = bigint(1); foreach (i; 1..n + 1) b *= i; return b; } void main () { import std.stdio : writeln; factorial(10).writeln; // 3628800 factorial(100).writeln; // 9.33 * 10^157 } if want learn more dynamic arrays, maybe dlang tour pages arrays or slices might you?

c# - How to specify DataTemplate for object -

i have following code: public class fieldviewerselector : imultivalueconverter { public datatemplate percenttemplate { get; set; } public datatemplate filesizetemplate { get; set; } #region ivalueconverter members //.... #endregion } <commonconverters:fieldvalueconverter x:key="fieldvalueconverter" /> <commonconverters:percentvalueconverter x:key="percentvalueconverter" /> <commonconverters:filesizevalueconverter x:key="filesizevalueconverter" /> <commonconverters:fieldviewerselector x:key="fieldviewerselector"> <commonconverters:fieldviewerselector.filesizetemplate> <datatemplate> <!--datatemplate same--> </datatemplate> </commonconverters:fieldviewerselector.filesizetemplate> <commonconverters:percentvalueconverter> <datatemplate> <!--datatemplate same--> </datatemplate>

reactjs - How to execute a click handler before the end of the ripple effect in Material UI? -

using <flatbuttin> (or other control matter), click handler (or redirection) happens once visual "ripple" effect has finished. this makes ui i'm working on feel sluggish, because once button effect starts, have fetch resources in backend, , user must wait again. i understand interest of giving feedback on user actions, ripple effect feedback blocks further processing in app. is there way bypass ripple delay , execute click handler right away - without hiding ripple effect? use react-tap-plugin along ontouchtap handlers

Arduino not working after a while -

my arduino stops working after while. here's code: //pin.h header file #ifndef pin_h #define pin_h class pin{ public: pin(byte pin); void on();//turn led on void off();//turn led off void input();//input pin void output();//output pin private: byte _pin; }; #endif //pin.cpp members definitions #include "arduino.h" #include "pin.h" pin::pin(byte pin){//default constructor this->_pin = pin; } void pin::input(){ pinmode(this->_pin, input); } void pin::output(){ pinmode(this->_pin, output); } void pin::on(){ digitalwrite(this->_pin, 1);//1 equal high } void pin::off(){ digitalwrite(this->_pin, 0);//0 equal low } //this main code .ino #include "pin.h" pin led[3] = {//array of objects pin(11), pin(12), pin(13) }; const byte max = sizeof(led); //main program---------------------------------------------------------------------------------- void setup() { for(int = 0; < max; i++)

How to store emoji string in Database using Laravel with Orm Query -

i want store special char in database vice versa emotive when try save in database question marks. please in database.php file, make sure set charset , collation utf8mb4 : 'mysql' => [ 'driver' => 'mysql', 'host' => env('db_host', 'localhost'), 'database' => env('db_database', 'forge'), 'username' => env('db_username', 'forge'), 'password' => env('db_password', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', and emoji column should string: $table->string('emoji');

C# ProcessStartInfo always run duplicate process -

Image
i have bit of code open cmd , run command output, it's running twice times, , output missing. here code, re-check many times can't figure out cause. using system; using system.diagnostics; using system.io; using system.security.cryptography; using system.security.permissions; using system.text; using system.threading; namespace commandhandler { class program { public static string change_file = appdomain.currentdomain.basedirectory + @"change\change.txt"; public static void main() { //console.setwindowsize(console.largestwindowwidth, console.largestwindowheight); console.backgroundcolor = consolecolor.black; console.foregroundcolor = consolecolor.green; //processstartinfo startinfo = new processstartinfo("cmd", "/c php d:/test.php") processstartinfo startinfo = new processstartinfo("cmd", "/c d:\\php64\\php d:\\xampp\\htdocs\\xxx\

PHP Javascript Array -

hi i'm novice php developer least , i'm pretty stuck. i'm trying below code working know need foreach loop or similar i'm way out of depth, i'm not sure how working, know of basic stuff i'm lost. basically receipt when tab settled. searches mysql database relevant items , should print them on receipt. i know mysql query not linked output @ bottom don't know how it. <html lang="en"> <head> <title>receipt</title> </head> <body> <?php $invoicenum = $_post['invoicenum']; $name = $_post['name']; $netrev=$invoicenum - 1; ?> items: <? $itemquery = mysql_query("select * sales invoicenum = '$netrev' , tabname = '$name'"); $result = array(); while($row = mysql_fetch_array($itemquery)) { $result[] = $row['itemname']; } echo json_encode($result); $amounts = json_decode($result['am

Parsing out text from a string using a logstash filter -

i have apache access log parse out text within request field: get /foo/bar?contentid=abc&_=1212121212 http/1.1" what extract , assign 12121212122 value value based off of prefix abc&_ (so think need if statement or something). prefix take on other forms (e.g., ddd&_) so say if (prefix == abc&_) abcid = 1212121212 elseif (prefix == ddd&_) dddid = <whatever value> else nothing i have been struggling build right filter in logstash extract id based on prefix. great. thank you for use grok filter. for example: artur@pandaadb:~/dev/logstash$ ./logstash-2.3.2/bin/logstash -f conf2 settings: default pipeline workers: 8 pipeline main started /foo/bar?contentid=abc&_=1212121212 http/1.1" { "message" => "get /foo/bar?contentid=abc&_=1212121212 http/1.1\"", "@version" => "1", "@timestamp" => "2016-07-28t15:59:12.787z",

How to fix this whitespace issue between images in HTML? -

requirement i want create image multiple hyperlinks on , email someone. what did i used photoshop's slicing method , added url slices. saved composition web. work on recipient's end, uploaded each slice online photo hosting website , edited html tag img src="local photo location" img src = "online photo location". problem multiple white-spaces between each slice distorts overall image. code <html> <head> <title>general infosheet july 25</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <!-- save web slices (general infosheet july 25.jpg) --> <table id="table_01" width="800" height="1034" border="0" cellpadding="0" c

vba - 2046 error when trying to run Macro -

docmd.setwarnings (warningsoff) docmd.gotocontrol ("txtvisitorlastname") sendkeys "-" me.dirty = false pause 250 docmd.runmacro ("deletecurrentrecord") <--- error here pause 250 docmd.close docmd.openform ("languageselection") docmd.setwarnings (warningson) this in vba within access 2016 project. not sure can it. assistance great. other info error it says argument 223

c++ - friend keyword for operator overloading -

i tried write simple example <<-operator-overloading. before, i've never used keyword "friend". not work without it. mistake did or why need friend keyword here? class rational{ public: rational(double num, double count) : n(num),c(count){} rational& operator+=(const rational& b){ this->n+= b.n; this->c+= b.c; return *this; } friend std::ostream& operator<<(std::ostream& os, const rational& obj) { std::cout << obj.n << "," << obj.c << std::endl; return os; } private: double n; double c; }; thanks you want stream objects internals not accessible through class' public interface, operator can't @ them. have 2 choices: either put public member class streaming class t { public: void stream_to(std::ostream& os) const {os << obj.data_;} private: int data_; }; and call operator: inline std::ostream& operator<<(std::os

Grouping partial table data on SQL -

i have table data below. in scenario, employee can have either 1 or 0 or (1 , 0) never employee exists combination of multiple 1 , multiple 0. employee status <table> <tr> <th> employee</th> <th> status </th> <tr> <tr> <td>abc </td> <td> 1</td> </tr> <tr> <td>abc </td> <td> 1</td> </tr> <tr> <td>pqr </td> <td> 1</td> </tr> <tr> <td>xyz </td> <td> 0</td> </tr> </table> below expected output. <table> <tr> <th> employee</th> <th> status </th> <tr> <tr> <td>abc </td> <td> $</td> </tr> <tr> <td>pqr </td> <td> yes</td> </tr> <tr> <td>xyz

How to use crop from PDF to PNG tiles using ImageMagick -

good day, i have large issue cropping pdf png pdf 1,6mb (2500x2500) , 1 process takes 7-10min , generates 700mb of temporary files. e.g. exec("convert -density 400 'file.pdf' -resize 150% -crop 48x24@ png32:'file_%d.png'"); one pdf must generate pngs size 25% 200% here generate attributes density, size resizing in % , grids row , column count $x = 0; $y = 0; ($i = 25; $i <= 200; $i += 25) { $x += 8; $y += 4; $convert[$i] = ['density' => (($i < 75) ? 200 : ($i < 150) ? 300 : ($i < 200) ? 400 : 500), 'tiles' => implode("x", [$x, $y])]; } after launch converter 1 after 1 , it's extremely expensive in time. $file_cropper = function($filename, $additional = '') use ($density, $size, $tiles) { $pid = exec("convert -density $density ".escapeshellarg($filename)." -resize $size% -crop $tiles@ ".$additional." png32:".escapeshellarg(str_replace(".pd

How does HTML Local Storage behave when used on a PC without any kind of server? -

i'm writing simple javascript app ideally can run directly user's hard drive, , need store 20kb locally. how data stored persist, say, when user moves location of files? (html , javascript files etc). count different origin, make previous data unaccessible until files moved back? how can script identify itself? there best practice this? or need have local server? every file:// path considered different domain. if move location of html/js files, end new localstorage container. can't access same localstorage 2 different files in same place; e.g. "file1.html" , "file2.html" access different localstorage instances, if in same directory , loading same js file.

javascript - Use of brackets in AngularJS -

my question might stupid having hard time trying determine whether use {} or {{}} or nothing in html angularjs. i came accross following : 1/ ng-src = "{{ mysource }}" 2/ ng-class = "{ active:tab===2 }" 3/ ng-repeat = "foo in foos" i think understand 3/ instruction not text replacement in 1/ why use simple brackets in 2/? thanks lot in advance help! burger the curly braces in example 2 being used create object literal (see point 2 here ) keys map class name , values map class value. it's same braces used when writing things this: var mydata = { x: 5, y: 6 }; the double braces in example 1 used angularjs templates values inserted html angular. example 3 uses normal html attributes (exactly <div class="test"> ).

javascript - (reactjs) Include local Images in react component -

i have following component, renders image using html img src=".." export default class landing extends component{ render() { return( <div classname="topimg"> <img src={'test.jpg'}/> </div> but page not display image. folder structure following /layout/landing.jsx /layour/test.jpg it works web urls not local files. not sure how building app attach images component require ing them first. way app knows include image (referenced relatively component) before rendering. export default class landing extends component { constructor( props ) { super(props); this.images = { test: require('./test.jpg') }; } render() { return ( <div classname="topimg"> <img src={this.images.test}/> </div> ); } }

php - HOW to relocation if a query doesnt exist -

if query exist http://localhost/page.php?pid= first-page open me, work, if write http://localhost/page.php?pid= second-page , second-page doesnt exist still open page , give error because doesnt find... i understand why give me error, dont know how relocation url if write wrong query session_start(); require "conx.php"; // determine page id use in our query below --------------------------------------------------------------------------------------- if(isset($_get['pid'])){ $pageid = preg_replace('[^a-z0-9_]', '', $_get['pid']); } // $tag santized , ready database queries here // query body section proper page $stmt = $con->prepare('select pagebody pages linklabel = ?'); $stmt->bind_param('s', $pageid); $stmt->execute(); $result = $stmt->get_result(); while ($row = $result->fetch_array()) { // $row $body = $row["pagebody"]; } so how can relocation url address if q

PHP fetch data and insert into html table -

select date, dayname(date) day , time booking date between curdate() , curdate() + interval 7 day after query, return result of day , specific time. query result and populate date html table. however, real problem that, when result return more 1 result, populate table according number or result. example this php code use loop through result , function checkhari() { $sql = "select date, dayname(date) hari , time booking date between curdate() , curdate() + interval 7 day"; $results = mysql_query($sql); $num_rows = mysql_num_rows($results); return $results; } $check_hari = checkhari(); while ($row = mysql_fetch_assoc($check_hari)) { <?php if( $hari = 'wednesday' ) { ?> <tr> <td>wednesday</td> <?php if ($time >= 8 && $time < 10) { echo '<td id="wednesday0810" class="blacked"><small>booked</small></td>'; } else { echo '<td><

Ruby - Capybara verifying parent class -

i have scenario if id "< prev" parent class must "disabled" , if id not ="< prev" parent class should not have "disabled" <li class="disabled"> <a href="#" id="< prev"> prev </a> </li> can me writing code using ruby, capybara assuming you've found 'a' element , have in variable named link if link[:id] == "< prev" expect(link).to match_selector("li.disabled > a") else expect(link).to match_selector("li:not(.disabled) > a") end should verify specified

ios - How to rename storyboard and have links from other storyboards preserved -

Image
i have 2 storyboards in xcode project. first named main , second settings . main storyboard has storyboard reference settings . i want rename settings storyboard appsettings . when rename through xcode project navigator, main storyboard reference settings not automatically updated , project fails compile. of course, can manually update broken reference, wonder there way of renaming storyboard in xcode automatically update existing storyboard references? yes, xcode's find navigator can perform find & replace operation includes references inside storyboards. search "settings" , replace "appsettings". click "preview" can choose relevant instances of "settings" replace (i'm assuming word appear in unrelated places, since it's rather common.) afterwards, still have rename file usual.

winforms - C# Stop the flow of the program and reset it without restarting -

i writing simple windowsform program radiobuttons, buttons, , customary implemented inputbox. relevant program logic: click 1 of radiobutons groupbox -> enable button -> clicking button initiates custom inputbox asking 1 value , yes/cancel buttons. | v if yes button clicked -> proceed logic flow if cancel button clicked -> popup window appears ("your input cancelled, want exit application?") yes/no buttons | v if yes button clicked -> exit program if no button clicked -> apply same logic if reset button clicked, reset whole program without restarting <---------this trying achieve (all relevant methods provided below) what problem? when click reset button, applies needed actions , stops, waiting further input. exact result trying achieve when click no button in popup window mentioned above. however, not case. during debug mode, after clicked no button, goes through entire logic of reset button wanted, but right after that,