Posts

Showing posts from May, 2015

c++ - How to optimize binary search of a vector? -

i trying implement find method on sorted vector of key value pairs. right performing slower map.find(key). theoretically should faster because vector can take better advantage of cpu caching because of contiguous memory. i'm wondering if there wrong implementation , if there way can optimize it? don't think using standard algorithm option here, because closest possible option lower_bound , incur overhead of checks have perform verify whether or not found anything. beyond that, lower_bound require me construct pair (plus wrapper put around it) give value i'm searching for, incurring more unnecessary overhead. flatmap<key, value, comparator>::findimp(const key_type &key) { typename vectortype::iterator lower = d_elements.begin(); typename vectortype::iterator upper = d_elements.end(); typename vectortype::iterator middle; while(lower < upper) { middle = lower + (upper-lower)/2; if(d_comparator(middle->data().first, key)){ ...

javascript - Google maps API key works on a site, but does not work on an other site though referer for the other site is added -

i have site using javascript maps api , works fine api key. created second site under different domain , want use same api key that. added domain of second site list of referers of api key, referer list has 2 entries: domain of first site , domain of second site. yet key refuses work on second site, while it's working fine on first site. this error i'm getting on second site: google has disabled use of maps api application. provided key not valid google api key, or not authorized google maps javascript api v3 on site. what causes error if key working fine on first site , added second site key's enabled referers?

Deselect text in richtextBox without losing highlighted text c# -

c# language, visual studio 2010 express is possible deselect text richtextbox without losing actual highlighted text? if highlight selected text lose old one, if select end of text lose have highlighted. thanks lot!!! here partial code: (i call code if test passed , want highlight string makes test passed) int index = tb_log.text.indexof(s.stringparse); tb_log.select(index, s.stringparse.length); tb_log.selectionbackcolor = color.lime; tb_log.selectioncolor = color.black; tb_log.selectionfont = new font(tb_log.font, fontstyle.bold); then keep serial's data readable user, use function scroll text of richtextbox till end of text: tb_log.selectionstart = tb_log.text.length; tb_log.selectionlength = 0; tb_log.scrolltocaret(); after command old selected text, highlighted in green, disappears. my goal, again, keep background color of text highlighted before , high...

python - Scipy.optimize.leastsq returns the initial guess not optimization parameters -

i trying use leastsq scipy.optimize module find best fit line, there 3 unknown parameters. have written out code program runs , returns initial guess optimization parameters (essentially leastsq function nothing in program). here simplified code, data using. import numpy np import matplotlib.pyplot plt scipy import optimize #leastsq levenberg-marquadt algorithm = [6.011737374832778931e+10, 1.253141174941418152e+11, 1.297179270983954620e+11, 1.577611269699349976e+11, 2.238721138568337708e+11, 4.315190768277650146e+11, 5.407543229455815430e+11, 5.382697825162881470e+11, 5.308844442309879150e+11, 4.528975799036213379e+11, 2.890679882365477905e+11, 2.798981319634357300e+11, 2.798981319634357300e+11] b = [1.228900000000000006e+02, 1.465500000000000114e+02, 1.761399999999999864e+02, 2.057199999999999989e+02, 2.353100000000000023e+02,2.648999999999999773e+02, 2.945000000000000000e+02, 3.315000000000000000e+02, 3.758999999999999773e+02, 4.203199999999999932e+02, 4.647400000000000091e+...

php - MYSQL: where colunm IN(Any_value) -

i trying make dynamic clause. getting array of check boxes in php following code $brand = array(); if(isset($_get['brand']) && !empty($_get['brand'])) $brand=$_get['brand']; $brand_str = implode("' , '",$brand); } my sql query is $sql="select distinct * products brand in('$brand_str')"; if brand not defined gives error or no row fetched simple problem can solved using following approach. my approach: i use variable 'flag_for_filter_brand' inside if statement if flag_for_filter_brand=1 query $brand = array(); $flag_for_filter_brand=false; if(isset($_get['brand']) && !empty($_get['brand'])) $brand=$_get['brand']; $brand_str = implode("' , '",$brand); $flag_for_filter_brand=true; } if(flag_for_filter_brand); $sql="select distinct * products brand in('$brand_str')"; else $sql="select di...

javascript - AngularJS: Add and Edit List Items Using Same Input -

i'm trying edit list items in same input field use adding items. have at http://jsbin.com/retadexu/188/edit and http://jsbin.com/retadexu/192/edit the first example works, have assign temporary object's .name property list object: $scope.currentitem.name = $scope.newtodo.name; the second, assign whole object, doesn't work: $scope.currentitem = $scope.newtodo; so if had more "name" property, have assign values? instead of keeping track of current object, keep track of index in array of item. $scope.savetodo = function(todo) { if ($scope.editmode) { $scope.currentitem = $scope.newtodo; $scope.todos[$scope.currentitemindex] = $scope.newtodo; $scope.editmode = false; } else { $scope.todos.push($scope.newtodo); } $scope.newtodo = ""; }; $scope.edittodo = function(todo) { $scope.editmode = true; $scope.newtodo = angular.copy(todo); $scope.currentitemindex = $scope.todos.indexof(todo); }; i moved...

midi - Building a sysex message in Java for Garage band -

i trying control garageband sequencer sending midi messages java program. works shortmessage. example, can record c3 in garageband in way : shortmessage mymsg = new shortmessage(); mymsg.setmessage(shortmessage.note_on, 0, 60, 93); receiver receiver = midisystem.getreceiver(); receiver.send(mymsg, -1); now send sysex message "control" sequencer, example, start recording. building sysexmessage harder shortmessage since requires build array of bytes. in particular, 1 must specify "manufacturer id". looking informations on web issue gave me feeling not going in right direction because nothing seems clear. familiar problem ? sysex messages can create byte array: byte[] mmcstart = new byte[] { (byte)0xf0, 0x7f, 0x7f, 0x06, 0x02, (byte)0xf7 }; sysexmessage mymsg = new sysexmessage(mmcstart); manufacturer ids used prevent conflicts when using vendor-specific messages. standardized messages use reserverd manufacturer ids 7e (for non-realtime message...

Iterate an iterator by chunks (of n) in Python? -

this question has answer here: python generator groups iterable groups of n [duplicate] 9 answers can think of nice way (maybe itertools) split iterator chunks of given size? therefore l=[1,2,3,4,5,6,7] chunks(l,3) becomes iterator [1,2,3], [4,5,6], [7] i can think of small program not nice way maybe itertools. the grouper() recipe itertools documentation's recipes comes close want: def grouper(n, iterable, fillvalue=none): "grouper(3, 'abcdefg', 'x') --> abc def gxx" args = [iter(iterable)] * n return izip_longest(fillvalue=fillvalue, *args) it fill last chunk fill value, though. a less general solution works on sequences handle last chunk desired is [my_list[i:i + chunk_size] in range(0, len(my_list), chunk_size)] finally, solution works on general iterators behaves desired is def grouper(n...

php - SSL and .htaccess redirect -

i developing website has ssl certificate applied it! want people visiting site https , not http. i have been able achieve with... <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{https} off rewriterule (.*) https://%{http_host}%{request_uri} </ifmodule> but default www.mysite.co.uk , not mysite.co.uk automatically! able remove index.php using this... rewritecond %{the_request} ^[a-z]{3,9}\ /(.*)index\.php($|\ |\?) rewriterule ^ /%1 [r=301,l] but stumped on www. bit! gratefully appreciated! - phillip dews <ifmodule mod_rewrite.c> rewritecond %{http_host} ^mysite.co.uk rewriterule (.*) https://www.%{http_host}%{request_uri} rewritecond %{https} off rewritecond %{http_host} ^mysite.co.uk rewriterule (.*) https://%{http_host}%{request_uri} </ifmodule> this make sure have www , https in url. can test at: http://htaccess.madewithlove.be/

eclipse - how to convert a phonegap android app into ios app? -

my colleague created android app using phonegap in eclipse on windows. want convert app ios app using xcode. followed procedure mentioned here convert phonegap app ios but emulator displays ui of app. how can import functionalities coded on ui?

c++ - How to manipulate a string to lower case and store in same variable -

i have piece of code asks user input, type "string" , simple process, want whatever user inputs converted using tolower() function. supposed do, can't seem assign same variable. please? #include <locale> #include <string> #include <iostream> //maybe other headers, headers aren't problem, not going list them while (ncommand == 0) { locale loc; string scommand; cin >> scommand; (int = 0; < scommand.length(); ++i) { scommand = tolower(scommand[i],loc); cout << scommand; } for example if user types in scommand h how want if user types in or or help scommand should 'help' either way you're assigning string character when want assign character stored @ position lower case version. therefore change this: scommand = tolower(scommand[i], loc); to this: scommand[i] = tolower(scommand[i], loc); // ...

javascript - FireFox editableCellTemplate only enabling editing one time -

in firefox, have editablecelltemplate of: <input type="number" ng-class="\'colt\' + col.index" ng-input="col_field" ng-model="col_field" /> the first time user clicks, allows him modify cell. subsequent attempts not enter edit mode. using version 2.0.7 of grid. however, works fine in chrome , ie. there error in firefox console once trying edit same cell: typeerror: current null angular.js:9186 here jsfiddle illustrate problem in firefox: try modifying 'age' column. http://jsfiddle.net/zlaja1983/38hpb/ i think thay should change type="number" type="text". it's worked me!

Add third party framework to Xcode subproject or main project in iOS app -

my xcode project "mymainapp" has static library type xcode subproject called "mylib". need use third party ios frameworks in ios app. want add/link them against mylib , not against mymainapp can make mylib reusable , self-contained use in other ios apps too. few view controllers in mymainapp use 1 of view controller part of mylib. view controller in mylib uses functionality classes reside inside third party framework. problem facing if add third party frameworks mylib , don't add them mymainapp, linker error "lexical or preprocessor issue. xxx.h file not found". works if addd frameworks both mymainapp , mylib not want. have made sure framework search paths , header search paths correct. i've been unable find reference apple in such scenario. i'd know best practice adding/linking third party frameworks , libraries xcode subproject of type static library. there solution overcome linker error , add frameworks static library project? ...

mysql - Is it better to have many columns, or many tables? -

imagine hypothetical database, storing products. each product have have 100 attributes, although given product have values set ~50 of these. can see 3 ways store data: a single table 100 columns, a single table few (say 10 columns have value every product), , table columns (product_id, attribute, value). i.e, eav data store. a separate table every columns. core products table might have 2 columns, , there 98 other tables, each 2 columns (product_id, value). setting aside shades of grey between these extremes, pure efficiency standpoint, best use? assume depends on types of queries being run, i.e. if queries several attributes of product, or value of single attribute several products. how affect efficiency? assume mysql database using innodb, , tables have appropriate foreign keys, , index on product_id. imagine attribute names , values strings, , not indexed. in general sense, asking whether accessing big table takes more or less time query many joins. i found similar...

javascript - $watch fires only on first update of window.innerWidth -

i'm trying setup app watch window.innerwidth property , add property $scope based on width. works first time, not on resize after that. $digest method not being called? if why not? module //initialize angular module include route dependencies var app = angular.module("selfservice", ['ngroute']); app.config(function ($routeprovider) { $routeprovider .when('/', { templateurl:"partials/login.html", controller:"login" }); }); controller app.controller("login", ['$scope', function ($scope) { $scope.$watch( function () { return window.innerwidth; }, function (newval, oldval) { if (newval < 700) { $scope.classexpand = 'expand'; } else { $scope.classexpand = ''; } console.log(newval, oldval); }); }]); view <div class="small-12 column"> ...

unity3d - How to access the device contacts list on Android using Unity c# -

is possible access android phone's contact list using unity c#? the idea being that, inside our app, can view phone contacts , add them 1 @ time app. maybe has come across plugin this? yes it's possible. have create plugin connecting android native functions c# in order contacts , information. here ( contact list plugin ) example of plugin behaviour. little slow, can create own plugin manual ( building plugins android ). hope helps you.

android - MapFragment issue in onSelectFragment view -

i've created fragment, fragment01 , extends mapfragment . problem because doesn't extend fragment anymore, onselectfragment part of mainactivity doesn't work anymore. need change in mainactivity work before? error i'm getting on line newfragment = new fragment01(); says type mismatch: cannot convert fragment01 fragment . being noob, tried newmapfragment = new fragment01(); didn't it. mainactivity public class mainactivity extends fragmentactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); fragmentmanager fm = getsupportfragmentmanager(); fragmenttransaction transaction = fm.begintransaction(); startfragment startfragment = new startfragment(); transaction.add(r.id.fragment_placeholder, startfragment); transaction.commit(); } public void onselectfragment(view view){ fragment newfragment; if (view == findviewbyid(r...

css - Aligning NavBar Right cause NavBar to disable -

i'm trying right align navbar, whenever add float:right, navbar moves right, seems become disabled. see here: goo.gl/46yurt code: /** * 4.2 navigation * ---------------------------------------------------------------------------- */ .main-navigation { clear: both; margin: 0; max-width: 100%; min-height: 45px; position: relative; float:right; } i'm using custom modified version of twentythirteen theme. ideally, i'd have menu beside logo @ top, both centered. float:right seems positioning nav bar beneath element. adding z-index:1 fixes that, you'll still have adjust position of bar.

android - access facebook page information -

i want facebook page about, description, location, basic info etc. have got access token page. getting likes of page this: public void getlikes (string id,final textview likes,final int position) { session session = session.getactivesession(); bundle params = new bundle(); params.putstring("id", id); params.putstring("fields", "likes"); request request = new request(session, "search", params, httpmethod.get, new request.callback() { @override public void oncompleted(response response) { try { jsonobject res = response.getgraphobject().getinnerjsonobject().getjsonarray("data").getjsonobject(0); if (res.length()>1){ likes.settext(string.valueof(res.getint("likes"))); preferences.data.getdata().get(position).setlikes(string.valueof(res.getint("li...

xcode - Objective - C how do I change the color of UINavigationItem -

Image
how change colour of uinavigationitem black white? i have tried following in lhappdelegate.m: [[uinavigationbar appearance] settintcolor:uicolorfromrgb(0xffffff)]; [[uinavigationbar appearance] setbartintcolor:[uicolor greencolor]]; changes whole bar green, trying change colour of black text 'update tasks' if want have solid color navigation bar in ios 6 similar ios 7 use this: [[uinavigationbar appearance] setbackgroundimage:[[uiimage alloc] init] forbarmetrics:uibarmetricsdefault]; [[uinavigationbar appearance] setbackgroundcolor:[uicolor greencolor]]; in ios 7 use bartintcolor this: navigationcontroller.navigationbar.bartintcolor = [uicolor greencolor]; or [[uinavigationbar appearance] setbartintcolor:[uicolor greencolor]]; edit 1 to update text color, use below. [[uinavigationbar appearance] settitletextattributes:@{nsforegroundcolorattributename : [uicolor whitecolor]}];

database - C# adding large bytearray(image) as paramter to dbcommand -

i'm in process of creating manual db layer project. i've stumbled on problem when tried store byte arrays (images) larger 8k. normally use following create commands , fill parameters: dbcommand cmd = new sqlcommand("insert test1 values (@mail, @picture)"); i=cmd.declareparameter(cmd, "mail", dbtype.string, "mail"); if (i>0) { cmd.parameters[i].value = maildata; } (the above cut multiple methods use). when try add picture (which byte[] ) problem need use sqldbtype.varbinary there. i've seen few solutions use .parameters.add add have takes 1 (and not 2 parameters in examples saw). when try create own parameter cmd.createparameter dbtype takes dbtype , not want sqldbtype . what have here able add byte[] parameter (for byte arrays larger 8k)? tnx when try create own parameter cmd.createparameter dbtype takes dbtype , not want sqldbtype that's because declared command dbcommand instead of sqlcommand ...

hyperlink - Difference between rdf:seeAlso and rdfs:seeAlso -

what difference between rdf:seealso , rdfs:seealso ? when can use rdf:seealso , when can use rdfs:seealso ? can examples? first, note rdf , rdfs prefixes commonly used reference rdf syntax , rdf schema vocabularies respectively. rdf typically used http://www.w3.org/1999/02/22-rdf-syntax-ns# , rdf:seealso expand http://www.w3.org/1999/02/22-rdf-syntax-ns#seealso . however, if follow vocabulary reference, won't find term defined seealso . rdf syntax used basic types such rdf:type, rdf:xmlliteral, , rdf:langstring. rdf schema vocabulary typically bound rdfs prefix, , @ http://www.w3.org/2000/01/rdf-schema# . used define terms useful in performing simple reasoning on rdf graphs, such rdfs:subclassof , rdfs:domain , , rdfs:range . in reality, terms defined between 2 vocabularies end being in arbitrary locations, , on retrospect, there should have been single vocabulary definition , more understood location (such http://www.w3.org/ns/rdf# ), late now. why use ...

ios7 - iOS Bluetooth App- Check Paired Devices -

i build ios bluetooth enable app connects external device , after connecting pairs device. now, want check if user paired device not show pair alert message next time? unfortunately, can't, there no means in core bluetooth api check pairedness. pairing dialog shown ios when needed.

html - `Index.php` file Showing Code and not Rendering a Website -

i don't know how explain well, i'm sure pretty dumb.. first of all, i'm using netbeans in linux. trying write simple website links , menu. menu i'm using variables know page include. want include php needed insert php code in html file. red need change filename index.php server recognize php commands.. changed file extension php , see code of website , not website itself.. this index.php: <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <title>ishimoto - cars life</title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> <sc...

c# - Threading, BackgroundWorker or Task, numerous objects processed by the same method -

i have list of t objects need processed, , speed processing of list, farmed out asynchronous process. each object processed same method, have couple questions regarding various asynchronous strategies: is backgroundworker or task (tpl) preferable? am correct in saying whichever method chosen, list of backgroundworker or task objects need instantiate new class containing method process t? in other words, if classa creating backgroundworker or task objects, should not point classa.processobject(t t), instead instantiate new classb().processobject(t t) method work? you're free use whichever tool want accomplish task. 2 not interchangeable, in have different (although overlapping) design goals. prefer can't answer. whether want of workers execute method of same instance of object or different instance entirely dependent on context. neither inherently wrong, long understand whether or not various threads acting on same instance or not, , write code according...

c++ - What does 'const' do when used in a pointer to pointer rvalue const function argument? -

void func(int **&&const x) { *(*x) = 32; } void main() { int *pi = new int{ 64 }; printf("x : %d\n", *pi); func(&pi); printf("x : %d\n", *pi); } outputs: x : 64 x : 32 when using pointer pointer rvalue const, value still modifiable within function. there purpose using **&&const function argument. code compiled using vc2013 c++ compiler nov 2013. edit: receive warning "anachronism used : qualifiers on reference ignored" it's better fail compile completely. answers! gcc 4.8.2 doesn't consider valid code: // snippet of code void func(int **&& const x) { *(*x) = 32; } ... , compile ... $ g++ -fsyntax-only -wall -pedantic -std=c++11 foo.cpp foo.cpp:2:26: error: ‘const’ qualifiers cannot applied ‘int**&&’ void func(int **&& const x) ^ i'm going assume vc 2013 wrong allow code compile.

php - randomly choose one data from blocks of query -

i have 100000 records in table. need make query reads 10 records , after 10 more records continuously until end of table. each of 10 rows groups, need pick 1 random row. possible accomplish using mysql query? need idea this. can me? i have tried php loop doesn't work. <?php include_once ("connection.php"); $data = mysql_query("select * trying"); $result = array(); while ($data2 = mysql_fetch_array($data)) { array_push($result, array('no'=> $data2['no'], 'source'=> $data2['source'], 'destination'=> $data2['destination'])); } $e=0; ($a = 0; $a <= 49;) { ($i = 0; $i <= 9; $i++,$a++) { $rand = array(); $rand[$i] = $result[$a]; } echo json_encode($rand[1]); } ?> insted of this: for ($a = 0; $a <= 49;) { ($i = 0; $i <= 9; $i++,$a++) { $rand = array(); $rand[$i] = $result[$a...

multithreading - how multiprocesses/multithreads Ruby Web Servers work? -

the following code simulation of web server has 3 workers (processes) , each new connection selected worker creates new thread. cannot understand how worker selected respond comming connection? , how 3 workers listening similar port without problem. require 'socket' require 'thread' server = tcpserver.new('0.0.0.0', 8080) 3.times break unless fork end loop connection = server.accept thread.new request = connection.gets connection.puts request connection.puts process.pid.to_s # change each request. connection.puts "status" connection.puts "headers" connection.puts "body" connection.close end end a tcp server listens port, waiting new connection request. when 1 comes, creates dedicated socket specific client (on port), hands off worker, , resumes listening main port. connection = server.accept the above line line worker tells server "i'm ready ...

android - Can you access the raws of an inactive app? -

my plan have main app uses raw files different app. main app handle data, , other app acts sort of dlc. when other app run, open main app own sharedpreferences, , set main app can read raws other app. is reading of raws (not implementation of sharedpreferences) possible if other app somehow forced closed? yeah, believe should able through packagemanager , resources apis. i've done strings , drawables, don't know of particular reason wouldn't work raw resources. try { resources res = getpackagemanager().getresourcesforapplication("other.package.name"); int resourceid = res.getidentifier("name_of_raw_resource", "raw", "other.package.name"); if (resourceid != 0) { inputstream rawfile = res.openrawresource(resourceid); } else { // raw resource not found } } catch (packagemanager.namenotfoundexception e) { // app not installed }

Observer Pattern used with Java socket programing not working -

i have problem observer pattern when i'm trying update client view based on data comes server. the code sends messages client: package model; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.io.printwriter; import java.net.socket; public class playerthread extends thread{ private bufferedreader infromclient; private printwriter outtoclient; private socket socket; public playerthread(socket socket) throws ioexception{ this.socket = socket; infromclient = new bufferedreader(new inputstreamreader(socket.getinputstream())); outtoclient = new printwriter(socket.getoutputstream(), true); outtoclient.println("hey"); } public void run(){ // needs implemented } } the code takes care of recieving data on client side: package connection; import java.io.bufferedreader; import mediator.modelmanager; public class clientrecieverthread extends thread { private modelmanager model; private buff...

Unable to Push deployment from Travis ci to cloudcontrol -

unable push deployment github repository cloudclontrol using travis ci, below log: deploying application warning: permanently added 'cloudcontrolled.com' (rsa) list of known hosts. ssh://xxx.git ! [rejected] head -> master (fetch first) error: failed push refs 'ssh://awesomeblog@cloudcontrolled.com/repository.git' hint: updates rejected because remote contains work hint: not have locally. caused repository pushing hint: same ref. may want first integrate remote changes hint: (e.g., 'git pull ...') before pushing again. hint: see 'note fast-forwards' in 'git push --help' details is there way force hard push overriding status of remote git? in case need see full logs, can find here https://s3.amazonaws.com/archive.travis-ci.org/jobs/26330194/log.txt . note relevant log @ end. i able problem solved new feature released travis ci, they have added -f option while doing push during deploy. all need add edge: true op...

vb.net - Is there a way to dynamically specify property names in a class? -

vb.net 2010~framework 3.5 is there way dynamically specify property names of class? sometimes need list created prop1 , prop2 other times need list created prop2 , prop4 etc.. target properties not known ahead of time, change app running. . . option strict on option explicit on public class form1 private class things public property prop1 string public property prop2 string public property prop3 string public property prop4 string end class private class subthing public property p1 string public property p2 string end class private sub button1_click(sender system.object, e system.eventargs) handles button1.click dim mainlst new list(of things) dim count integer until count = 20 mainlst.add(new things {.prop1 = count.tostring, _ .prop2 = (count + 1).tostring, _ .prop3 = (count + 2).tostring, _ .prop4 = (count + 3).tostr...

dst - PHP daylight saving time detection -

i need send email users based wherever in world @ 9:00 local time. server in uk. can set time difference between each user , server's time, work if dst didn't exist. here's example illustrate it: john works in new york, -5 hours server (uk) time richard works in london, uk, 0 hour difference server. when server goes gmt gmt +1 (bst) @ 2:00am on sunday, means john has -6h time difference now. this scenario can still handle updating users outside server's local time, once i've moved forward/backward time of other users, still need way detect when (time , date) users living outside uk (or not) change local time probable dst one. i need php method know/detect when other parts of world enter/exit dst. do need know details of dst transition yourself? or need know when 9:00 in given timezone? if it's latter, php can use operating system's timezone database you. strtotime() function remarkably @ "figuring out" mean: echo str...

c++ - Getting error LNK2019: unresolved external symbol in vS@)!) that compiled fine in VC 6.0 -

i trying compile 14 year old c++ program vs2010 c++ compiler (dont ask why :( ). getting following error error 10 error lnk2019: unresolved external symbol "public: __thiscall cconfiguration::cconfiguration(void)" (??0cconfiguration@@qae@xz) referenced in function "public: __thiscall cwhoisservice::cwhoisservice(void)" (??0cwhoisservice@@qae@xz) i have cpp file cwhoisservice.cpp header cwhoisservice.h cwhoisservice.h: class cwhoisservice { public: hresult initialize(const char * szservicename, refclsid pmetricsclsid); cwhoisservice(); ~cwhoisservice(); hresult checkservice(); protected: cconfiguration m_configuration; protected: bool m_bstartedevenlog; bool m_bstartedconfiguration; private: //don't want standard constructor called }; cwhoisservice.cpp #include "configurationlib.h" #include "cwhoisservice.h" cwhoisservice::cwhoisservice(): m_bstartedevenlog(false)...

xml - Powershell Script - Merge Multiple Nessus Scans - -

so attempting automate process of merging multiple nessus scans, following manual guide defined @ ryker exum . challenge i'm having part have find , delete lines within files , including point (once specific string has been found). goal efficiently possible given of these nessus scan results (xml files) can on 100mb. approach to: put logic in place identify first , last file, , act accordingly on them. remove last 33 characters of first scan file come across. get content of each file , read each object in 1 @ time. if there not match, delete line , move on next object. if there match, delete line , stop (thus until). at point, i've not had success getting step 3 work. code follows: $first = get-childitem ".\" -filter *.nessus | select-object -first 1 $last = get-childitem ".\" -filter *.nessus | select-object -last 1 if ($first -ne $last) { get-childitem ".\" -filter *.nessus | foreach-object { $filepath = $_.fulln...

Bootstrap: next to each other rather than on top -

ok, thought <div class="container"> <div class="row"> <div class="col-lg-2"> <table id="example" class="display"> <thead> <tr> <th>property</th> <th>value</th> </tr> </thead> </table> </div> <div class="col-lg-10"> <div id="container" style="height: 535px; margin: 0 auto"> </div> </div> </div> </div> should result in table next graph. (both objects described in scripts). on private desktop both objects appear on top of each other... any ideas don't see here? remember class .col-lg-2 not exist in bootstrap. must use .col-xs-2 . replace <div class="col-lg-2"> ...

How does Laravel find plural of models? -

if have model "dog", laravel link table "dogs". plural. now, if have model "person", tries find table "people" - plural. how laravel know plural when it's more adding "s"? there tabel english nouns? in illuminate\database\eloquent\model.php you'll find str_plural($name) , str_plural helper function uses str::plural method , in case, method looks this: public static function plural($value, $count = 2) { return pluralizer::plural($value, $count); } so it's obvious that, str::plural uses class illuminate\support\pluralizer.php , there you'll find how works. read source code. there separate word mapping irregular word forms others: // taken illuminate\support\pluralizer public static $irregular = array( 'child' => 'children', 'foot' => 'feet', 'freshman' => 'freshmen', 'goose' => 'geese', 'human...

xaml - How to write a style for HyperlinkButton Shadow effect in Silverlight -

i have styled hyperlinkbutton per custom need follow: <hyperlinkbutton tag="transactions/homeworkpage" background="#e9e9eb" foreground="black"> <hyperlinkbutton.effect> <dropshadoweffect direction="270" opacity="0.35" shadowdepth="3"/> </hyperlinkbutton.effect> <stackpanel orientation="horizontal"> <image source="/schoolmgmt;component/assets/images/r_homework.png" margin="10,0,1,0"/> <telerik:label content="home work" characterspacing="25" telerik:stylemanager.theme="{binding selectedtheme,mode=twoway}" fontsize="12" fontfamily="arial rounded mt" margin="3"/> </stackpanel> </hyperlinkbutton> now satisfy result s...

Unable to focus Input element inside a Bootstrap Popover inside a jQuery UI Dialog -

i having difficult time getting work. have link opens jquery ui dialog contains links. links open bootstrap popover contain input field. reason, input field not editable. see: http://www.bootply.com/z46zxa133u markup : <div id="dialog"> <a data-placement="bottom" data-toggle="popover" data-title="login" data-container=".ui-front" type="button" data-html="true" href="#" id="login">login</a> </div> <form id="popover-content" style="display:none"> <input type="text" value="try changing me"> </form> script : $( "#dialog" ).dialog({ height: 300, width: 350, modal: true, }); $("[data-toggle=popover]").popover({ html: true, content: function() { return $('#popover-content').html(); } }); this because have data-container="body...

php - Syntax error with mysql when trying to fetch data from database using options in drop down list -

when select option retrieve data db, error message: you have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 1. why that? there's nothing @ line 1? also, teach me how search in retrieved data? example. if choose option 1 "antal narvaro" , press ok-button, following sql-query execute: select * mytable fran = 'besok'; once i've retrieved data, want further search in information name, age , on. otherwise i'm grateful execute following sql-queries choosing option in drop down list press ok-button. i'm new php , html, in advance! <html> <head> <title>aifind</title> <link rel="stylesheet" href="style.css"> <script type="text/javascript" src="logic.js"></script> </head> <body> <h1><img src="https://imagizer.imageshack.us/v2/278x186q...

c++ - Virtual functions and double inheritance -

i've been trying solve problem hours, couldn't find solution. code example: class icolor { // color interface public: virtual void print(); }; class color : public icolor { // abstract color class }; class rgb : public color { // color implementation public: void print() { std::cout << "hi"; } }; int main() { icolor* col = new rgb(); col->print(); return 0; } however, result of compilation linker errors: /home/snndaj/ccnvqhgl.o:(.rodata._zti5color[_zti5color]+0x8): undefined reference `typeinfo icolor' /home/snndaj/ccnvqhgl.o:(.rodata._ztv5color[_ztv5color]+0x8): undefined reference `icolor::print()' collect2: error: ld returned 1 exit status (not)working online example: https://ideone.com/yikywe change base class have pure virtual member: class icolor { public: virtual void print() = 0; }; as code stands, declaring icolor::print never defining it, leads unresolved reference linker...

c# - what does it mean new int[] in cSharp? -

i got line in c# code written : new int[] mystore; i don't know means how translate valid c++? only possible place such code hiding/shadowing member of parent class same name: class base { protected int[] mystore; } class derived: base { new int[] mystore; } you should able port directly c++ - have similar rules hiding. note (thanks jeroen vannevel) don't need have base class: can mark property new , warning "nothing hide".

c# - Sequential Implementation for one call using unity dependency injection -

what best way implement sequential implementation in async mode using unity dependency injection. if call 1 method create order, should create in 2 different implementations. my controller: public class ordercontroller : basecontroller { private iorderrepository orderservice; public ordercontroller (iorderrepository service) { this.orderservice = service; } public actionresult create (orderol obj) { // here want 2 implementations // first on orderrepositorysql // , after success response, // should implement in orderrepositorymongo async method orderservice.create(obj) return view(); } } my interface: public interface iorderrepository { int create (orderol obj); } my implementing class 1 public class orderrepositorysql : iorderrepository { public int create (orderol obj) { // logic create order in data store 1 } } my implementing class 2 public class orderrepos...

Rails Engines rendered View -

i have rails engine i'm developing. first one, besides example in rails documentation, don't have ref on works. has partial i'm requiring application render. <%=render partial: 'my_engine/foo/bar'%> that works fine. , understand why need reference partial through engine name space. but within partial, apparently have use name space well. when render photo <%= image_tag('my_engine/addphoto.jpg') %> that counter intuitive based on documentation. doing wrong, or way is? okay rich peck think understand better. let me enumerate can correct me if i'm still confused. i confused how namespace generated engine. assuming structure generated name space, , when inside engine, operate if in normal app. , namespace automagic:). but if understand correctly name space rails component generated encapsulating them in :::: module enginename taken care of generators, if you're creating file manually, need add encapsulation in ...

c# - Camera RAW image processing with Windows Store app -

i want create windows store app in c# process camera raw images. looks can load raw images using microsoft's windows imaging component (wic), when want manipulate images in windows store app, run problem. to manipulate images in windows store apps, primary option found using writeablebitmap object, writeablebitmap objects have 8 bits per channel. dslrs, including mine, have 14 bits per channel. don't want lose color depth. suppose go directx approach, i'd rather not have deal c++ project. there's sharpdx, lacks bit in documentation, i'd tackle anyway if it's best choice. there other ideas? so options, , solution favor in position? how can load raw images windows store application , make changes images without losing color depth?

html - Is Hotmail blocking some CSS properties when send mail with PHP? -

Image
i trying put form inside mail website. i discovered in hotmail, float:left; , float:right; doesn’t seems work, in html e-mail. is there way around it? is hotmail blocking css properties when send mail php? 100% nothing hotmail or php specifically, sad state of html e-mail design in general. hotmail & others not use float values in css. in fact html e-mail is—in general—archaic , force engage in design techniques go way nested <table> layout practices of 1990s. explained on page on “email design guidelines” campaign monitor ; emphasis mine: before getting details, there uncomfortable facts new html email should aware of. building email not building web. while web browsers continue onward march towards standards, many email clients have stubbornly stayed put. have gone backwards. in 2007, microsoft switched outlook rendering engine internet explorer word. yes, in word processor. add quirks of major web-based email clients gmail ...

javascript - Bootstrap 3.1.1: I can't import all the bootstrap .js files, how is "= require" supposed to work? -

Image
i using latest bootstrap v3.1.1 sass. within .zip file, lib, tasks, templates, test , vendor. i ignored , use vendor > assets folder. assets folder has fonts, stylesheets , javascripts need. i have gotten file structure setup properly. when trying import .js files javascript folder, having bit of problem. unlike bootstrap.scss file comes along. can uncomment _.scss file need , work. within bootstrap.js file, contains syntax haven't seen before. after bit of google, says 'require' nodejs syntax. i uncommented few , try see if work. fails. .js file got above screenshot. doesn't concatenate modal.js, tooltip.js , popover.js. did abit of google, says need have requirejs?

javascript - Samsung smart TV IME loading issue -

i have ime.js , html loads js invoke ime. however, html can not shown time when run project , maybe slow , there no error message in console well. when comment <script type="text/javascript" src="javascript/ime.js"></script> in html, html can shown immediately. might problem? did miss configuration? any help? in advance! please try include script in end of body tags: ... <script type='text/javascript' src='$manager_widget/common/ime_xt9/ime.js'></script> <script type='text/javascript' src='$manager_widget/common/ime_xt9/inputcommon/ime_input.js'></script> </body> </html> it's because ime starts work dom immediately

java - How to get radio button's id and convert to string? -

i working in android studio , trying id of selected radio button , store id in string. possible? i have tried replacing .gettext() method below .getid() wont let me store string: radiogroup radiogroup = (radiogroup) findviewbyid(r.id.radiogroup); radiogroup.setoncheckedchangelistener(new radiogroup.oncheckedchangelistener() { @override public void oncheckedchanged(radiogroup radiogroup, int checkedid) { radiobutton checkedradiobutton = (radiobutton) findviewbyid(checkedid); string text = checkedradiobutton.gettext().tostring(); toast.maketext(getapplicationcontext(), text, toast.length_short).show(); } }); getid() returns int - which, primitive types , not have tostring() (or other) method. because, while objects have tostring() method, primitives not objects - lucky you, java provides wrapper classes are objects primitive type. in case of int , corresponding wrapper class called int...

Cobertura plugin for grails 2.3.9 does not work -

i have grails 2.3.7 project using cobertura plugin, works fine. but when upgraded 2.3.9 stopped working. this of relevant parts of stacktrace get. error cobertura: error reading object stream. java.lang.classnotfoundexception: net.sourceforge.cobertura.coveragedata.packagedata ... cobertura: coverage data file /home/user/cobertura.ser either not exist or not readable.  creating new data file. from info page of grails-coverage-plugin current version (2.0.3-1): this plugin generate code coverage reports using cobertura. grails forked mode not supported. you should remove forked options build.config . removing test option enough.

button - ActionScript Errors -

im making buttons when pressed call function present either wrong answer text or right answer text, seems correct me have pesky error. 1084: syntax error: expecting rightparen before button. cant figure out problem is. here code. appreciate , help. thank you. stop(); mywelcome.text = "hello, " + myname; btn81.addeventlistener(mouseevent.mouse_up,81button){ function 81button (evt:event):void{ wronganswer(); } } btn85.addeventlistener(mouseevent.mouse_up,85button){ function 81button (evt:event):void{ wronganswer(); } } btn91.addeventlistener(mouseevent.mouse_up,91button){ function 91button (evt:event):void{ rightanswer(); } } btn95.addeventlistener(mouseevent.mouse_up,95button){ function 81button (evt:event):void{ wronganswer(); } } function wronganswer (evt:event):void{ feedback.text = "wrong"; nosound.play(); } function yessound (evt:event):void{ feedback.text = "correct"; yessound.p...

c++ - boost::lambda::var nested in boost::bind not equivalent to boost::lambda::var by itself -

i'm having little trouble identifying simple boost::lambda usage issues. can make simple lambda function this: int = 0; boost::lambda::var(i) = boost::lambda::_3; // set 'i' 3rd parameter. but wrap lambda function in bind: int = 0; boost::bind(boost::lambda::var(i) = boost::lambda::_3); // set 'i' 3rd parameter. it becomes unusable: (boost::lambda::var(i) = boost::lambda::_3)(0,1,2); // compiles & behaves expected. == 2 boost::bind(boost::lambda::var(i) = boost::lambda::_3)(0, 1, 2); // compile error does boost::lambda::var indeed produce bindable function? have fudged syntax somehow? tends simple, light shed appreciated :) (compiled msvc2008 & boost v1.50) i think need prevent substitution preventing argument substitution in case boost::lambda::protect seems in order also, check relation of boost bind boost lambda: http://www.boost.org/doc/libs/1_55_0/doc/html/lambda/s08.html#idp153645176 the boost bind [bind] lib...

json - Unlink file in PHP, then create new one with file_put_contents -

i trying use file_put_contents put json file in place, finding not overwrite existing file. thinking @ point try , unlink pre-existing file first, , user file_put_contents create new one. reason, not seem working. have feeling 2 operations happening quickly, , second step tries run before first step completes. here code: $filename = '<?php echo site_url() ?>js/salecomps.json'; if (is_readable($filename)) { chmod($filename, 0777); unlink($filename); } $q = $this->db->query("select rollnum , address, v2_lat, v2_lng tblontario municipality = 'ajax' limit 100"); $json_string = json_encode($q->result(), json_pretty_print); file_put_contents('<?php echo site_url() ?>js/salecomps.json', $json_string); please tell me doing wrong. thanks. you using wrong way include <?php echo site_url()?> not give filepath try change $filename = '<?php echo site_url() ?>js/salecomps.js...