Posts

Showing posts from June, 2015

php - Error using Mockery/phpUnit in Laravel -

i'm novice developer trying test suite started existing laravel app have not experience in testing. right i'm trying tests built out confidence , experience write more substantial tests. i'm trying test relationship on model(i realize it's not sensible tests) , trying create mocked model object so(i understand it's better in memory in sqlite db major goal here test controllers don't know how deal authentication issue there). have following simple, stupid test: public function testfoo() { $lead = m::mock('lead'); $this->mock->shouldreceive('program')->once(); $this->assertequals($lead->program_id, $lead->program->id); } but following error: leadtest::testfoo badmethodcallexception: received mockery_0_lead::getattribute(), no expectations specified i don't understand error trying tell me , i'm finding no googling issue or reading through docs can find. i assume i'm not setting expected

how to set scrolling = "no" at the iframe podio-webform-frame? -

how can set scrolling = "no" @ iframe podio-webform-frame? unfortunately it's possible in fully-conforming html5 html , css properties view automatic iframe generated podio podio webforms' iframe attributes not customisable beforehand, can manipulate attributes on using, example, jquery. take @ answer more info: https://stackoverflow.com/a/10083740/2904025 example marcelo's code: $('.podio-webform-frame').on("load", function() { $('.podio-webform-frame').attr("scrolling", "no"); });

MySQL autoincrement column jumps by 10- why? -

i have couple tables in created object id either int or bigint, , in both cases, seem autoincrement 10 (ie, first insert object id 1, second object id 11, third object id 21, etc). 2 questions: why that? is problem? check see seed value of autoincrement isn't set 10. you can check by: select auto_increment information_schema.tables table_name='the_table_you_want'; as noted elsewhere can change using system variable @@set_auto_increment_increment set @@auto_increment_increment=1; if want start values @ number other 1 can go: alter table tbl auto_increment = 100;

Ajax - using the script to load different 'events' -

i new ajax, have code change content area of site once link clicked. trouble is, want load different content using different buttons, current code allowing me link 1 file/page. <script> function loadxmldoc() { var xmlhttp; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("centrecont").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","../home/indexfav.php",true); xmlhttp.send(); } </script> you can see in above script when link script ajax direct '../home/indexfav.php'. i want use different links load different content. how can done? here's html

php - Gaufrette and Symfony 2: There is no filesystem defined for the "images" domain -

i'm using symfony3 knpgaufrettebundle connect amazon s3 bucket aws s3 method outlined on github readme aws_s3_adapter: key: "%aws_key%" secret_key: "%aws_secret%" region: "%aws_region%" knp_gaufrette: adapters: images: aws_s3: service_id: 'aws_s3_adapter.client' bucket_name: '%aws_bucket%' options: directory: 'images' filesystems: images: adapter: images alias: images_fs i have service defined want use manage filesystem (and others) with. definition: services: test.image_manager: class: testbundle\filesystem\filemanager arguments: filesystem: "@images_fs" filesystem_name: "images" mimetypes: ["image/jpeg", "image/png", "image/gif"] class: <?php namespace testbundle\filesystem; use symfony\component\httpfoundation\file\uploa

Google People API throwing 403 error about scope -

i trying use google people api, allows me retrieve user's contacts. here's code: $scripturi = "http://".$_server["http_host"].$_server['php_self']; $client = new google_client(); $client->setclientid('omitted'); $client->setclientsecret('omitted'); $client->setredirecturi($scripturi); //$client->setaccesstype('offline'); $client->setscopes(array('https://www.googleapis.com/auth/plus.login', 'https://www.googleapis.com/auth/contacts.readonly', 'profile')); if (isset($_get['oauth'])) { // start auth flow redirecting google's auth server $auth_url = $client->createauthurl(); header('location: ' . filter_var($auth_url, filter_sanitize_url)); } else if (isset($_get['code'])) { // receive auth code google, exchange access token, , // redirect base url $client->authenticate($_get['code']); $_session['access_token'] = $client

sql - transform and group data together -

from query retrieve information need results this: code | category ----------- 1 | 1 | 2 | b 3 | b 3 | b 4 | b from data following result: combination 1&2 | combination 3&4 --------------------------------- 'both & b' | 'just b" so happening is, if first column takes rows code 1 or 2. sees if in these rows: -are rows equal category result in value "just a" -are rows equal category b result in value"just b" -is there mix of categories , b's codes 1 , 2 result in value"both & b". this again happen inside of second column except codes 3&4. in practice combining many codes of these column, columns combine 2 codes, other can combine 10 codes, , on. trying see category combination of codes are. a's, b's, or @ mixed? you can use conditional aggregation: select (case when min(category) <> max(category) 'both , b' when min(category)

javascript - Momentum Scrolling Breaks jQuery scroll event listener -

im having issue setting momentum scrolling on web app seems break jquery scroll event listener. here css: html, body { height: 100%; overflow-y: scroll; -webkit-overflow-scrolling: touch; } here javascript: $(window).scroll(function (event) { alert('im scrolling!'); }); the above css allows momentum scrolling on iphone. problem: the jquery event listener not firing "overflow-y: scroll" on html,body. removing "overflow-y: scroll" html,body allows js scroll event fire, momentum scrolling lost on iphone. attempted solutions: having searched solutions found topic: overflow-x: hidden breaking jquery scroll event says removing "height: 100%" html,body allow js scroll event fire. doing fire event loose momentum scrolling once again. summary: above css rules give momentum scrolling break jquery scroll event listener. removing of css rules html,body allows jquery scroll event fire momentum scrolling lost. ho

Polymer Routing -

i new polymer testing things out using polymer template: https://www.polymer-project.org/1.0/start/toolbox/set-up everything working correctly except when type in direct url, example site.com/page app-route: https://github.com/polymerelements/app-route load things correctly if click href link /page not load correctly if type in url directly (i 404 error). what missing? haven't change code demo app (demo app doesn't work me when type in url directly). you need add .htaccess file index.html is. here full working code routing , iron-pages in it. .htaccess rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* / index.html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes"> <title>....</title>

javascript - copying values from parent scope to directive scope -

i new angularjs , wondering how go copying values in parent scope directive scope no bindings (2 separate instances). implementation goes is, newhosttemplate calling {{newhost.ipaddress}} want newhost directives scope , not parent. host.directive('newhost', function(){ return { restrict: 'e', template: '<div ng-include="gettemplateurl()"></div>', scope: true, link: function(scope, element, attr) { scope.newbox = function() { scope.gettemplateurl = function() { return 'hosts/newhosttemplate.html'; } } } } }); host.controller('hostscontroller', function($scope, $http, $window, $rootscope){ $rootscope.$on("$routechangeerror", function (event, current, previous, rejection) { console.log("failed change routes"); }); $scope.newhost = {}; $scope.addnewhost

php - TCPDF: Severe formatting bug with writeHtml -

Image
look @ code: $pdf->ln(4); $pdf->setfont('helvetica', '', 14); $pdf->setfillcolor(200, 220, 255); $pdf->cell(180, 6, 'education', 0, 1, '', 1); $pdf->ln(4); $pdf->setfont('helvetica', '', 10); $html = ' degree ...................... <strong>' . $education->degree_title . '</strong> <br/> graduation date ............. ' . date('m-d-y', strtotime($education->award_date)) . ' <br/> attendance .................. ' . date('m-d-y', strtotime($education->school_start_date)) . ' - ' . date('m-d-y', strtotime($education->school_end_date)) . ' <br/>'; $pdf->writehtml($html, true, false, true, false, ''); because it's running when setting is: $pdf->setcellmargins(30, 0, 0, 0); the end result is: as can see, html <strong> causes

jsp - In the website design using struts2, when a user login, how to keep user information between different website? -

recently, learning struts 2 , hibernate build small web application. designed login , register page. after user registered, can log in. after user login, welcome page , user can browse other pages. how keep user information among these pages(like showing username above pages time until logs out)? i learned redirect , dispatcher method in struts 2."dispatcher" lead jsp page(i need jump 1 action action), keep before actions information in stack. "redirect" can lead jsp or action, object information in before action lost. so in situation, said, should use keep user information showing above pages? store in session, , on every page retrieve session. hope helps.

php - Getting username and password exposed in POST parameters when created a new user -

Image
i need hash , store password user input in login form in yii. if them thru post parameters this: $model->username=$_post['user']['username']; $model->password=crypt($_post['user']['username']);// salt might added if($model->save()) $this->redirect(array('view','id'=>$model->id)); this way expose uncrypted password in post request. other way them directly login form this: public function actioncreate2() { $model=new user; $model->username = $form->username; $model->password = crypt($form->password); if($model->save()) $this->redirect(array('view','id'=>$model->id)); $this->render('create',array( 'model'=>$model, )); } but does not work in case authenticating saved user. auth function: public function authenticate() { $users = user::model()->findbyattributes(array('username'=>$this

Xamarin Studio 6 F# Android Unit Test App NotFoundException -

i using xamarin studio community version 6 on mac. create new "android/tests/unit test app/f#" project. run in emulator. "android/tests/unit test app/c#" projects work fine. here exception detail: android.content.res.resources+notfoundexception: resource id #0x7f020003 @ system.runtime.exceptionservices.exceptiondispatchinfo.throw () [0x0000c] in /users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 @ java.interop.jnienvironment+instancemethods.callnonvirtualvoidmethod (jniobjectreference instance, jniobjectreference type, java.interop.jnimethodinfo method, java.interop.jniargumentvalue* args) [0x000a7] in /users/builder/data/lanes/2923/52635947/source/java.interop/src/java.interop/java.interop/jnienvironment.g.cs:12083 @ java.interop.jnipeermembers+jniinstancemethods.invokevirtualvoidmethod (system.string encodedmember, ijavapeerable self, java.inter

python - Sensible way to create filenames for files based on URLs? -

i screenshotting bunch of web pages, using python selenium. want save pngs locally reference. list of urls looks this: www.mysite.com/dir1/pagea www.mysite.com/dir1/pageb my question filenames give screenshotted pngs. if call image files e.g. www.mysite.com/dir1/pagea.png meaningless slashes inevitably cause problems @ point. i replace / characters in url _ , suspect might cause problems too, e.g. if there _ characters in url. (i don't strictly need able work backwards filename url, wouldn't bad thing.) what's sensible way handle naming? the easiest way represent what's directory structure on server wget , replicate structure on local machine. thus / characters become directory delimiters, , www.mysite.com/dir1/pagea.png become png file called pagea.png in directory called dir1 , , dir1 located in directory called www.mysite.com . it's simple, guaranteed reversible, , doesn't risk ambiguous results.

Vb.net : Get Set properties with different forms -

i have class , set properties public property username() string return _username end set(byval value string) _username = value end set end property i want set value in 1 form , same value in form how do this? simply declare property on 1 form, when instantiate can set before showing or while doing other action: dim newform form2 = new form2() newform.username = "alejandro" newform.show() this assumes property username declared on form2 public. it's possible other way around, or add piece of data constructor parameter , keep property private.

python - Using Native Tkinter on mac, not X11 Tkinter -

i have been using native python , tkinter applications (python2.7) on mac osx 10.7 i installed anaconda incredible selection of mathematical packages, however, tkinter used x11 , crashes , extremely ugly. i saw post , don't understand it. there way best of both worlds , use anaconda install not have use x11 tkinter?

elasticsearch - Nest is not Auto mapping not analized field -

i created mapped entity: [elasticsearchtype(name = "cases")] public class case { [string(name = "case_name")] public string casename { get; set; } [string(name = "md5", index = fieldindexoption.notanalyzed)] public string md5 { get; set; } } and then: client.map<case>(mp => mp.automap()); but not including index type md5 field mapping: get _mapping { "myindex": { "mappings": { "cases": { "properties": { "case_name": { "type": "string" }, "md5": { "type": "string" } } } } } } what missing? your code works me when running against newly created index void main() { var pool = new singlenodeconnectionpool(new uri("http://localhost:9200")); var defaultindex = "default-index";

Python flask pagination passing form variable into query -

i trying pass form variable pagination. if hardcode search, pagination works. non-hardcoded query works page 1, on trying go further pages error: typeerror: cannot concatenate 'str' , 'nonetype' objects i posted code thought relevant. @search.route('/search', methods=['get', 'post']) def search(): form = searchform() search_term = form.searchstring.data print search_term search = false q = request.args.get('q') if q: search = true try: page = int(request.args.get('page', 1)) except valueerror: page = 1 per_page = 10 inner_window = 4 outer_window = 3 offset = page * 1 #doesnt work links = item.query.filter(item.title.like('%' + search_term + '%')).paginate(page, 10, true) #works links = item.query.filter(item.title.like('%hel%')).paginate(page, 10, true) #doesnt work @ #links = db.query.filter(f

php - Unindentified index and use of unindentified constant -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 22 answers notice: undefined index : qty in c:\xampp\htdocs\ecommerce\cart.php on line 130 notice: use of undefined constant qty - assumed 'qty' in c:\xampp\htdocs\ecommerce\cart.php on line 137 <?php if(isset($_post['update_cart'])){ //line 128 $qty =$_post['qty']; $update_qty ="update cart set qty='$qty'"; $run_qty =mysqli_query($con, $update_qty); $_session ['qty']=$qty; $total=$total*qty; //line 137 } ?> you forgot $ before qty in line 137 , seems $_post['qty'] empty $total=$total*qty; suppost $total=$total*$qty; fixed version: if(isset($_post['update_cart'])){ $qty =$_post['qty']; $update_qty =

c# - Building URI with the http client API -

i have build uri address dynamic query strings , looking comfortable way build them via code. i browsed system.net.http assembly doesn't found class or method case. api not provide this? search results here @ stackoverflow uses httputility class system.web, don't want reference asp.net components in class library. i need uri : http://www.mybase.com/get?a=1&b=c . thanks in advance helping! update (2013/9/8): my solution create uri builder uses system.net.webutilitiy class encoding values (the imported nuget package unfortunately didn't provide strong name key). here's code : /// <summary> /// helper class creating uri query string parameter. /// </summary> internal class urlbuilder { private stringbuilder urlstringbuilder { get; set; } private bool firstparameter { get; set; } /// <summary> /// creates instance of uribuilder /// </summary> /// <param name="baseurl">the base address (e.g

android - How do I insert MapsActivity into a Fragment Container? -

i have code on default mapsactivity: import android.support.v4.app.fragmentactivity; import android.os.bundle; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; public class mapsactivity extends fragmentactivity implements onmapreadycallback { private googlemap mmap; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_maps); // obtain supportmapfragment , notified when map ready used. supportmapfragment mapfragment = (supportmapfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.map); mapfragment.getmapasync(this); } and on navigation drawer mainactivity mapsactivity fragment = new mapsactivi

r - Update graph/plot with fixed interval of time -

i have plot in shiny ui. if change input parameter , through reactivity plot change. let's consider following situation:- plot in shiny ui plotting let intra-day price move of stock. , query live data source. if create refresh button , if time passes keep on clicking on refresh button. plot updated new data arrives time goes live data source. question don't want keep clicking on refresh button. want run loop timer check on fixed interval of time , new data comes plot auto update. sort of google finance graphs keeps updating on time. so problem can simplified follows :- let's consider example shiny :- ui.r library(shiny) shinyui(pagewithsidebar( headerpanel("hello shiny!"), sidebarpanel( sliderinput("obs", "number of observations:", min = 1, max = 1000, value = 500) ), mainpanel( plotoutput("distplot") ) )) and server.r library

How do I deal with wrapper type invariance in Rust? -

references wrapper types &rc<t> , &box<t> invariant in t ( &rc<t> not &rc<u> if t u ). concrete example of issue ( rust playground ): use std::rc::rc; use std::rc::weak; trait mytrait {} struct mystruct { } impl mytrait mystruct {} fn foo(rc_trait: weak<mytrait>) {} fn main() { let = rc::new(mystruct {}); foo(rc::downgrade(&a)); } this code results in following error: <anon>:15:23: 15:25 error: mismatched types: expected `&alloc::rc::rc<mytrait>`, found `&alloc::rc::rc<mystruct>` similar example (with similar error) box<t> ( rust playground ): trait mytrait {} struct mystruct { } impl mytrait mystruct {} fn foo(rc_trait: &box<mytrait>) {} fn main() { let = box::new(mystruct {}); foo(&a); } in these cases of course annotate a desired type, in many cases won't possible because original type needed well. do then? what see here n

unity3d - Cannot access array of a custom class -

in unity keep getting error message "nullreferenceexception: object reference not set instance of object" on this: listofbanks[0].deposit(50); and accntblnce.text = "account balance:\n" + listofbanks[curbank].getbalance().tostring("c"); i have 3 options listed in drop down menu , when debug.log number of items in array 3 count. can't them. banks variable set dropdown object in inspector accntblnce text object in panel. the code below. banks.cs public class banks : monobehaviour { public dropdown banks; public text accntblnce; public bank[] listofbanks; public int curbank = 0; void start() { listofbanks = new bank[banks.options.count]; listofbanks[0].deposit(50); } void update() { curbank = banks.value; accntblnce.text = "account balance:\n" + listofbanks[curbank].getbalance().tostring("c"); } } bank.cs public class bank{ public bank() { }

.htaccess - Redirect with htaccess on apache -

i trying create virtualhost , allow htaccess redirect (it laravel project). environment is: ubuntu16.04 apache2.4.18 php7.0.4 and here /etc/apache2/sites-available/sub.domain.com.conf <virtualhost *:80> servername eatec.es serveralias webs.eatec.es serveradmin eloy@eatec.es documentroot /var/www/html/sub.domain.com/public <directory "/var/html/sub.domain.com/public"> options followsymlinks multiviews allowoverride order allow,deny allow </directory> #errorlog ${apache_log_dir}/error.log #customlog ${apache_log_dir}/access.log combined </virtualhost> things tried (and remember). 1. line of directory tried removing quotes. 2. line of directory used (removing subdomain sub -with , without quotes-). 3. move directory block file /etc/apache2/apache2.conf (i paste last of type of blocks). 4. change allowoverride option on block (on apache2.conf -with direc

c# - Datetime X-axis for Boxplot series in TeeChart -

currently, have multiple boxplots in teechart have added so: seriesindex = 0; foreach(var datagroup in datagroups) //each datagroup contains parametervalues @ specific point in time { var series = new box() { ... } var values = datagroup.parametervalues; series.add(seriesindex, values); seriesindex++; chart.series.add(series); } i want convert x-axis uses datetime value (defined below): var timeindex = datagroup.timeseriesindex; however, box class's add method not support datetime values. , when use inherited (from base series class) add(datetime, double) method (within foreach loop), datetime values become 12 december 31, 1899 recognize base value datetime.tooadate . leads me believe not inputting data correctly series. can point me in right direction? all datetime values become 12 december 31, 1899 recognize base value datetime.tooadate. exactly, that's way vertical box plot works in teechart. x position determined position pro

github - Pushing from friend's computer -

this question has answer here: pushing git returning error code 403 fatal: http request failed 39 answers i'm borrowing friend's computer, , when tried push repository got following error. remote: permission /.git denied . fatal: unable access ' https://github.com/ //': requested url returned error: 403 "git config user.email" , "git config user.name" show github username/email you must add (your friend's computer) ssh public key github account. see link on how add them

algorithm - Smallest positive integer not calculable given digits, possible to due in non exponential time? -

i given challenge: given amount of single digit, 4 8s, find smallest positive integer not calculable standard operations (+,-,*,/) , combination of parenthesis. i've taken @ these 2 posts: algorithm permutations of operators , operands smallest integer not obtainable {2,3,4,5,6,7,8} (mathematica) but still don't understand how problem. first link seems algorithm store every every number calculable given digits, , simple lookup. brute force method seems okay albeit slow. is there pattern can used i'm not seeing? thought dp approach, dp, you'd have trying every single combination digits, operands, , parenthesis seems way slow. solution given in first link, seems you're headed towards exponential solution. so example if have 4 different digits, have 3 operands need fill out in equation. n o n o n o n. each of operands can take 4 separate values, have 4*4*4 or 4^3 combinations try, exponential.

c++ - How to find out if my COM port has recieved XOFF? -

i testing code serial port communication. using synchronous io keep things simple. have observed when pc recieves xoff program pauses, no more printing in console window. when program recieves xon starts running again. what method exists find out if program's serial port has earlier recieved xoff (regardless of synchronous , asynchronous io) since com port driver shall prevent port sending characters out in case , better check if xoff recieved before calling writefile(). i think 1 way use clearcommerror() comstat struct. way? impression reading https://msdn.microsoft.com/en-us/library/ff802693.aspx if so, appears strange way of doing that.

Convert a string from Java to C++ -

i have string in java: string op="text1 "+z+" text2"+j+" text3"+i+" "+arrays.tostring(vol); where "z", "j" , "i" int variables; "tostring()" function belongs class. class nod { private: char *op; public: char nod::tostring() { return *op; } } and "vol" vector of int variables. and want convert c++. can me please? edit: sorry because confuse you, "tostring()" not function belongs class. "arrays.tostring()" - class java. to append int string, can use std::stringstream : #include <sstream> #include <string> std::stringstream oss; oss << "text1 " << z << " text2" << j << " text3" << i; std::string str = oss.str(); the method str() returns string copy of content of stream. edit : if have std::vector , can : #in

c# - Azure file Storage SMB slow to list files in directory -

we have app lists files in folder through azure files. when use c# method: directory.getfiles(@"\\account.file.core.windows.net\xyz") it takes around minute when there 2000 files. if use cloudstorageaccount same: cloudfileclient fileclient = storageaccount.createcloudfileclient(); cloudfiledirectory directory = fileclient.getsharereference("account").getrootdirectoryreference().getdirectoryreference("abc"); int64 totallength = 0; foreach (ilistfileitem fileanddirectory in directory.listfilesanddirectories()) { cloudfile file = (cloudfile)fileanddirectory; if (file == null) //must directory if null continue; totallength += file.properties.length; } it returns files, takes around 10 seconds. why there such large difference in performance? when using directory.getfiles (system file api), talks azure file storage via smb protocol (v2.1 or v3.0 depends on client os version). when switch cloudstorageaccount

python 2.7 - Tkinter Input Substitutions -

i've been working on text based game in tkinter, , need way allow more flexibility input. basically, i'm looking how code: if input.get() == "look at" item: item.look() but flexibility of 'item' being class, subclasses, of can 'looked at'. current (non-working) code segment: def check(): if output == "look at" item: item.look() else: pass class item(): def __init__(self, name, description, value, quantity): self.name = name self.description = description self.value = value def look(self): look.title = "{}".format(self.name) look.description = "{}".format(self.description) look.value = "{} worth {}.".format(self.name, self.value) details.insert(look.title) details.insert(look.description) details.insert(look.value) details.insert(look.quantity) class headphones(item): def __init__(self

youtube api - onStateChange does not fire the second time -

there seems lot of discussion around onstatechange event not firing cannot seem find answer specific problem. in case, can connect fine api , load video. api ready event fires, followed onplayerready , onstatechange. when closer viewer (iframe in video embedded) , open again, api ready event fires, followed onplayerready onstatechange not fire when video starts playing... i have refresh browser , load script again same or different video work in case not acceptable solution. i have tried manually adding listener unfortunately have opposite issue that, multiple events fired there no way remove listener on closing viewer. i should add behaviour same in chrome , firefox (latest versions) your in matter appreciated. thanks, okay dug code little bit more , minimized exact problem. it's issue iframe set url call. jeff, modified example on jsfiddle ( http://jsfiddle.net/jeffposnick/yhwsg/3/ ) follows: html code: <div id="divtag"> <

mysql - How to add multiple primary keys in a single table -

i tried create table fillowing in phpmyadmin. gives error: "#1075 - incorrect table definition; there can 1 auto column , must defined key" please 1 me create table itemlist ( uid varchar(15), item_id int auto_increment, item_name varchar(50) not null, primary key (uid, item_id) );

html - Bad pixel background image in IE 8 -

Image
i had small problem on internet explorer 8 , 9 image results not expected. pixel quality poor, in other browsers chrome, opera, , firefox looks good. this results : images rendered ie looks fractions on circle, , css code : .social-profiles ul li.facebook { background: url(img/flat-social-icons/32px/facebook-32.png); text-indent: -9999; opacity: 0.4; filter: alpha(opacity=40); /* msie */ } i believe issue using msie alpha filters pngs possess alpha transparency themselves. your options to: bake transparency image alpha channel give icons opaque background blends context give icons transparent background gradient using msie gradient filter i choose third flexibility, first fastest.

go - Golang: Two's complement and fmt.Printf -

so computers use two's complement internally represent signed integers. i.e., -5 represented ^5 + 1 = "1111 1011". however, trying print binary representation, e.g. following code: var int8 = -5 fmt.printf("%b", i) outputs -101 . not quite i'd expect. formatting different or not using two's complement after all? interestingly, converting unsigned int results in "correct" bit pattern: var u uint8 = uint(i) fmt.printf("%b", u) output 11111011 - 2s complement of -5 . so seems me value internally using two's complement, formatting printing unsigned 5 , prepending - . can clarify this? i believe answer lies in how fmt module formats binary numbers, rather internal format. if take @ fmt.integer , 1 of first actions function convert negative signed integer positive one: 165 negative := signedness == signed && < 0 166 if negative { 167 = -a 168 } there

ios - Fetching From CoreData returns AnyObject -

i fetching entity data coredata, returns anyobject, tried lot convert in nsdictionary , nsarray can not cast type.` var dictdata:nsdictionary? let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let context = appdelegate.managedobjectcontext; // self.selectedarray = response.objectforkey("retailers") as! nsarray; let fetchrequest2 = nsfetchrequest() let entitydescription2 = nsentitydescription.entityforname("offers", inmanagedobjectcontext: context) fetchrequest2.entity = entitydescription2 //fetchrequest2.returnsobjectsasfaults = false { let result2 : nsdictionary = try context.executefetchrequest(fetchrequest2) as! nsdictionary print("result:",result2) result in (result2 as? nsdictionary)!{ if let data : nsdictionary = result as? nsdictionary{ print(data) } offer entity contains no of fields. kin

How can I do "opt-in" interfaces with a proxy class in C++? -

i have 5 classes named a b c d e , 2 interfaces i1 i2 . using multiple inheritance, might inherit abstract classes implement interfaces: class : public i1, i2 {}; now, want add more interfaces i3 i4 i5 . having modify 5 class definitions tedious , violates don't repeat yourself programming principle. how might implement interface proxy class encapsulate polymorphic side of interface instead of multiple inheritance of abstract base classes? in other words, want have class cast interface class without using inheritance. type operator overload suitable here? or, perhaps using constructor per class good? the goal minimize repetition of code. i see problem follows: classes a, b, c,... type of documents say, jpg, doc, rtf, xml, pdf,... interfaces i1, i2, i3,... functionalities common documents say, iprint, isavetofile, icompress. so, every document a, b, c,... needs implement these inferfaces in order provide these functionalities. if have described re

How to uncheck disabled checkedlistbox in c# winforms? -

Image
in above image "ug(user group)" row in checkedlistbox enabled property false. how uncheck "ug(user group)" in disabled state. you can use checkedlistbox1.setitemchecked(2, false); or checkedlistbox1.setitemcheckstate(2, checkstate.unhecked); the enabled property of checkedlistbox has no impact on check state of items or 2 methods. msdn links: checkedlistbox.setitemchecked() checkedlistbox.setitemcheckstate() update: disabling single item in checkedlistbox instead of disabling whole control not possible out of box. if want prevent user changing check state of 1 special item, need subscribe itemcheck event of checkedlistbox : checkedlistbox1.itemcheck += (sender, e) => { if (e.index == 2) e.newvalue = checkstate.unchecked; } this event fired before check state of item changed. e itemcheckeventargs contains item's index , current check state ( currentvalue ) , check state shall have afterwards ( newva

swift - Error generating links on branch io -

i generating dynamic links application using branch io. generates link sometime theres error generating link the request timed out. cfnetwork handshake failed is issue branch side? found error in network. due firewall issue, of packets dropped. tried other network able rid of above issue.

build.gradle - Android - Getting error when i run project in android studio -

i error while run project here error information:gradle tasks [clean, :app:generatedebugsources, :app:generatedebugandroidtestsources, :citruslibrary:generatedebugsources, :citruslibrary:generatedebugandroidtestsources, :library:generatedebugsources, :library:generatedebugandroidtestsources, :payumoneysdk:generatedebugsources, :payumoneysdk:generatedebugandroidtestsources, :viewpagerlib:generatedebugsources, :viewpagerlib:generatedebugandroidtestsources] observed package id 'add-ons;addon-google_apis-google-19' in inconsistent location '/opt/android-sdk-linux/add-ons/addon-google_apis-google-19-1' (expected '/opt/android-sdk-linux/add-ons/addon-google_apis-google-19') error:a problem occurred configuring project ':app'. cannot evaluate module payumoneysdk : configuration name 'default' not found. i not able understand, please help. its simple, go project - app--->payumoneysdk---> .gitignore, open , remove text written insi

php - ajax post in search -

i make search form , i'm using ajax searchform . i have problems in html(data) , when put html(data) display loading image , table double here's code: $(document).ready(function(){ $("#loading").hide(); <?php $type_temp = (!empty($type)) ? 'company/' .$type:'company';?> $("#search_id").click(function(){ $("#loading").show(); $.post("<?php echo url_for('/admsys_dev.php/' .$type_temp); ?>", $("#send_search").serialize(), function(data){ $(".result").html(data); }); }); }); how put result page? heres html code below <div id="sf_admin_content"> <h2>company</h2><br /> <div style="margin-bottom:20px;"> <form id="send_search" action="" method="get"> <input type="text" name="search" placeholder="search: &q

fonts - How do I make an attributed string using Swift? -

Image
i trying make simple coffee calculator. need display amount of coffee in grams. "g" symbol grams needs attached uilabel using display amount. numbers in uilabel changing dynamically user input fine, need add lower case "g" on end of string formatted differently updating numbers. "g" needs attached numbers number size , position changes, "g" "moves" numbers. i'm sure problem has been solved before link in right direction helpful i've googled little heart out. i've searched through documentation attributed string , downloded "attributed string creator" app store, resulting code in objective-c , using swift. awesome, , helpful other developers learning language, clear example of creating custom font custom attributes using attributed string in swift. documentation confusing there not clear path on how so. plan create attributed string , add end of coffeeamount string. var coffeeamount: string = calculatedcoff