Posts

Showing posts from March, 2012

mysql - YEAR() and MONTH() in Doctrine2 with Symfony 2.4 -

i've installed stofdoctrineextensionsbundle use sql functions month() , year() keep getting error: attempted load class "month" namespace "doctrineextensions\query\mysql" in /var/www/symfony/vendor/doctrine/orm/lib/doctrine/orm/query/parser.php line 3389. need "use" namespace? in controller have this: $dql = "select x pfcfisiogestbundle:facturaemitida x month(x.fecha) between '".$mes_inicio."' , '".$mes_fin."' , year(x.fecha) = '".$ano."' order x.numero desc"; $querydefault = $em->createquery($dql); and in config.yml doctrine: dbal: driver: "%database_driver%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: utf8 orm: a...

TFS 2013 Reconcile workspace popup not showing -

we have gated checkin. when checkin files changes left in workspace can continue work. when build finished popup reconcile workspace. can reconcile right clicking build want popup don't forget it. my colleagues getting popup don't. can't find option show popup again. have idea? we have tfs2013 update 2 en visual studio 2013 update 3 installed. as just tfs correctly hinted, pop-up "reconcile workspace" part of build notification application . visual studio makes run automatically @ logon - if closed it, won't run unless re-run it.

jquery - Get JSON array from string AJAX response -

i response ajax request. ajax call function php get_contents() , html output of reqeusted page. <script type="text/javascript"> var jsloaded = ''; var searchcategories = [{"title":"something","id":"3","count":28117},{"title":"something","id":"35","count":14647},{"title":"something","id":"1","count":1124},{"title":"something","id":"6","count":836},{"title":"something","id":"5","count":18645},{"title":"something","id":"7","count":4791},{"title":"something","id":"8","count":21117},{"title":"something","id":"76","count":179},{"title":"somethin...

c++ - Emplacing a std::pair -

is there way of emplacing std::pair ? std::unordered_map<int, std::pair<std::string, std::string>> my_map; my_map.emplace(1, "foo", "bar"); // error of course inserting possible: my_map[2] = std::make_pair("bar", "foo"); but doesn't require unnecessary copying/moving? is there way of emplacing std::pair? the arguments need suitable constructor of pair<int, pair<string,string>> , map's value_type : my_map.emplace(1, std::make_pair("foo", "bar")); but doesn't require unnecessary copying/moving? no; make_pair makes pair of pointers string literals, used initialise (in case of emplace ) or assigned (in case of [] ) strings contained in map.

python - UPDATE statement on Access database fails silently under pyodbc -

i have problem simple update statement. wrote python tool creates lot of update statements , after creating them want execute them on access database doesn't work 1 statement example: update fcl_b_coversheet_a set branch = 0 obj_id = '1220140910132011062005'; the statement syntax not problem. tested , works. this next code snippet shows initialization connect object. strinputpathmdb = "c:\\test.mdb" drv = '{microsoft access driver (*.mdb)}'; con = pyodbc.connect('driver={0};dbq={1};uid={2};pwd={3};'.format(drv,strinputpathmdb,"administrator","")) after wrote method execute 1 sql statement def executesqlstatement(conconnection, strsql): arcpy.addmessage(strsql) cursor = conconnection.cursor() cursor.execute(strsql) conconnection.commit() and if execute code seems work - no error message or - data not updated , don't know i'm doing wrong ... for strsql in sqlstatearray: ...

c# - Fiddler and .Net 3.5 SSL error. Works fine in .Net 4.0 -

first thing, site , post. https://saplic.receita.pb.gov.br/sintegra/sinf_consultasintegra.jsp fullfil field cnpj value instance 34151100004209. works fine in chrome , .net 4.0 httpwebrequest. cant debug in fiddler , cant make work on .net 3.5 i'm using system.net.servicepointmanager.servercertificatevalidationcallback += new system.net.security.remotecertificatevalidationcallback(customxertificatevalidation); system.net.servicepointmanager.securityprotocol = system.net.securityprotocoltype.ssl3; system.net.servicepointmanager.expect100continue = false; this driving me insane. appreciated make things more clear, i'm having 1 problem happening on 2 differente places (fiddler , .net 3.5) the code i'm trying run is. cookiecontainer cookcon = new cookiecontainer(); httpwebrequest request = (httpwebrequest)webrequest.create("http://sintegra.receita.pb.gov.br/sintegra/sintegra.asp?estado=pb"); request.timeout = configuration.timeout; r...

php - Laravel Eloquent - Table join -

i have 1 problem need help. i'm doing 1 project in learning purposes. i have 2 tables, first 1 users contain id (pk, ai), username, email, password , on... another table called friends contain user_a (fk users.id), user_b (fk users.id), status (0 - pending, 1 - confirmed)... lets current logged user have id 1. i need join 2 tables , complete friend list logged user, query trough table friends user_a or user_b = logged user id, , data (from table users) friend... lets this: user_a = 1, user_b = 2 userb_a = 3, user_b = 1 i need info users 2, 3. i hope understand need. btw know how without using eloquent, need use eloquent. thanks lot! this many many relationship, need belongstomany . // basic setup public function friends() { return $this->belongstomany('user', 'friends', 'user_a', 'user_b') ->withpivot('confirmed'); } however that's not all, since want bidirectional. means need setu...

caching - How does a prefetch MSHR works? -

i have been reading miss status handling registers (mshr) , using sim-alpha experiments cache , noticed in parameters number of mshrs can configured, number of prefetch mshrs . i have looked in article describes alpha 21264 microprocessor not mention it. neither have found online resource can definition. does 1 knows how prefetch mshr works? thanks , best regards.

Laravel breadcrumbs bundle cannot find custom template -

i using https://github.com/davejamesmiller/laravel-breadcrumbs package. installed says in instructions, want create custom template breadcrumbs. i have created app/breadcrumbs.php: breadcrumbs::register('home', function($breadcrumbs) { $breadcrumbs->push('home', route('home')); }); breadcrumbs::register('about', function($breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push('about company', route('about')); }); then in config file of package: return array( 'view' => 'laravel-breadcrumbs::_partials.breadcrumbs', ); then created view in app/views/_partials/breadcrumbs.blade.php: @if ($breadcrumbs) <ul class="breadcrumb"> @foreach ($breadcrumbs $breadcrumb) @if (!$breadcrumb->last) <li><a href="{{{ $breadcrumb->url }}}">{{{ $breadcrumb->title }}}</a></li> ...

mysql - Why wont coalesce or is null work on results from a left join? -

in following sql, why wont coalesce work, or null? have because of left join in there? there no rows subquery return in case. i. e itemid = 'us1' not exist in table amgb . i'm on mysql 5.5.25 on windows 7 64. select a.itemname, (select coalesce(itemimagename,'default.jpg') // null amgb b a.userid = b.userid , a.itemid = b.itemid limit 1 ) itemimagename amga a.userid = 1 , a.itemid = 'us1'; (select if(itemimagename null,'default.jpg',itemimagename) // null the reason it's null because coalesce inside of subquery. instead move outside this: select a.itemname, coalesce((select itemimagename amgb b a.userid = b.userid , a.itemid = b.itemid limit 1 ), 'default.jpg') itemimagename amga a.userid = 1 , a.itemid = 'us1';

Reading system time in CST time zone using Java -

i trying read system date in cst time zone using java. tried below code whenever use formatter.parse() returning time in est time zone. private date gettodayincst() { calendar currentdate = calendar.getinstance(); dateformat formatter = new simpledateformat("dd-mm-yyyy hh:mm:ss"); timezone obj = timezone.gettimezone("cst"); formatter.settimezone(obj); string today = formatter.format(currentdate.gettime()); try { return formatter.parse(today); } catch (parseexception e) { e.printstacktrace(); } return null; } java.util.date objects not contain timezone information - cannot set timezone on date object. thing date object contains number of milliseconds since "epoch" - 1 january 1970, 00:00:00 utc. if want set timezone try way simpledateformat format = new simpledateformat("yyyy-mm-dd hh:mm:ss z"); format.settimezone(timezone.gettimezone("cst")); system.out.println(fo...

visual studio - live debug in vm - failed to power on the virtual machine -

i want remotely debug visual-cpp app vmware virtual debugger windows 7 x64 host in windows vista ultimate x64 guest. have same visual studio 2010 installed on both host , guest. followed directions here , setting following in host vs vmware options: virtual machine - path .vmx file remote debug monitor path - path msvsmon.exe on host remote debug monitor name - vmdebug guest command - \\vmware-host\shared folders\...\bin\debugwin32\myapp.exe guest login credentials - user , pass vm the problem when start remote debugging, get: debugging started... starting virtual machine. an error has occurred in application. more information please see log file. path listed in box. vmware: failed power on virtual machine. unknown error. this action terminated prematurely or canceled user. an error has occurred in application. more information please see log file. path listed in box. i looked log file activitylog.xml , can see information r...

c# - Uniqueness for a shortened guid -

i have append unique code querystring, every url generated. so, option chose shorten guid (found here on so). public static string createguid() { guid guid = guid.newguid(); return convert.tobase64string(guid.tobytearray()); } will unique guid, cause have several urls generate , guid saved in db. you should watch out if using in url. while string shorter, potentially have characters illegal in urls, may need run past httputility.urlencode() to safe. of course, once that, little longer again. edit: your comment makes seem want sort of math, here goes: let's assume have 24 alphanumeric characters time, , casing not matter. means each character can 0-9 + a-z or 36 possibilities. makes 24 ^ 36 different possible strings. refer website then: http://davidjohnstone.net/pages/hash-collision-probability which lets plug in possible values , number of times need run code. 24^36 equivalent 2^100 (i arrived @ numb...

java - TestNG - WebDriver - Web apps Testing - Independent Tests -

how handle db inside of script using testng framework? how delete db before each run of test script? how load sql file clean db before running test script? goal: each test case must independent framework: testng language: java each test case must independent against other test cases. goal run test cases randomly, no order required. previously have used phpunit framework each test case independent. before running each test script, would: dropdatabase create new database load sql file database initial data i using inside of shell script, , call shell script via command line: mysql -u$db_user -p$db_pwd -h$host -e "drop database $db_name" mysql -u$db_user -p$db_pwd -h$host -e "create database $db_name" mysql -u$db_user -p$db_pwd -h$host $db_name < sql/dbinit.sql google-ing not helpfull, therefore posting question here. need testng have not found similiar. could give advice fellow qa. how handle oracle database, how delete data db , l...

SQL Server T-SQL Query Optimization -

i trying optimize following t-sql query: select person.* person zipcode '123%' , city = 'washington' , numberofhomes in (1, 2, 3) , ( exists ( select * house person.id = house.personid , house.type = 'townhouse' , house.size = 'medium' ) or exists ( select * color person.id = color.personid , color.foreground in ('green', 'blue', 'purple') ) ) i'd appreciate response in optimizing query. in particular, there way convert query more efficient query using single select statement without of inner select statements? thanks! this query: select p.* person p p.zipcode '123%' , p.city = 'washington' , p.numberofhomes in (1, 2, 3) , (exists (select * house h p.id = h.personid , h.type = 'townhouse' , h.size = 'medium' ) or exists (select * ...

MySQL syntax-error in nested loop block. Can't find the error. -

i tried code simple nested loop mysql block. server got me syntax error, can't find it. does see it? the error message was: query: end loop get_invoice error code: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'end loop get_invoice' @ line 1 begin declare v_id int default 0; declare v_finished1 int default 0; declare invoices_cursor cursor select id_invoice invoice invoice_type = 're' , exists (select 1 invoice ma invoice_type = 'ma' , ma.origin = i.id_invoice); declare continue handler not found set v_finished1 = 1; open invoices_cursor; get_invoice: loop fetch invoices_cursor v_id; if v_finished1 = 1 close invoices_cursor; leave get_invoice; end if; declare v_finished2 int default 0; declare v_dunning_level int default 1; declare dunni...

javascript - Js, Ajax, Json - How not to insert "Array" into db from autocomplete -

im building little script automatically fill few input fields based on autocomplete of first input field. i have script working, when hit submit button seems ok, when db see inserted, fields inserted "array" instead of supposed inserted. on autocomplete, can see field being field right info, guess php doesn't understand is, , inserts "array" instead. any ideas how fix it? my form: <form action="job_post.php" method="post"> <div class="form-group has-success col-md-3"> <label class="control-label" for="inputsuccess1">first name: </label> <input type='text' id='firstname' name='firstname[]'/> </div> <div class="form-group has-success col-md-3"> <label class="control-label" for="inputsuccess1"...

php - imagerotate when using move_uploaded_file -

trying counter issues uploaded images ios devices exif orientation kept causing them rotated sometimes. i found many snippets on using imagerotate counter problem trying implement them. for saving of image using: $moveuploadedfile = move_uploaded_file($filetoupload["tmp_name"], $this->uploaddir . "/" . $newfilename); (taken bulletproof image upload class) im fine making switch statement check exif data, cant make move_uploaded_file work. i have tried (for testing) e.g: $image = $filetoupload["tmp_name"]; $image = imagerotate($image, 90, 0); $moveuploadedfile = move_uploaded_file($image, $this->uploaddir . "/" . $newfilename); this giving me error of move_uploaded_file requesting string receiving resource instead. any help? here go sir public function moveuploadedfile($tmp_name, $destination) { if(move_uploaded_file($tmp_name, $destination)){ $this->image_rotation(); ...

c++ - Dynamically create new instances of a custom widget & connect signals & slots (Qt) -

part a: i have created widget called panel i'd iteratively make new instances of. so, example, like: panel *panelarray[10]; for(int i=0;i<10;i++) panelarray[i] = new panel(this); would appropriate syntax? part b: if so, how manually hook signals emitted each of panels? example: for(int i=0;i<10,i++) connect(panelarray[i], signal(raisetoggleguicmd(qbytearray)), this, slot(writedata(qbytearray))); thanks in advance! part looks normal. part b looks normal too, if want know widget emit signal, should use this( in case, slot same thing every widget) usage of qsignalmapper signalmapper = new qsignalmapper(this); (int = 0; < 3; ++i) { qpushbutton *button = new qpushbutton(qstring::number(i),this); connect(button, signal(clicked()), signalmapper, slot(map())); button->move(i*10,i*10);//doesn't matter signalmapper->setmapping(button, qstring::number(i)); } connect(signalmapper, signal(mapped(const...

xcode - iOS 7 Force Portrait Orientation When Dismissing Push -

Image
at time halfway keeping viewcontrollera in portrait mode. this, using preferredinterfaceorientationforpresentation this ensures viewcontrollera, when push it, in portrait mode. however, if push viewcontrollera viewcontrollerb, switch landscape mode in viewcontrollerb, and dismiss viewcontrollera, viewcontrollera can presented in landscape mode. desire continue multiple orientation support of viewcontrollerb, force viewcontrollera autorotate portrait. also, reason shouldautorotate not appear getting called in viewcontrollera. perhaps addressing fix entire issue? uinavigationcontroller+orientation.h category @interface uinavigationcontroller (orientation) - (bool)shouldautorotate; - (uiinterfaceorientation)preferredinterfaceorientationforpresentation; @end uinavigationcontroller+orientation.m category -(bool)shouldautorotate { return [[self.viewcontrollers lastobject] shouldautorotate]; } - (uiinterfaceorientation)preferredinterfaceorientationforpresentation {...

ios - symbolicatecrash from XCODE 6 GM -

any 1 tried symbolicatecrash xcode-6 gm release? looking /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/library/privateframeworks/dtdevicekitbase.framework/versions/a/resources/symbolicatecrash but not available xcode-6 package. available in xcode-5 i went through moments ago. symbolicatecrash file moved. it's at: /applications/xcode.app/contents/sharedframeworks/dtdevicekitbase.framework/versions/a/resources/symbolicatecrash of course should adjust root of path based on installed xcode 6. i used new path update soft link in /usr/local/bin .

telerik - BindingRedirect with changes to Assembly Names -

i'm trying convert active report 6 reports telerik reporting. teleriks' build in conversion tool, however, built work active report 3. i found kb article of telerik's: http://www.telerik.com/support/kb/reporting/details/converting-reports-from-activereports , talks how use updated versions of ar3 other 1 built against... because there dll name change (activereports3 changed activereports6), it's not working. is there way 'if see dll request ar3, send new assembly named ar6'? don't believe can use appdomain.assemblyresolve event because don't have access code of converter tool or message boxes brings up. i know if possible, blow reports , i'd have build them new anyway, reports super simple (lines, text boxes, shapes), (maybe) if can work, won't hard. no way know until try! thanks all! amanda, since work grapecity, have ask. there reason why moving away activereports telerik? technical reasons? business changes? either...

c# - Updating AD User information -

i having problem updating user information in active directory db... when run following code error: the specified directory service attribute or value not exist the problem path using save information this: cn=ad test,ou=container name,dc=us,dc=flg,dc=int ad test username in ad trying update. and believe should be: cn=ad test,ou=container name, ou=server name,dc=us,dc=flg,dc=int i new directory services appreciate in finding out why cannot update... thank in advance public bool updateactivedirectory(string ldapservername, string custid, employee sqlresult) { try { directoryentry rootentry = new directoryentry("ldap://" + ldapservername, "usrename", "password", authenticationtypes.secure); directorysearcher searcher = new directorysearcher(rootentry); searcher.filter = "(samaccountname=" + sqlresult.logonnt + ")"; searcher.propertiestoload.add("title"); ...

Store time and date separably in a mysql database using default values -

in mysql database table have 2 columns called "date" , "time". "date" datatype set datetime , "time" datatype set timestamp. want store date in "date" column , store time in "time" column. table name "loans".i'm not in sql querying. please show me how that. and have problems time zones. want convert database time format utc -5:00 (us time).how can without change pc time ? separating date , time same event bad idea. go storing in simple datetime field. but can this give date field type date (not datetime) , time field type time (yes exists , not timestamp) now allow store date in yyyy-mm-dd , time in hh:mm:ss to set time zone of mysql server can use one how set time zone of mysql?

ReactJS routing/browser-sync reload on /path produces Cannot Get /Path error -

i'm building basic react/flux application , using react-router-component routing, browser-sync live reload on build changes, , browserify dependency injection. the problem have when live reload or reload occurs on path isn't "/" (i.e. "/profile", "/gallery", etc...), error message of cannot /path (or route matter). i suspect has fact it's single page application , routing done on client. here browser-sync setup (it's basic). think might need add middleware, i'm not sure put in middleware. gulp.task('browser-sync', function() { browsersync({ server: { basedir: './client' }, notify: false }); }); this because whatever web server you're using serve out app trying find /profile or /gallery on server side. need instruct server requests goes root instead. depending on software called 'html 5 mode'. i noticed there's post on browser-sync git r...

Unity3d app commit to mac os x app store reject: Apps that are not sandboxed appropriately may be rejected -

Image
apple rejects unity3d app commit: 2.31: apps not sandboxed appropriately may rejected. if change use "com.apple.developer.game-center", can't upload binary, error: invalid code signing entitlements :libmonoposixhelper.dylib. : if don't use "game-center" sign, can upload successfully, , removed identifiers' "game center" still reject me. there're many people have same problem now: http://forum.unity3d.com/threads/urgent-mac-app-review-team-rejected-because-gamekit-framework-linked.261354 http://forum.unity3d.com/threads/mac-store-game-centre-entitlement-problem.265241/

php - Regexp matching 3 consecutive capital letters -

i have following text : 74 avenue emile counor bat b2 appt b104 i want replace line feed, if the following 3 letters not 3 capitals . for example, previous example should become: 74 avenue emile counor bat b2 appt b104 but 74 avenue emile counor bat b2 appt b104 should stay. i have tried many solutions via regexp tools, impossible match want. here have tried far preg_replace("/\n([^a-z]{3})/", " $1", $str) if want negate following lf, way use negative lookahead : $str = preg_replace("/\n(?![a-z]{3})/", " ", $str); note lookahead test , content doesn't appear in match result.

angularjs - Angular receives String as array? -

i toying around angularjs , asp.net's web api working together. have testcontroller in api that's simple gets: public class testcontroller : apicontroller { [httpget] public string ping() { return "pong"; } } in chrome can go http://localhost/api/test/ping , fiddler shows simple "pong" result , browser shows: <string xmlns="http://schemas.microsoft.com/2003/10/serialization/">pong</string> back in angular js, setup factory call ping function: app.factory('api', ['$resource', function ($resource) { return { ping: function () { var result = $resource('api/test/ping', {}, { get: { method: 'get' }, isarray: false }); return result.get(); } }; }]); and super simple controller: app.controller('myctrl', [ '$scope', 'api', function ($scope, api) { $scope.calltest = function () { api.ping().$...

android - Getting coordinates for street path? -

i having troubles getting coordinates entire street path. example, if street 1 kilometer long, coordinates on every 50 meters. so, it'd array of 20 coordinates (latitude , longitude). possible? mention, used geocoder , method getfromlocationname() getting 1 pair of coordinates particular street. any appreciate. dead end me, can't come idea @ all. thanks in advance!

javascript - How do you sort alphabetical without case sensitive -

this question has answer here: how perform case insensitive sorting in javascript? 12 answers how make alpha sort not case sensitive? understand should use tolowercase don't know how. sort_alpha: function(a,b) { if (a[0]==b[0]) return 0; if (a[0]<b[0]) return -1; return 1; } you need turn , b lower case var lower_a = a.tolowercase(); var lower_b = b.tolowercase();

Rails & Heroku: Can I share database between two apps? -

i have 2 similar applications on heroku, there way can make them share databases ? @ least user authentication ? right after got answer question following came mind: using multi app architecture long term / heavy network system: 1- first issue face more processes have interacting shared resource, more face scaling/performance , timing issues. 2- complexity of models, because @ point i'm planning use rails engines, , realized mess of data_model_prefixes. 3- costy ? monolithic apps on 1 db vs many apps. i found few other solutions regarding issue or let's approach: 1- letting every application have own database, maybe using api share common tables between applications. 2- if decided go aws, can use amazon rds plugin lets model being access different databases uing activerecord. sources: https://stackoverflow.com/a/5986996/539075 https://stackoverflow.com/a/3479315/539075 and taskrabbit explained part of well: http://tech.taskrabbit.com/blog/2014/02/11...

php - Sql query to show count(*) of groups while keeping all rows of the group -

i have table similar following id user_id father_id 1 1 1 2 2 1 3 3 2 4 4 2 5 5 2 6 6 3 7 7 4 i search sql query (prefer fluent or eloquent laravel 4) give me following result: id user_id father_id family_members 3 3 2 3 4 4 2 3 5 5 2 3 1 1 1 2 2 2 1 2 6 6 3 1 7 7 4 1 as can observed family_members count of users have same father_id select id, user_id, father_id, count(*) family_members users group father_id the query above, keeps top row of each group, want keep other records , not first one; sorting them first according family_members , according father_id how can achieve it? i don´t know fluent, nor eloquent, nor laravel 4, sql query this. select your...

python - pyqt graceful logout my app when user signs off -

when app running, if user logs off pop window displaying info , confirming logout class myapp(qtwidgets.qapplication): def __init__(self, *args, **kwargs): super(myapp, self).__init__(*args, **kwargs) self.commitdatarequest.connect(lambda manager: self.commitdata(manager)) @qtcore.pyqtslot(qtgui.qsessionmanager) def commitdata(self, manager): print 'shutdown' if __name__ == '__main__': qapplication = myapp(sys.argv) qtwidgets.qapplication.setquitonlastwindowclosed(false) #interaction through tray icon application.exec_() the issue it's not going slot method. my app not have main window, interfaces through tray icon. you need on ride qtwidget: def closeevent(self, event): quit_msg = "are sure want exit program?" reply = qtgui.qmessagebox.question(self, 'message', quit_msg, qtgui.qmessagebox.yes, qtgui.qmessagebox.no) if reply == qtgui.qmessagebox...

Is curl enabled by default with any PHP install? -

is curl extension enabled default php install? if yes, starting version of php? you check trusty phpinfo function. remember delete afterward. sorry if isn't within scope of question. <?php phpinfo(); ?>

jquery - AJAX not posting data to PHP in IE only -

so have ajax call i'm using post 1 variable php script have on separate server. php takes variable , returns data based off of variable is. works on browsers except ie9 , below. ie9 returns data it's error saying variable missing me shows isn't sending data. below have ajax call i'm making: (function (jq) { var inviteid = '00000000000'; jq.ajax({ url: 'www.example.com/test.php', type: 'post', datatype: 'json', cache: false, data: { classid: inviteid }, error: function (data, status, error) { jq('.statusfield').append('failure: ' + data + status + error); }, success: function (data, status, error) { jq('.statusfield').append('success: ' + data); } }); })(jquery); and below have php script that's being used: <?php //first post grab token function runpost($classid) { $postdata = array( 'username' => 'username', ...

How do I put emacs menubar into Window title bar in Ubutu 14.04? -

while using ubuntu 14.04, menus shown in window title bar. if emacs opened, menus in menubar in older versions of ubuntu or windows. can menus in window title bar. this isn't setting can flip in emacs; it's defined version of gtk against emacs compiled (if any), compile-time settings, , ubuntu settings. compile own emacs enable this, using personal package archive install pre-built version easier. this ppa provides emacs-snapshot package works way want. package bleeding-edge build of emacs, updated frequently, , differences official ubuntu emacs package. notably: little/no support installing debian packages of elisp modules. of support exists in form of distropatch, not included here. example if apt-get install yaml-mode , have include "(require 'yaml-mode)" in init, wouldn't able autoload yaml-mode may accustomed stable series. working on enabling this, warned broken. on plus side, package.el works excellently , of packages mig...

javascript - HTML5: Resizing a canvas -

all time worked on app in 800x480 resolution (popular phone resolution). my canvas html: <canvas id="main" width="800" height="480"> now make fullscreen other resolutions, following after resize event: $('#main').css('height', window.innerheight); $('#main').css('width', window.innerwidth); this works problem can't maintain aspect ratio way. 800x480 4:3, if run app on 5:3 phone, things (especially circles) stretched. is there way make on resolutions without having create unique set of images , code every aspect ratio? css properties width , height stretch canvas, in order scale board, must use .attr instead of .css , work, but, note: if want canvas perfect on mobile phones, too, must pay attention window.devicepixelratio . what's devicepixelratio mdn: the devicepixelratio property returns ratio between physical pixels , device independent pixels in current display. what...

java - Hibernate - How to persist a property which is mapped with Formula -

this question similar 1 asked here could shed light why hibernate decides ignore property, has formula, while persisting. if whats alternative persist property has formula ? there additional config ? query fired hibernate : insert fighterjet (max_speed, country, jet_id) values (?, ?, ?) note how hibernate ignores 'name' property in insert query, has formula in hbm. hbm : <hibernate-mapping> <class name="com.fighterjet.fighterjetdo" table="fighterjet"> <id name="jetid" type="int" column="jet_id"> <generator class="increment" /> </id> <property name="name" formula="select 'hi' dual" > <column name="name"/> </property> <property name="maxspeed"> <column name="max_speed" /> </property> <p...

Batch file to open Excel files -

i trying open excel files 1 one in particular folder (mentioned in code) through batch file. getting error file extension not read code or machine. eg: have excel file in dir path "d:\eplans" "ep101.xlsx". while running code error comes : could not find file "ep101.xl code: chdir d:\eplans dir /b *.xlsx > list_dwg.txt /f "delims=<tab><space>" %%f in (list_dwg.txt) (start "d:\program files\microsoft office\office12\excel.exe" %%f) ps: newbie batch programming. i'd say for %%a in (d:\eplans\*.xlsx) start "%%a" i assume xlsx files associated excel anyway, txt file unneccesary, , %%a contain full path.

oracle - SQL - Literal does not match format string -

i apologize if question has been asked in advance. i've been looking around answer this, , of answers error message seem involve date fields. however, there no date field in following: create table tablename ( trans_dest_name varchar2(50) not null, mmddyyyy varchar2(8) not null, constraint holiday_key primary key (trans_dest_name, mmddyyyy), constraint trans_dest_name_ch check(regexp_like(trans_dest_name,'^[a-za-z0-9 ]{0,50}$')), constraint holiday_format check ( (to_number(substr(mmddyyyy, 0, 2))) < 13 , (to_number(substr(mmddyyyy, 0, 2))) > 0 , (to_number(substr(mmddyyyy, 2, 2))) < 32 , (to_number(substr(mmddyyyy, 2, 2))) > 0 , (to_number(substr(mmddyyyy, 4, 2))) = 20) ); insert tablename values ('power pass', '01012015'); fyi, problem coworker came me with. i'm not sure why they're using string represent date, format they've decided go with. problem is...it seems if "power pass...

php - Cannot use object of type Closure as array -

fatal error " cannot use object of type closure array", how fix problem. code using below function message_broker_example_message_broker_consumers($self_name) { $consumers = array(); // example consumer implemented using closure. $consumers['helloworldtoeveryone'] = array( 'queue' => 'helloworldforall', 'callback' => function($message, \closure $ack) { $message = json_decode($message->body); if ($message->name == 'crash') { throw new invalidmessageexception('invalid name detected!'); } if (function_exists('drush_print')) { drush_print('hello world, ' . $message->name); } else { drupal_set_message(t('hello world, @name.', array('@name' => $message->name))); } $ack(); }, 'invalidmessagehandler' => function($message) { if (function_exists('drush_print')) { ...

multithreading - Java. Simple thread operation exchange -

i writing simple java tcp client app. connection handled in thread, , confused, how can process functions in main thread class? should use special static class? or there "scheduler", proccess actions between threads? /* in main object or thread */ synchronized (someobject) { someobject.wait(); } /* in tcp connection thread / object */ synchronized (someobject) { someobject.notify(); }

eclipse - Cannot debug Android application with native code -

i'm trying debug native application in eclipse. unfortunately, when run "debug as-> android native application" see following errors in console: [2014-09-10 21:03:48 - genderdetector] verify if application built ndk_debug=1 [2014-09-10 21:04:16 - genderdetector] gdbserver output: [2014-09-10 21:04:16 - genderdetector] run-as: package 'com.opencv.genderdetector' unknown if try add "ndk_debut=1" ndk-build command see following errors: [armeabi-v7a] gdbserver : [arm-linux-androideabi-4.9] libs/armeabi-v7a/gdbserver install: cannot stat ‘/home/yury/software/android-ndk/prebuilt/android-arm/gdbserver/gdbserver’: no such file or directory make: *** [libs/armeabi-v7a/gdbserver] error 1 could please explain i'm doing wrong? here steps may : check if /home/yury/software/android-ndk/prebuilt/android-arm/gdbserver/gdbserver exsits check if has execution permission. add path environment variables maybe help. make sure android-n...

pagination - CodeIgniter adjusting url when passing parameters to controler -

ok have records database listed in view file, u can see wanna pass values controler via href update/grab function controler echo $this->pagination->create_links(); br().br(); foreach ($query->result() $q): ?> <a href="update/grab/<?php echo $q->id;?>/<?php echo $q->info; ?>"><?php echo $q->info . br()?></a> <?php endforeach; ?> it works first page in pagination, when on other page when clicked on on record, instead passing parametars controler when clicked in keep adding url example http://localhost/z/records/users/update/grab/3/update/grab/1/update/grab/1/update/grab/1/trtr so error when have in url, when on second page in pagination http://localhost/z/records/users/2 works when on first page http://localhost/z/records is there way solve proble. works if how adjust routes??? need help, please me important try changing link absolute url: <a href="/z/update/grab/<?ph...

java - Error : Cannot resolve method -

i trying create program had multiple characters different attributes. ran issue calling method (tried) define in class character. public class characterattributes { public static void main(string[] args) { character john = new character("john", 0); workout(5); } } class character { private string name; private int str; public character(string n, int initialstr) { name = n; str = initialstr; } public void workout(int byamt) { str = str + byamt; } } the compiler said "workout()" method not resolved. thanks! there's lot of errors, honestly. the method belongs class character , should call against instance john : john.workout(5); as side note, conventional start name of variable lowercase ( john instead of john , str instead of str ), , give them names reflect type ( str gives hint it's string while in fact int ). edit: based on comment, if call method workout w...

Tab Control In WinRT WINDOWS 8 C# -

Image
i new windows 8 app development. creating 1 windows tablet application in visual studio express 2012 windows 8. possible run app tablet because developing application in visual studio 2012 windows 8??? want add tab control app windows phone 7 & 8 supports pivot control have attached 1 image here. want add same controls in app image shown. 1 tab control , each tab there tab control. how can add app?? please me i'd recommend switching visual studio express 2013. 2012 should work 8.0 though. there no tab control in winrt xaml. there grouped gridview or hub control serves similar purposes though. if you'd rather go more classic zune software-like tabbed interface - should put bunch of restyled radiobuttons in horizontally oriented stackpanel here , few overlaid grids underneath, switch visibility of these panels based on checked radiobutton .

How to find image data size using javascript? -

on webpage, once images have been downloaded , rendered, need determine image's file size (kb) within browser context (so display info on page, below image) the easiest way head request returning content-length : function filesize(img, func) { var xhr = new xmlhttprequest(); xhr.open('head', img.src, true); xhr.onreadystatechange = function() { if(xhr.readystate == 4 && xhr.status == 200) { func(xhr.getresponseheader('content-length')) } } xhr.send() } usage filesize(imgnode, function(size) { // ... })

visual studio 2013 - Web Essentials for VS2013 Update 3 is extremely laggy -

i updated vs2013 update 3 along web essentials. extension. now, when run solution, freezes ~3 seconds every ~5 seconds, making vs totally unusable when i'm debugging. can't edit source. else experiencing has found fix? solution uninstalling we.

linux - stopping the script by pressing the specific button (listen STDIN while script is dealing with it) -

there script interacts user "press y / n" dialog (i.e. stdin in use). pressing predefined keyboard button main script should interrupt work. i tried implement 2 ways, read , using grep (ah, , tried using stty - stty -echo -icanon time 0 min 0, in didn`t work). the problem grep (grep -q ) main thread goes in loop grep (which looped in order check stdin), while need main script move on, listening stdin specific key pressed. read transformed such small piece: breakbybutton() { while ! [ "$z" = "11" ] read -t 1 -n 1 key if [[ $key = <desired key> ]] echo -e "\n\e[31mstopped user\e[0m" break fi done } of course, function works called. separate script in background, grep, execution interrupted after first pressing enter. i'm thinking of parallel process - script , read, haven`t got decisions yet. that why there interrupts. if want interrupt process otherwise using stdin, type ctrl-c. ...

amazon web services - attach ebs volume with packer during build time -

i'm not sure if right way go i'm looking shorten build time of image packer. 1 of steps required copy 10gb of data , make part of image. i'm using shell provisioner sftp in image. takes long time. instead have data in ebs volume can attached @ build time. since mounted block device in amazon's own network transfer faster sftp. i tried searching around such method in packer there's not out there. i'm going try , see if can use ami_block_device_mappings optional parameter in amazon-ebs builder attach ebs volume. if there better method i'm not aware of please let me know. thanks. so looks shell provisioner way go..for now. shell provisioner seems catch things :). have parameter in amazon-ebs builder @ point though. "attach_ebs_volume" instance. anyway, here's how did it: add aws info (ebs_volume, instance_id etc..) variables secion of template. pull access , secret key env it's not spelled out in template rest d...

Not receiving output from json-parser in python -

this incredibly basic: had used python parsing json files in single directory several months ago. can't figure out how tweaked (a teammate came code) can data more useable csv format. at moment, i'm getting zilch when using python launcher or terminal. what parser looks like: import codecs import json import os import sys try: import unicodecsv csv except importerror: import csv output_file = 'output.csv' def process_file(infile, writer): print('processing file: %s' % infile) codecs.open(infile, encoding='utf-8') infile: data = json.load(infile) item in data: _id = item['id'] description = item['description'] gov in item['source']: gov_id = gov['name'] source in item['secondarysource']: source_id = source['sourceid'] ...

What VHDL libraries to use for decimal modulus -

Image
library ieee; use ieee.std_logic_1164.all; --use ieee.std_logic_arith.all; --use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; entity two_number_split port ( number : in integer range 0 99; position0 : out std_logic_vector (3 downto 0); position1 : out std_logic_vector (3 downto 0)); end two_number_split; architecture behavioral of two_number_split signal pos0, pos1 : std_logic_vector(3 downto 0); begin convert: process(number, pos0, pos1) begin pos1 <= number/10; pos0 <= number mod 10; position0 <= std_logic_vector(pos0); position1 <= std_logic_vector(pos1); end process convert; end behavioral; errors: error:hdlcompiler:1638 - "c:\users\xxx\documents\ss\ise_ex\seven_segment\two_numbers.vhd" line 19: found '0' definitions of operator "/", cannot determine exact overloaded matching definition "/" error:hdlcompiler:1638 - ...

python - BeagleBone SPI using mmap -

i having trouble configuring bbb spi using python mmap. rather rolling device tree overlay myself, i've been using adafruit_bbio.spi (a similar approach has been working adafruit_bbio.gpio). works well, , through spidev, can send data. use mmap spi_tx0, bus error. i can resolve bus error turning on clock domain spi peripheral: ctrl = struct.unpack('<l', cm_per[cm_per_spi0_clkctrl:cm_per_spi0_clkctrl+4])[0] ctrl &= ~(0b11 << 16 | 0b11) ctrl |= 2 cm_per[cm_per_spi0_clkctrl:cm_per_spi0_clkctrl+4] = struct.pack('<l', ctrl) but don't understand why necessary; shouldn't adafruit_bbio have turned clock domain on? more importantly, though, spi0[spi_tx0:spi_tx0+4] = struct.pack(' < l', data) nothing.

java - Is binary operation more efficient than modulo? -

there 2 ways check if number divisible 2: x % 2 == 1 (x & 1) == 1 which of 2 more efficient? the bit operation faster. division/modulus generalized operation must work divisor provide, not 2. must check underflow, range errors , division zero, , maintain remainder, of takes time. the bit operation bit "and" operation, in case happens correspond division two. might use single processor operation execute.

how to avoid a domain call in unit testing with grails / spock -

i have following lines of code username = username.stripindent() user = user."${databaseinstance}".findbyusername(username) if (user == null){ return "user not exist" } i'm trying unit test functionality with: def setup() { def mockuser = mock(user) myclass.user = mockuser } void "usernotfoundgetuserinfo"(){ given: myclass.databaseinstance = 'x' _ * mockuser._ >> null when: def result = myclass.getuserinfo(username) then: result == "user not exist" } but keep getting error of "no such property: x class mypackage.user" i realize because i'm mocking "user" object , not "user" class, how around fact code making direct call domain class? use grails built-in @mock annotation instead of spock's mock() method. go like: @mock(user) class yourtestspecification extends specification { def setup() { myclass.user = new user...

java - NoClassDefFoundError when using resteasy @Path annotation -

i have controller class annotated @path annotation resteasy. runs normally. but when extend class basecontroller, located in project (included in project build path), error of noclassdeffounderror when trying reference basecontroller. works: @path("/") public class controller {...} works: @path("/") public class controller extends basecontroller {...} //basecontroler same project works: public class controller extends basecontroller {...} //basecontroler other project doesn´t work: (noclassdeffounderror) @path("/") public class controller extends basecontroller {...} //basecontroler other project any idea on this? your problem same question: java project unable refer project in case, "otherprojectclass" not instatied.