Posts

Showing posts from June, 2015

c# - argumentnullexception was unhandled insert into -

i'm attempting insert data database via datagridview. code far checks see if table exists, if not creates new table, , copies data it. can copy data table , works well. until error argumentnullexception unhandled . data inserted table, , can view table , see data there. description error: parameterized query 'insert [alalala_thomas_humphries_quote]([item name], [item description], [retail price], [supplier number], [quantity required], [in stock], [cost price], [total cost],[total retail]) values (@item, @desc,@retail,@supplier,@quantity,@stock,@cost,@totalcost, @totalretail)' expects parameter value not supplied. parameter name: @item and code: private void insertdata() { string tablename = quotenametxt.text + "_" + firsttxt.text + "_" + surenametxt.text + "_quote"; sqlceconnection con = new sqlceconnection(@"data source=|datadirectory|\lwadatabase.sdf"); con.open();

c++ - Anjuta terminal output not long enough -

i'm using anjuta on lubuntu write program performs calculations on historical stock price data (2 years worth, 1 line per market day). when run program , it's output printed terminal in anjuta, of lines overwritten. else out there use anjuta , have solution this? there way outside of lightweight ide see of terminal output? there several solutions problem. you can redirect output of program file. in terminal window of anjuta, in project's root directory: src/executablename > outputfilename.txt which can see editor or viewer. you can redirect pager: src/executablename | less (exit less 'q') you can enter terminal (external anjuta), go project directory, , of above. just fair - anjuta isn't that lightweight.

c# - ToolstripButton remain focused in an MDI Form -

i have mdi form mdi container, toolstrip bar buttons , child form. on child form there third's part component draw cad application. if click on toolstripbutton start draw something, button remains in state pressed , execute operation must click somewhere on screen. if use menustrip don't have trouble. why toolstrip have behavior? if focus stays in button, can focus cad part manually use it: public void mybutton_click(object sender, eventargs e) { // other code... cadcomponent.focus(); } not sure why behaves that, though.

casting - C Function to Convert float to byte array -

i'm trying make function accept float variable , convert byte array. found snippet of code works, reuse in function if possible. i'm working arduino environment, understand accepts c language. currently works: float_variable = 1.11; byte bytes_array[4]; *((float *)bytes_array) = float_variable; what can change here make function work? float float_test = 1.11; byte bytes[4]; // calling function float2bytes(&bytes,float_test); // function void float2bytes(byte* bytes_temp[4],float float_variable){ *(float*)bytes_temp = float_variable; } i'm not familiar pointers , such, read (float ) using casting or something? any appreciated! cheers *edit: solved here's final function works in arduino finds this. there more efficient solutions in answers below, think okay understand. function: converts input float variable byte array void float2bytes(float val,byte* bytes_array){ // create union of shared memory space union { float floa

javascript - Is there a standard for testing d3 interactions in ember.js? -

right i'm trying test click interactions d3 generated svg elements: test('should not able scroll past extents', function() { expect(2); visit('/links'); fillin('.search input', 'list'); click('.selectable.active'); andthen(function() { var label = find('#xaxis .label').text(); equal(label, 'oldname'); // click svg element click('#plot rect.full.bar:first'); label = find('#xaxis .label').text(); // assert labelname equal(label, 'newname'); // still 'oldname' }); }); so far not work. suggestions?

jquery - javascript event running when the mouse is over elements created by another function -

this function create_canvas_card() creates box smaller boxes in it. how call function card_mouseover() whenever mouse on 1 of boxes? function create_canvas_card(card_data, each_card){//where card_data element/object , each_card int click_canvas_card_x = 10, click_canvas_card_y = 10;//these set elsewhere image_id = $(card_data.node).data('card') click_canvas_cards[each_card] = click_canvas.rect(click_canvas_card_x, click_canvas_card_y, 40, 40).attr('fill', 'url(/images/thumbnails/image'+ image_id +'.jpg)'); //my attempt $(card_data.node).bind('mouseover', function(e){ var card = cards[$(this).data('card')]; card_mouseover(card); }); //another attempt //click_canvas_cards[each_card].mouseover(click_canvas_card_mouseover(card_data.node)); } which called loop for(each_card in cards_to_create_for_click){ var card_data = cards_to_create_for_click[each_card]; create_canvas_card(card_data,

hadoop streaming job failed Unable to load realm info from SCDynamicStore env: ruby\r: No such file or directory -

while running hadoop streaming using ruby mapper , reduce functions, following error. packagejobjar: [summarymapper.rb, wcreducer.rb, /var/lib/hadoop/hadoop-unjar6514686449101598265/] [] /var/folders/md/0ww65qrx1_n1nlhrr7hrs8d00000gn/t/streamjob9165241112855689376.jar tmpdir=null 14/06/25 19:54:35 warn util.nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable 14/06/25 19:54:35 warn snappy.loadsnappy: snappy native library not loaded 14/06/25 19:54:35 info mapred.fileinputformat: total input paths process : 1 14/06/25 19:54:35 info streaming.streamjob: getlocaldirs(): [/var/lib/hadoop/mapred/local] 14/06/25 19:54:35 info streaming.streamjob: running job: job_201406251944_0005 14/06/25 19:54:35 info streaming.streamjob: kill job, run: 14/06/25 19:54:35 info streaming.streamjob: /users/oladotunopasina/hadoop-1.2.1/libexec/../bin/hadoop job -dmapred.job.tracker=localhost:8021 -kill job_201406251944_0005 14/06/25 19:54:35 info streamin

python - Gunicorn not picking stderr -

i have flask app following route: @app.route('/') def index(): console = logging.streamhandler() log = logging.getlogger("asdasd") log.addhandler(console) log.setlevel(logging.debug) log.error("something") print >> sys.stderr, "another thing" return 'ok' i run using python gunicorn --access-logfile /mnt/log/test.log --error-logfile /mnt/log/test.log --bind 0.0.0.0:8080 --workers 2 --worker-class gevent --log-level debug server:app the logs below: 2014-06-26 00:13:55 [21621] [info] using worker: gevent 2014-06-26 00:13:55 [21626] [info] booting worker pid: 21626 2014-06-26 00:13:55 [21627] [info] booting worker pid: 21627 2014-06-26 00:14:05 [21626] [debug] / 10.224.67.41 - - [26/jun/2014:00:14:14 +0000] "get / http/1.1" 200 525 "-" "python-requests/2.2.1 cpython/2.7.5 darwin/13.2.0" 2014-06-26 00:14:14 [21626] [debug] closing connection. what's happening l

php - How to make a function for autoset -

i'm not sure if possible or not looking way making auto "set" mysql results. function test(){ $pdatabase = database::getinstance(); $site = new template("sites.tpl"); $query = 'select * sites'; $result = $pdatabase->query($query) or die('query failed: ' . mysql_error()); while ($row = mysql_fetch_array($result)) { $site->set("id",$row['id']); $site->set("category",$row['category']); $site->set("name",$row['name']); $site->set("html",$row['html']); $site->set("css",$row['css']); $site->set("js",$row['js']); $site->set("php",$row['php']); $site->set("details",$row['details']); $site->set("link",$row['link']);

c# - How to display graph in another windows forms Form -

i'm working on windows forms applications, , far seems pretty simple. have form takes user input , displays in graph in current form. i want modify application main form takes input, , after "go" button pressed, taken data graphed, time in new form should open up. if user input new info main form, press "go" yet form should pop graph newly inputed data, , on. multiple forms different graphs can open @ once. i'm not sure how modify application achieve this. created new form class , added graph control , other controls , design want these new graph forms have, when i'm trying plot data original main form, i'm not sure how can access new graph form's graph control values... set modifiers public, can't seem work. is there way more plot data 1 form new object of graph form created? create new form graphing form. add properties form represent data. can pass data constructor of form. example, if had graph title , list of intege

vba - Open field in protected, shared Excel workbook -

i have shared, protected workbook has button bring search form. there 2 fields on form, txtyear , cbxregion, need enabled. whenever try open fields, works until exit excel. i have tried unprotecting workbook, unsharing it, , commenting out reference in vba reprotecting form. , still, edited vba reverts original. this section of code referring form need enabled. assistance appreciated. i'm using excel 2010. private sub userform_initialize() dim strdb string dim rs adodb.recordset dim cn adodb.connection dim row integer dim accessversionid string cbxregion.value = worksheets("parameters").cells(5, 14) me.txtyear = worksheets("parameters").cells(4, 7) me.chkboth = worksheets("parameters").cells(9, 2) me.chkconsultant = worksheets("parameters").cells(7, 2) me.chkinhouse = worksheets("parameters").cells(8, 2) 'set region values 'open connection 'select case syscmd(acsyscmdaccessver) 'case 11: accessversionid =

mysql - The right syntax for handling an UPDATE trigger and logging what happened per column? -

the users table: create table `users` ( `id` int(8) unsigned not null auto_increment, `email` varchar(45) default null, `username` varchar(16) default null, `salt` varchar(16) default null, `password` varchar(128) default null, `lastlogin` timestamp not null default '0000-00-00 00:00:00', `joined` timestamp not null default current_timestamp, `loggedin` tinyint(1) unsigned not null default '0', `sessionkey` varchar(60) default null, `verifycode` varchar(16) default null, `verified` tinyint(1) unsigned not null default '0', `banned` tinyint(1) unsigned not null default '0', `locked` tinyint(1) unsigned not null default '0', `ip_address` varchar(45) default null, `failedattempts` tinyint(1) unsigned not null default '0', `unlocktime` timestamp not null default '0000-00-00 00:00:00', primary key (`id`) ) engine=innodb auto_increment=8 default charset=latin1; the user_records table: create t

jquery - Cant make an ajax request to my restful server -

the request not being sent. when user clicks button should send request server , return json object. working when manually type in url in browser. $(document).ready(function() { $("#get-all-btn").click(function() { $.ajax({ url: "http://localhost:8080/safirestaurant/rest-services/reserve/get-all", data: {} datatype: "json", success: function(data, textstatus) { window.location.href = "owner-dashboard.html"; }, }); }); });

c# - Testing Conditional Logic based on a Date -

i have c# mvc ef6 code first solution. there project repository, services, model , web. requirement screen lists out cases in system. case has bool property called attention read has business logic in return true if responsedue property > datetime.now. for testing purposes, client wants able fake date today if responsedue property 3 weeks future able screen 3 weeks , make sure cases listed marked attention when date comes. i not sure how accommodate testing requirement without hurting design or performance. thinking of having comparedate property on case class default datetime.now set different date if needed wasn't sure how pass date in service layer , repository layer cases set comparedate got passed public virtual ienumerable getall() method. what defining virtual method or property can override in test. here example of this. not same property, still demonstration of general concept. http://unit-testing.net/currentarticle/how-to-remove-data-dependencies-in-

python - Disable all the options except the default - ChoiceField Django Forms -

so here trying do: i have way able make of fields readonly depending on user. so far it's easy here comes problem, need make select input read , well...they don't work read only. thing user still able play though new value not submitted. want select field disabled if that, value not sent via post , there problem form valid method. so after reading around, understand way disable fields except 1 selected default? how possible here have far: def __init__(self, *args, **kwargs): self.user = kwargs.pop('user') super(teamform, self).__init__(*args, **kwargs) instance = getattr(self, 'instance', none) if instance , instance.pk none: self.fields['division'].initial = 1 user_role = self.user.memberaccount.get_role() if user_role != 'admin': and here whhere want disable choices.... thanks lot help, ara i see 2 possible choices here: create custom widget show disabled select alongside hidden

Is this safe enough for user login and verification? (PHP, MySQL, Sessions) -

just want make sure have not missed obvious. need guys expertise on this. user data in database: - password stored crypt() salted salt string stored in user table. sessions: - when user logs on correctly create new row in sessions table unique sha256 hash session id. store user_id there see session exists user. - create cookie store session id in. - session removed when user logs out accessing logout function. - session automatically deleted on defined expiration time (e.g. 7 days) authentication: - check if client has cookie session id in it. if cookie session id matches session id in sessions table, user authenticated. what guys think? need else it? edit: added method generate password: public function generate_salt($password) { $cost = $this->config['user__password_encrypt_cost']; $salt = strtr(base64_encode(mcrypt_create_iv(16, mcrypt_dev_urandom)), '+', '.'); // prefix information hash php knows how verify later. //

mysql - get method doesnt work on php rest web service -

excuse me,i try make restful web service request method post , get, success getmethod view data on mysql, when use post method search data or delete data post method doesnt work. dont know why... chek out private function users(){ // cross validation if request method else return "not acceptable" status if($this->get_request_method() != "get") { $this->response('',406); } $sql = mysql_query("select user_id, user_fullname, user_email users user_status = 1", $this->db); if(mysql_num_rows($sql) > 0) { $result = array(); while($rlt = mysql_fetch_array($sql,mysql_assoc)){ $result[] = $rlt; } // if success everythig send header "ok" , return list of users in json format $this->response($this->json($result), 200); } $this->response('',204); // if no records "no content" status } then delete method private fu

php - Display current import file (html table form) from database into cakephp -

cakephp version 2.5.1, import file (csv format), database (mssql) i have imported csv file , saved database, after save want display each of 'current' import data using html table in cakephp. problem don't have idea code find current batch upload each batch start point l01-0-00-00-000 until end l01-0-00-00-999.the l01 on each string change l02, l03 , on. i try use function in mycontroller, show table line=01 my controller: function index () { $this->set('uploads', $this->upload->getcolumntypes('all', array('conditions' => array('ras_off_upload.ras_code' => ' l01-0-00-00-000' && ' l01-0-00-00-999' )))); } thank of suggestion. output table in database: ras_off_upload table no ras_code value remark sf create_by cln lot prod time date 1 l01-0-00-00-000 0 test h d123 cln12345 sltc123m ln2cpw 7:10 25jun 2 l01-1-01-01-111 68 test l d123

gruntjs - Strategy to use grunt-processhtml in development -

how should 1 use grunt-processhtml in development environment? for example, in index.html , i'll load partials angular when built: <!-- build:include:dist views/template-main.html --> <script type="text/ng-template" id="views/template-main.html"> --> </script> <!-- /build --> but want happen in built environment, not environment development environment ( app/ ) that's served grunt serve ? or, more common example, <!-- @if node_env='production' --> <script src=" production script "></script> <!-- @endif --> <!-- @if node_env='dev' --> <script src=" sandbox script "></script> <!-- @endif --> how sandbox script served in development environment ( app/ ) served grunt serve should performing grunt build every time , instead of grunt / node serving contents of app/ , somehow change serve development build (i.e. dist/ ) or should wr

cgpathref - iOS: I can't get Core Text to use word wrapping. Where am I going wrong? -

Image
i've attributed string multiple words. i'm trying draw along cgpathref using core text on ios7. however, when set ctlinebreakmode kctlinebreakbywordwrapping, text not wrap on words, on characters. instance, red, green, blue , purple pie slices have enough room display string using word wrapping, yet core text insists on wrapping on characters in cases. doing wrong? uifont *font = [uifont boldsystemfontofsize:10]; cgcontextsetlinewidth(context, 1.0); cgcontextsetstrokecolorwithcolor(context, [uicolor clearcolor].cgcolor); cgmutablepathref pathsmaller = cgpathcreatemutable(); cgcontextsetfillcolorwithcolor(context, [uicolor clearcolor].cgcolor); cgpathmovetopoint(pathsmaller, null, self.center.x, self.center.y); cgpathaddarc(pathsmaller, null, self.center.x, self.center.y, radius - 5, (beginangle - 90 - 1) * m_pi / 180, (endangle - 90 - 1) * m_pi / 180, no); cgpathclosesubpath(pathsmaller); cgcontextaddpath(context, pathsmaller); cgcontextfillpath(context); ctline

Chef supporting cloud platforms -

i'm trying implement deployment automation using chef. far have implemented using amazon ec2 , internap cloud platforms. know chef supports few cloud platforms. other chef there library can used create cloud instances in variety of different platforms? deployment automation anyway using chef, problem create instances in different platforms. problem there no generic way launch vms on clouds. each has own set of options , settings. 1 thing industry starting standardize around both amazon , openstack. the chef knife command has number of helper plugins launching servers on 3rd party clouds. these convenient use, may not realise these convenient wrappers around knife bootstrap command. can pre-provision servers , add them chef server second step. 1 option use open source abstraction layer like: jclouds fog the latter implemented in ruby , used write many of knife plugins clouds amazon, rackspace, etc. finally, more complex superior solution use providers

c++ - Incompatible Pointer type while making binary search tree -

here code. trying insert in binary search tree , address pointers when getting bigger data node going left , vice versa getting error: c:\users\huf\documents\tree.c|26|error: request member `right' in not structure or union| #include <stdio.h> struct node { struct node*left; int data; struct node *right; }; void maketree(struct node **root1, int data1) { if((*root1) == null) { (*root1) = (struct node *)malloc(sizeof(struct node)); (*root1)->data = data1; (*root1)->left = null; (*root1)->right = null; //printf("%d %d",(*root1)->data,data1); } else if(data1 > ((*root1)->data)) { printf("%d ", (*root1)->data); maketree((*root1)->right,data1); } else if(data1 < (*root1)->data) { maketree((*root1)->left,data1); printf("%d ", (*root1)->data); } } int main() { struct node * root = nul

SharePoint 2013 - Get SPListItem versions via REST -

i have sharepoint 2013 list versioning enabled. need to splistitem versions list via rest. can splistitem request: http://spbreportportal/projects/_api/lists/getbytitle('projects')/items(1) can't find in documentation , in response how retrieve versions of item. possible? it not seem possible versions list item via rest/csom apis, there alternative options using versions.aspx application page the idea perform request versions page: http://<server>/<site>/_layouts/versions.aspx?list={litsid}&id=<itemid> function getitemversions(url,listid,itemid,success) { var versionsurl = url + '/_layouts/versions.aspx?list=' + listid + '&id=' + itemid; $.get( versionsurl, function( data ) { var versionentries = parseversionlist(data); success(versionentries); }); } function parseversionlist(data){ var entries = {}; var versionlist = $(data).find('table.ms-settingsframe'); versionli

datetime - How do I get midnight of current day in a specified timezone in PHP? -

i have server in new york, , "client" in california expects server figure out midnight of current day in california, not same new york's 3 hours out of day. i have been able calculate midnight current day seen new york, need able calculate midnight of current day california (or other arbitrary timezone) i have access timezone's offset utc. $tzoffset = "-700"; // timezone offset utc (in case, pdt) the (semi-working) method i'm using right is strtotime("00:00:00 " . $tzoffset); on jun 25 @ 10:00 pm pdt, method returning jun 26 @ 12:00 pdt midnight, when should returning jun 25 12:00 pdt. // create time string $date_time = new datetime('midnight', new datetimezone('america/los_angeles')); // string representation of time in america/los_angeles echo $date_time->format('y-m-d h:i:s') . php_eol; $date_time->settimezone(new datetimezone('america/new_york')); // string representation of sam

android - How to get friendlist from facebook -

i trying friend list facebook not able friend list. tried out different code null in response. if run sample scrumptious app don't friend list. suggest me use "me/taggable_friends" still not getting friend list. so want know whether possible friend list facebook. if yes please show me way. public class mainactivity extends activity { private final static string tag = "mainactivity"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); session.openactivesession(this, true, new session.statuscallback(){ @override public void call(session session, sessionstate state, exception exception) { requestmyappfacebookfriends(session); } }); } private request createrequest(session session) { request request = request.newgraphpath

Hadoop Name node recovery in CDH3 cluster -

i using cdh3 cloudera pseudo distributed mode cluster.it working fine before. not able hadoop commands,hive queries,pig scripts. looks namenode gets corrupted. i tried sudo jps , found namenode daemon not running. it shows datanode jps runjar hmaster secondarynamenode what root cause here? how recover name node?

c# - Best practice to setting default value for GridViewComboBoxColumn (autocomplete) -

hi i'm working on gridviewcomboboxcolumn (which used autocomplete column). i'm wondering if there best practice way set default value there (so new entries set default value)? when adding new row, radgridview throw defaultvaluesneeded event in order allow specify default values cells in new row. place can set default value combo column well. here example: void radgridview1_defaultvaluesneeded(object sender, gridviewroweventargs e) { e.row.cells["combocolumn"].value = 5; } more information can found in telerik ui winforms documentation .

Reason behind speed of fread in data.table package in R -

i amazed speed of fread function in data.table on large data files how manages read fast? basic implementation differences between fread , read.csv ? i assume comparing read.csv known advice applied such setting colclasses , nrows etc. read.csv(filename) without other arguments slow because first reads memory if character , attempts coerce integer or numeric second step. so, comparing fread read.csv(filename, colclasses=, nrows=, etc) ... they both written in c it's not that. there isn't 1 reason in particular, essentially, fread memory maps file memory , iterates through file using pointers. whereas read.csv reads file buffer via connection. if run fread verbose=true tell how works , report time spent in each of steps. example, notice skips straight middle , end of file make better guess of column types (although in case top 5 enough). > fread("test.csv",verbose=true) input contains no \n. taking filename open file opened, fil

ms access - Report to excel Date format Conversion -

i have report uses single query record source generate report. exporting report excel following code docmd.outputto objecttype:=acoutputreport, objectname:=strreport, outputformat:=acformatxls, outputfile:=strpath & strtempfile, autostart:=false all data in report correct except date, date format displayed genereal number (not sure format) any appricaited. thanks. excel displaying date in way excel 'sees it', rather in user friendly date format. in excel, every date has value number. allows excel perform calculations/do things dates (example - checking days between 2 dates). if reformat excel doc (right click on random date , click format , change date) you'll find have correct date exported. probably haven't answered question, if you're doing data dump may not need export formatting (because can show date in date format on report).

gawk - AWK - how to add the first line of the file? -

this command appends lines end of file for in $(ls); awk 'begin{print "last_line"}' >> "$i"; done how add lines beginning of file? tried so for in $(ls); awk 'nr==1{print "first_line" }'1 "$i" > "$i"; done use sed instead [rdarji@indlin091 experiments]$ cat file2 line number: 2 line number: 3 line number: 4 line number: 5 [rdarji@indlin091 experiments]$ sed -i '1i\ > line number: 1' file2 [rdarji@indlin091 experiments]$ cat file2 line number: 1 line number: 2 line number: 3 line number: 4 line number: 5

javascript - Auto-scroll to a div when clicking on another div -

Image
when click on 1 of smaller div s on left (inside of div class "smallitems" , want div on right (with class "items" ) auto-scroll appropriate larger div . html: <div class="smallitems"> <div class="col">1</div> <div class="col"> 2 </div> <div class="col"> 3</div> <div class="col">4</div> <div class="col"> 5 </div> <div class="col">6 </div> <div class="col"> 7</div> <div class="col">8</div> </div> <div class="items"> <div class="item">1</div> <div class="item">2</div> <div class="item">3</div> <div class="item">4</div> <div class="item">5</div> <div class="item&qu

Qt Creator - Searching files with Locator including folder -

one quick question qtcreator : know possible use locator open files using "ctrl-k" shortcut. however, possible search files including locations? for example, let's want locate file named "main.cpp" in folder named "myfolder" , have lots of other main.cpp files. what should type locator in order open ? just type myfolder/main.cpp in locator

php - Validate not checking username & password CI -

i working on own form validation method codeigniter. trying not use there methods. problem: have users library logging me on ok. validate not validating password , username database. and should throw $error i use own way if possible. controller <?php if ( ! defined('basepath')) exit('no direct script access allowed'); class login extends ci_controller { private $error = array(); public function __construct(){ parent::__construct(); $this->load->library('users'); $this->load->library('form_validation'); $this->lang->load('common/login', 'english'); } public function index() { if(($this->input->server('request_method') == 'post') && $this->validate()) { redirect('dashboard'); } if (array_key_exists('warning', $this->error)) {

.net - Error Help: There is already an open DataReader associated with this Command which must be closed first. -

i'm having error in part of code , i'm still unable figure out solution it error stats: executereader requires open , available connection. connection's current state open. with source code in: line 144: .commandtype = commandtype.text line 145: .connection = cn line 146: dr = .executereader line 147: end line 148: the code is: public function getdbfield(byval query string, byval field string) string 'abriendo la conexion la base de datos sqlconnect() dim cmd new sqlcommand dim result string = "" dim dr sqldatareader dr = nothing 'ejecutando el lector de try cmd .commandtext = query .commandtype = commandtype.text .connection = cn dr = .executereader end catch ex sqlexception showalertmessage(ex.message) getdbfield = nothing exit

jquery - Iterating JSON list results in a "Error: Syntax error, unrecognized expression" -

i have ajax call, calls controller. controller returns following json: {"officeproducts":"[{\"id\":96,\"myproperty\":null,\"enabled\":true,\"envelope\":{\"id\":1,\"quality\":\"god\",\"papersize\":\"a4\",\"type\":\"window\"}},{\"id\":169,\"myproperty\":null,\"enabled\":true,\"envelope\":{\"id\":1,\"quality\":\"god\",\"papersize\":\"a4\",\"type\":\"window\"}},{\"id\":174,\"myproperty\":null,\"enabled\":true,\"envelope\":{\"id\":1,\"quality\":\"god\",\"papersize\":\"a4\",\"type\":\"window\"}},{\"id\":175,\"myproperty\":null,\"enabled\":true,\"envelope\":{\"id\":1,\"quality\":\"god

Calling testimonial module in magento using code -

i trying show testimonial on home page using php code in magento i tried code below getcollection or without getcollection function $collection = mage::getmodel('turnkeye/testimonial'); may calling correct model ?? module init code should turnkeye_testimonial/testimonial instead of turnkeye/testimonial if want field individual item can primary key of testimonial table . $collection $model = mage::getmodel('turnkeye_testimonial/testimonial')>load(id); if want fetch multiple items need resource collection mage::getresourcemodel('turnkeye_testimonial/testimonial')->addfieldtoselect('*'); or $collection = mage::getmodel('turnkeye_testimonial/testimonial')->getcollection(); for random collection $collection=mage::getmodel('turnkeye_testimonial/testimonial')->getcollection(); $collection->getselect()->order('rand()'); some reference http://www.amitbera.com/create-an-magento-ex

sublimetext2 - Edit the key map for goto definition -

according question , added : [ { "button": "button1", "count": 1, "modifiers": ["ctrl"], "press_command": "drag_select", "command": "goto_definition" } ] to file named default (windows).sublime-mousemap in %appdata%\sublime text 3\packages\user .and works fine. issue here mutiselection feature of sublime text not work, thought edit in such maintain multiselection (ctrl + alt + click) or (ctrl + shift + click) : [ { "button": "button1", "count": 1, "modifiers": ["ctrl + alt"], "press_command": "drag_select", "command": "goto_definition" } ] but doesn't seem work. great. thanks. try setting following: [ { "button": "button1", "count"

javascript - jEasyUI, Toolbar in tab -

i add toolbar tab, cannot find regarding in documentation. understand tab panel. possible access , add toolbar? my goal have toolbar in each tab example submit button submits form in tab. i using following code add tabs: function addtab(title, url){ if ($('#main-tabs').tabs('exists', title)){ $('#main-tabs').tabs('select', title); } else { var content = '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>'; $('#main-tabs').tabs('add',{ title:title, content:content, closable:true }); } } thanks in advance! michael jeasyui has toolbar function within tabs. it's enough purpose i'll go now. $('#tt').tabs({ tools:[{ iconcls:'icon-add', handler:function(){ alert('add') } },

sql - Inner join with mysql not works -

hey guys new mysql development , trying inner join both tables ..my code select customers.name, oop.id customers(select name,id orders) oop inner join oop on customers.name=oop.id order customers.name; when tried code shows me error know can done other method have seen method on website tried..am doing error in code. hope guys can me out ..any appreciated ..thanx you writing wrong syntax. somthing this:- select customers.name, oop.id customers inner join (select name,id orders) oop on customers.name=oop.id order customers.name;

cordova - EPub File Read on Phonegap? -

i need know read epub file content book format. have 1 epub file i.e "content.epub". content.epub contains 3 pages text. how can read epub file using phonegap.i new phonegap.can please suggest me this? there couple places look: this post explains of internals of epub format: reading epub format . of information specific objective-c (so won't usable you), @ least can sense of epub format looks like. depending on you're getting .epub files from, you'll either need download them or use cordova-plugin-file read them local device. cordova-plugin-file has poor documentation, there few other resources out there if need more help: raymond camden has few examples on blog one: http://www.raymondcamden.com/2014/07/01/cordova-sample-check-for-a-file-and-download-if-it-isnt-there . it's worth looking @ he's done. for it's worth, put code on show how browse through device , collect available files: how documents in android directory phonegap

casting - Java Type Cast, Object Type and overloading Issue -

please have on following class, need check if there valid value in variable. works fine if there proper value in variable instead of null , when comes null behaviour not expect (although might make sense if integer = null; when checked a instanceof integer , can 1 guide me how achieve correct result following class? package com.mazhar.hassan; public class valuechecker { public static boolean empty(integer value) { system.out.println("integer"); return (value != null && value.intvalue() > 0); } public static boolean empty(long value) { system.out.println("long"); return (value != null && value.longvalue() > 0); } public static boolean empty(string value) { system.out.println("string"); return (value != null && value.length() > 0); } public static boolean empty(object value) { system.out.println("object"); return (v

c - Compilation error: /usr/bin/ld: cannot find -lclntsh -

while trying compile c program using make file, facing following linking error described below. i know kind of issues discussed in many other posts, tried solutions suggested in them did not work. /usr/bin/ld: cannot find -lclntsh libclntsh.so , libclntsh.so.10.1 present in oracle path /u01/app/oracle/product/10.2.0/lib , being given -l option in make file. still facing issue:- linking yieldrpt ... cc -v -g -d_hpux_source -dpareto -wl,-aarchive -l/u01/app/oracle/product/10.2.0/lib/ yieldrpt.o -lclntsh `cat /u01/app/oracle/product/10.2.0/lib/ldflags` -lmalloc -ldl -lm \ -lmalloc -o yieldrpt using built-in specs. target: i386-redhat-linux configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada

Probleme with JAVA_HOME in maven for android using Eclipse -

Image
i new in maven utilisation, want use generate apk of android appication. when launching "compile" , others recieve error message : [error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project android.app: compilation failure [error] unable locate javac compiler in: [error] c:\program files\java\jre7\..\lib\tools.jar [error] please ensure using jdk 1.4 or above , [error] not jre (the com.sun.tools.javac.main class required). [error] in cases can change location of java [error] installation setting java_home environment variable. so set java_home jdk : but still have same problem after restart computer. do have idea why ? edit---- i don't know if change using eclipse launch maven build i'm supposing use eclipse, or not? eclipse: click on debug->debug configurations.... click on maven build, select 1 u use. have tab called jre. click on it. there place can choice. normally maven tak

Change the background color of a button with Delphi XE5 and FireMonkey -

i creating style button component firemonkey, can put rectangle in background when run application background prevents me click button. doing wrong? seems rectangle in front of button preventing click. thank you. i think problem need activate hittest on tbutton component properties. solve problem of click event on tbutton component.

debug C++ through Python -

i calling executable through python subprocess , able debug c++ code behind exe. c++ code , python code open in 2 visual studio instances. have tried attaching c++ python visual studio break points hit when run python subprocess code, doesn't seem work. ideas how this? can modify python script run c++ code in way? devenv /debugexe 'program name' 'program arguments' from https://stackoverflow.com/a/417758/1190965

picasa - How to read RSS feed http://picasaweb.google.com/ using c# net 2? -

how read feed http://picasaweb.google.com/data/feed/base/user/ ... using c# net 2 ? can't use api done? https://developers.google.com/picasa-web/?csw=1

How to create generic protocols in Swift? -

i'd create protocol method takes generic input , returns generic value. this i've tried far, produces syntax error. use of undeclared identifier t. what doing wrong? protocol apimapperprotocol { func mapfromsource(t) -> u } class usermapper: nsobject, apimapperprotocol { func mapfromsource(data: nsdictionary) -> usermodel { var user = usermodel() usermodel var accountsdata:nsarray = data["accounts"] nsarray return user } } it's little different protocols. @ "associated types" in apple's documentation . this how use in example protocol apimapperprotocol { associatedtype t associatedtype u func mapfromsource(t) -> u } class usermapper: nsobject, apimapperprotocol { typealias t = nsdictionary typealias u = usermodel func mapfromsource(data:nsdictionary) -> usermodel { var user = usermodel() var accountsdata:nsarray = data["

c# - Search and delete ten old files in specific folder based on file name? -

i'm administrator noname!! company has router. router creates log files (with @ least 500 mb of size each log) , sends them our ftp server. the log file name this: noname-[2014-4-4]-03-1.log . can see date of create of log file in ftp server. so write program delete ten old log files specific folder in ftp server have lsd-rmz name. and program must run in ftp server. how can search , find , delete ten old file lsd-rmz folder in c#? directory.getfiles(path) .where(x=>regex.ismatch(x,@"\w+\[\d+-\d+-\d+\]-\d+-\d+\.log")) .orderby(x=>datetime.parse(regex.match(x,@"(?<=\[).*?(?=\])").value)) .take(10) .tolist() .foreach(x=>file.delete(x));

javascript - How to trigger the Dropzone.js' default file upload input? -

i'd know how trigger dropzone.js' default file upload input? it's not simple this: window.dropcloud = = new dropzone("#dropcloud", {...}); $(window.dropcloud.clickableelements[0]).trigger("click"); now don't have ideas. anyway whole #dropcloud container hidden, if matters. simple. in version 4.0 can do: new dropzone(".element", { clickable: '.mytrigger' }); new dropzone(".element", { clickable: ['.mytrigger', '.myothertrigger'] });

java - Unchecked casts and unnecessary suppressed warnings with lambdas -

while working lambdas , generics, encountered special case of unsafe cast warnings. during reproducing , making sscce, found related fact lambda "inside" return statement. the question is: why warning in warningunnecessarysuppresswarnings method? . when removing @suppresswarnings("unchecked") , get: type safety: unchecked cast list list as shown in warningunsafecast method. because of this, annotation not unnecessary new warning says. i using eclipse kepler sp2 java ee developers, build id: 20140224-0627 also using the recommended update-site java 8 support in eclipse kepler public static void main(string[] args) { system.out.println(warningunnecessarysuppresswarnings()); system.out.println(warningunsafecast()); system.out.println(withoutwarning()); } private static integer perform(function<list<?>, integer> func) { return func.apply(arrays.aslist("a", "b", "c")); } private static

javascript - Automatic percentage calculator -

i working on code calculate percentage need calculate percentage automatically without submit button, want output calculated percentage without need of user hitting submit button. here code input: <input type="text" id="input"/><br /> percent: <input type="text" id="percent" value="50"/>%<br /> output: <input type="text" id="output"/> function calc() { var = document.getelementbyid("input").value; var p = document.getelementbyid("percent").value; var o = (i/100) * p; document.getelementbyid("output").value = o; } on each of 2 inputs, add onchange="calc();" (updates when user tabs next field) or onkeyup="calc();" (updates whenever user types something).

C# FolderBrowserDialog: Getting only the selected folder's name -

as title states need last folder in string open folder dialog creates when user selects folder. instance: string folder; folderbrowserdialog fbd = new folderbrowserdialog(); fbd.rootfolder = system.environment.specialfolder.mycomputer; if (fbd.showdialog() == dialogresult.ok) { folder = fbd.selectedpath; } i want trim before last "\" leave me selected folder's name. thank help you can use path.getfilename this: folder = path.getfilename(fbd.selectedpath); this might seem counter-intuitive, path.getfilename() returns text right of final path separator.

Php mysql update with a new unique id -

i update id of mysql row next free id available easy explain can't figure out. thank you edit: the point need have brand new id existing row still want keep inside row (lot of data). because third party system deals product payment accept order id once. seems logical me keep data if user cancels transaction , update id new attempt older id useless , tedious move data brand new record. can done non-auto-incremented id believe possible auto-incremented one. issue sure new id available 1 and, if possible, next available one. if id auto increment can insert new record , delete old one. doesnt seem logical though. why need update id?