Posts

Showing posts from July, 2014

Do different C compilers have different argument passing rules? -

this question has answer here: why these constructs (using ++) undefined behavior? 12 answers #‎include‬<stdio.h> int main(void) { int a=10; printf("%d, %d, %d\n", a, a++, ++a); return 0; } this showing 12 11 12 in 32 bit gcc compiler , 12 11 11 in 16 bit turbo c compiler. differecnt c compilers have different argument passing rules? please read comp.lang.c faq , expressions. q: under compiler, code int = 7; printf("%d\n", i++ * i++); prints 49. regardless of order of evaluation, shouldn't print 56?

php - Data not being entered into database at all? -

i have strange issue project working on. code runs, without error, values aren't entered database insert statement. the code follows: pipe.php (the file calling query): #!/usr/bin/php <?php require_once 'includes/init.php'; init::initialise(); $email = file_get_contents('php://stdin'); $db = new db($config['db']); $mail = new mail($email); $emailbody = $mail->getplainbody(); $emailsubject = $mail->getsubject(); $from = $mail->getheader("from"); $to = $mail->getto(); if ($id = util::getid($emailsubject)) { $ticket = $db->query_assoc("select * tickets ticket_id=$id"); if (in_array($from, $config['staff_emails'])) { //staff reply $tickets = $ticket['content'].="<ticketsep>$emailbody"; $db->query("update tickets set content=$tickets ticket_id=$id"); mail($ticket['email'], "[$id] member of staff replied t

Image will not save with Paperclip and Rails 4 -

i'm trying use paperclip uploading image has many , belongs relationship 'pictures' i'm imagemagick etc, correctly installed, because i've more image uploaders in project works, difference 1 has has many relation. i'm not getting 'saving attachment' in console. idea ignored strong parameters. in topicscontroller: params.require(:topic).permit(:id, :title, :content, :active, pictures_attributes: [:image, :id, :_destroy] ) in topic model: has_many :pictures, dependent: :destroy accepts_nested_attributes_for :pictures, allow_destroy: true validates :title, :content, presence: true in picture model: belongs_to :topic has_attached_file :image, :styles => { :medium => "400x400#", :thumb => "200x200#", :small => "50x50#" }, :default_url => actioncontroller::base.helpers.asset_path('missing.png') i know there many other topics this, rails 3 , different in way of setting 'attr_accessi

echo mysql column based on other column name with php -

first of apologize title. don't know correct names of mysql tables are. have mysql table looks following. 'id' | 'username' | 'password' | 'product' | 'price' '1' | 'ben' | 'hashedpw' | 'desktop' | '120' '2' | 'steve' | 'hashedpw' | 'laptop' | '300' lets database named hardware , user database called owner password called password , table called tech how able use php echo product prices. $sql = "select * users"; $query = mysql_query( $sql ); $row['prodyct']; what i'm having trouble figuring out how result show price of desktop only. can't use id since id's missing @ different times. select price tech product = 'desktop';

jquery - <select> option change - URL redirect -

i using neat plugin customising <select> lists. http://exodecreations.com/jquery/jqdropdown.html i trying come code when user selects each option, redirected page. code follows: <form action="#"> <select id="elidp" > <option value='' disabled selected>choose location...</option> <option value='http://www.google.com/'>new york</option> <option value='http://www.google.com/'>la</option> </select> </form> jquery: jquery(function() { jquery('#elidp').jqdropdown({ optionchanged: function(){ jquery('#elidp').on('change', function () {var url = $(this).val(); if (url) {window.location = url;}return false;});}, direction: 'up', defaultstyle: false, containername: 'thecontainer', togglebtnname: 'awesometoggleclass', optionlistname: 'thislistisrocking', eff

cordova - Jquery mobile + phonegap only black theme -

i've build test app phonegap build using jquery mobile example file. in browser style white (see link: http://view.jquerymobile.com/1.3.2/dist/demos/examples/ ) in app see header , buttons in black version. have idea solve this? tnx did try changing data-theme='a' . data-theme controls buttons , background , jquery mobile has created standard set of swatches. http://jquerymobile.com/demos/1.1.1/docs/api/themes.html - check out more information on changeing colors or themeing.

iphone - How can I push to another view after user finishes taking photo using UIImagePicker -

Image
i trying allow user take photo using uiimagepickercontroller , after finishing take him uitableview, passing chosen image, can add info photo in text fields such description. right code in didfinishpickingmediawithinfo: if (image) { photoinfoviewcontroller* photo_info_controller = [[photoinfoviewcontroller alloc] init]; photo_info_controller.image = image; [self dismissviewcontrolleranimated:yes completion:^{ [self.parentviewcontroller presentviewcontroller:photo_info_controller animated:yes completion:nil]; }]; } this takes code next view static tableviewcontroller and in photoinfoview controller i see viewdidload gets called nslog see empty tableviewcontroller , no text fields... any 1 have advice?? try change photoinfoviewcontroller initialization. set storyboard id in storyboard file photoinfoviewcontroller change code. uistoryboard *storyboard = [uistoryboard storyboardwithname:<#name of storyboard#> bundle:[nsbundl

c# - Bounding box volume of an STL file -

i trying find bounding box volume of stl file using following code. of files working fine files gives strange result, means high x, y , z values. please me fix it. enter code here float length, breadth, height; float minx = 0, maxx = 0, miny=0, maxy=0, minz=0, maxz=0; public double signedvolumeoftriangle(float[] p1, float[] p2, float[] p3) { double v321 = p3[0] * p2[1] * p1[2]; double v231 = p2[0] * p3[1] * p1[2]; double v312 = p3[0] * p1[1] * p2[2]; double v132 = p1[0] * p3[1] * p2[2]; double v213 = p2[0] * p1[1] * p3[2]; double v123 = p1[0] * p2[1] * p3[2]; double vol = (1.0 / 6.0) * (-v321 + v231 + v312 - v132 - v213 + v123); if (math.min(math.min(p1[0], p2[0]), p3[0]) < minx) { minx = math.min(math.min(p1[0], p2[0]), p3[0]); } else if (math.max(math.max(p1[0], p2[0]), p3[0]) > maxx) { maxx = math.ma

how to get parent object property in javascript/jQuery -

i've been searching way parent object property in nested object had no luck. here nested object using: var obj = { name: 'my name', obj1: { age: 18, name: this.name } }; but gives , undefined error. is there way in javascript or jquery achieve it? you can : var obj = new obj(); function obj(){ var self = this; self.name = 'my name'; self.obj1 = { age: 18, name: self.name } };

How to use terminal commands to sign android app -

i have built system allows marketing department manage our in house applications. ubuntu server uses sdk , terminal commands executed php create/build or update application, far has worked our off play store (adult) applications. looking @ launching of our new apps meet stores requirements on store. when upload application store required signed private key, point me in right direction regards using sdk , terminal commands sign application. while following page has plenty of information: http://developer.android.com/tools/publishing/app-signing.html i wondering if else has done before, , can me code example instead of me banging head against wall 8 hours. thank :d on same page referenced in question there example command signing apk. sign application private key when have application package ready signed, can sign using jarsigner tool. make sure have jarsigner available on machine, described in basic setup. also, make sure keystore containing private key

java - why I should "final" sharing variable in multi-threading program -

this question has answer here: cannot refer non-final variable inside inner class defined in different method 20 answers my question why should use final decorate variable, list? used instance of anonymous inner class without final, won't compile. the code looks this: public class twothreadsonelistcurrmodi { public static void main(string[] args) { final list<string> list = collections.synchronizedlist(new arraylist<string>()); (int =0 ; i<20;i++) list.add(string.valueof(i)); thread t1 = new thread(new runnable(){ @override public void run() { synchronize(list) { system.out.println("size of list:" +list.size()); } } }); t1.start(); } } but if use normal class, fine. public class twothreadsonelistcurrmodi2 { public static void main(st

c++ - Getting error: missing template arguments before ‘(’ token -

i'm not sure what's wrong. i'm pretty new c++, don't see problems. i've read through bunch of other stack overflow pages, none of them seem address issue. this terminal joshs-macbook-pro:desktop josh$ g++ binarycompare.cpp binarycompare.cpp: in function ‘int main()’: binarycompare.cpp:9: error: missing template arguments before ‘(’ token here's code. #include <iostream> #include <string> using namespace std; bool isgreater(string a, string b); int main (){ if(greater("11", "00")) cout << "hello"<<endl; return 0; } bool isgreater(string a, string b){ if(a.length() > b.length() ) return false; if(a.length() < b.length() ) return true; for(int i= 0; < a.length(); i++){ if(a[i] != b[i]){ if(a[i] == '1') return false; return true; } } return false; } this example why using namespace std not idea

select - How do I say 'and/or' in jQuery? -

i have can't head around... been trying quite while already. i have snippet of jquery: $("#amp").on('change', function () { $("#cab").prop('disabled', $(this).val() == "combo models - 22w"); $("#cab option").prop("selected", true); }); i need duplicate exact bit of code 4 times need change 'combo models - 22w' 4 different things. i tried duplicating code 4 times , changing property didn't work. is there way of saying like: $("#cab").prop('disabled', $(this).val() == "combo models - 22w" or "combo models - 50w" or "combo models - 75w"); ...but snippet works? thanks! you store values in hash map. this: var map = {}; map["combo models - 22w"] = true; map["combo models - 50w"] = true; map["combo models - 75w"] = true; and on. then use: $("#cab").prop('disabled', false |

ruby - Setting instance variables on different objects of the same class -

let's have class called person , person has attribute called partner . when call partner= on 1 of person objects, want set @partner instance variable of both objects. here's example invalid syntax: class person attr_reader :partner def partner=(person) # reset old partner instance variable if exists partner.@partner = nil if partner # set partner attributes @partner = person person.@partner = self end end change attr_reader attr_accessor , add helper method: class person attr_accessor :partner def link_partners(person) @partner = person person.partner = self end end update visibility. based on suggestion frederick below. little more verbose, prevent partner being set directly: class person protected attr_writer :partner public attr_reader :partner def link_partners(person) @partner = person person.partner = self end end both implementations works this: p1, p2 = person.new, perso

ruby - How to repeatedly handle an exception until proper result? -

i have custom exception want raised , rescued many times performing method causes error. know result in exception free result. using begin/rescue/end seems when exception thrown , rescue block invoked, if exception thrown again program leaves begin/rescue/end block , error ends program. how can keep program running until proper result reached? also, incorrect on thinking of what's happening? here's want happen (but dry of code possible...this code illustrate , not i'd implement). ships.each |ship| begin orientation = rand(2) == 1 ? :vertical : :horizontal cell_coords = [rand(10), rand(10)] place_ship(ship, orientation, cell_coords) rescue overlaperror #if overlap error happens twice in row, leaves? orientation = rand(2) == 1 ? :vertical : :horizontal cell_coords = [rand(10), rand(10)] place_ship(ship, orientation, cell_coords) rescue overlaperror orientation = rand(2) == 1 ? :vertical : :horizontal cell_coords = [rand(1

Nested loops and python programming for sudoku puzzle -

what code can write nested loops print row, column , number each non-empty location in bd. bd = [ [ '1', '.', '.', '.', '2', '.', '.', '3', '7'], [ '.', '6', '.', '.', '.', '5', '1', '4', '.'], [ '.', '5', '.', '.', '.', '.', '.', '2', '9'], [ '.', '.', '.', '9', '.', '.', '4', '.', '.'], [ '.', '.', '4', '1', '.', '3', '7', '.', '.'], [ '.', '.', '1', '.', '.', '4', '.', '.', '.'], [ '4', '3', '.', '.', '.', '.', '.', '1', '.'], [ '

ember.js - DS.defaultStore.load(App.foo, payload) only works first time with DS.RESTAdapter -

update: this non-issue (see below) so wrote jsfiddle show bad behavior except fiddle works! , real code doesn't. difference using restadapter in real code data pulled server instead of fixtures . in jsfiddle: first click 'simulate 1st manual load' , click 2nd button see work (i.e. loading new or updated data store multiple times in row) http://jsfiddle.net/iceking1624/nzz42/4/ the issue i sending updated information on websockets ember app. set listener trigger function on correct controller , able update records first time. successive attempts not update store , wonder if has state of store? unsure of how handle if case. this code updates or adds records come on websockets: app.sessioncontroller = ember.objectcontroller.extend({ updatereceived: function(data) { console.log(data); ds.defaultstore.load(app.choice, data.choice); ds.defaultstore.load(app.question, data.question); } }); notice console.log(data) part. every sing

java - Android - streaming sensor data continuously? -

i have following code giving me sensor data: private void computeorientation() { if (sensormanager.getrotationmatrix(m_rotationmatrix, null, m_lastaccels, m_lastmagfields)) { sensormanager.getorientation(m_rotationmatrix, m_orientation); /* 1 radian = 57.2957795 degrees */ /* * [0] : yaw, rotation around z axis [1] : pitch, rotation around x * axis [2] : roll, rotation around y axis */ float yaw = m_orientation[0] * 57.2957795f; float pitch = m_orientation[1] * 57.2957795f; float roll = m_orientation[2] * 57.2957795f; /* append returns average of last 10 values */ m_lastyaw = m_filters[0].append(yaw); m_lastpitch = m_filters[1].append(pitch); m_lastroll = m_filters[2].append(roll); yawtext.settext("azi z: " + m_lastyaw); pitchtext.settext("pitch x: " + m_lastpitch);

Optimize php mySQL query with mulitple joins and Group_Concat -

i have multiple join sets happening on query. have multiple joins, because of way tables structured want. main joins, i've separated 3 sets commented below. if have 1 set, query time pretty fast. when have 2 sets active, query time around 2 minutes. if 3 sets active shown below, takes long. any on optimizing query appreciated. $query = "select `databases`.*, `databasedescriptors`.*, `databasecontents`.*, `databaseaccesslevels`.*, `providers`.*, group_concat(`descriptors`.descriptorname separator ', ') descriptornames, group_concat(`contents`.contentname separator ', ') contentnames, group_concat(`accesslevels`.accesslevelname separator ', ') accesslevelnames "; $query .= "from `databases` "; // set 1 $query .= "join `databasedescriptors` on `databasedescripto

cant initialize php facebook sdk -

i'm trying simple task. initialize facebook php sdk , return user id. i'm wondering if there problem require_once path have included access sdk, i'm not sure. echo message works, nothing else. have tried writing require_once path few different ways see if problem, nothing worked. <?php echo "hello world"; require_once(dirname(__file__).'/php-sdk/facebook.php'); $application_id = '396***8'; $application_secret = '134559c****eb4f2da'; $config = array(); $config['appid'] = $application_id; $config['secret'] = $application_secret; $facebook = new facebook(config); $uid = $facebook->getuser(); echo $uid; ?> assuming entire php code on page, working intended, getuser() should return 0 there no logic authorizes user. need login handling logic user either js sdk or getloginurl() function see example https://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php . also check en

android - Selecting a specific checkbox in a long listview checks multiple checkboxes -

i have listview checkbox. click on particular item, corresponding checkbox gets selected, selects checkboxes repeatedly after every 8-10 rows in listview. understand happens because in android, views screen visible stored memory optimization. have not been able overcome situation. pls suggest. public class fbfriendslistadaptor extends arrayadapter<fbfrienditem>{ private final context context; private static list<fbfrienditem> items; private sparsearray<fbfrienditem> checkeditems = new sparsearray<fbfrienditem>(); viewholder holder; public fbfriendslistadaptor(context context, list<fbfrienditem> items) { super(context, r.layout.fb_friend_list, items); this.items = items; this.context = context; } @override public fbfrienditem getitem(int position) { // todo auto-generated method stub return items.get(position); } public view getview(final int position, view

ruby on rails - Change the order of before hooks in rspec -

i have controller spec : describe "#create" before { post 'create', params } context "when artist valid" before { allow(artist).to receive(:save).and_return(true) } { expect(page).to redirect_to(root_path) } { expect(notifier).to have_received(:notify) } end end this simple spec doesn't work because describe's before block executed before context's before block. so, result of artist.save not stubed when create action called. it tried : describe "first describe" before { puts 2 } describe "second describe" before { puts 1 } "simple spec" expect(1).to eq 1 end end end i see "2" before "1". i'm not sure think working previous versions. i know, can : describe "#create" context "when artist valid" before { allow(artist).to receive(:save).and_return(true) } "redirect root path" post 'create

jquery - How to select first 'li' automatically after opening drop-down? -

Image
i have menu this. can view on website under products tab question 1: under product page see picture below. what want when hover on products page want first items active automatically. this show when click products page. question 2: in addition this, if hover on first item , move cursor right pane, first item's background shall still hover style ( blue ). presently, if move mouse right content pane, background becomes white. question 3: if click items in left list, content in right pane doesn't change automatically hover on other items in list. if don't click items works perfectly. problem when click items. i had written jquery code think missing something. $('.urun_tab').hover( function(){ if($(this).hasclass('hoverblock')) return; else $(this).find('a').tab('show'); }); $('.urun_tab').find('a').click( function(){ $(this).parent() .siblings().addclass('hov

runtime error - Behind the scenes of "Windows is searching for a solution ..."? -

so when program dies rather ungracefully, modern versions of windows put dialog reads: windows searching solution problem it clocks little while, doesn't find anything. well, i've never had tell me it's found solution. the question is, going on when dialog being shown? possible things can show "solutions"? there way application can tap it? obviously, if know enough go wrong, should handle in app, i'm left wondering does. anyone know? windows error reporting capturing stack trace of failed program , sending off microsoft. data collects stuffed enormous database vendors research; if program, can sign here . if vendor submits patch, windows notify you. you can tap it, either customizing info , triggering reports (soon be) fatal errors, , more.

c# - Operation is not valid due to the current state of the object in redis -

after using wrapper, large volume queue, got error: initially there no error when save, after several minutes, got error , discover dump.rdb maintain @ 1 kb size. seems not change after large volume save message operation not valid due current state of object at redisclass.getinstnace().store(msg) if (sqlqueue == null) sqlqueue = new concurrentqueue<bmsg>(); sqlqueue.trydequeue(out bloombermsg); if (bloombermsg != null) { redisclass.getinstnace().store(bloombermsg); redisclass.getinstnace().save(); } public class bloommsg { public message msg {get; set;} public string typeofmsg { get; set; } } foreach (message msg in eventobj) { logger.debug(msg.tostring()); if (sqlqueue == null) sqlqueue = new concurrentqueue<bloommsg>(); bloommsg b = new bloommsg(); b.msg = msg; b.type

Python: How to get an entry box within a message box? -

i realised hadn't asked user name @ start of game. tried code: label(root, text="what name?").grid(row=0, column=0) e1 = self.entry(root) e1.self.grid(row = 0, column=1) but not working. how message box pop in start of game saying "welcome math bubbles, name?" user types in name , presses ok. message box pop saying "hello _ , press start button begin". save users name in winner message box display name well there no messageboxes have entry. name suggests, messageboxes meant show messages, not receive input or act mini gui's. nevertheless, quite possible want. there many ways well. think best this: from tkinter import * import random tkinter.messagebox import showinfo class bubbleframe: ############################################## def __init__(self, root, name): self.name = name ############################################### root.title("math bubbles") self.bubbles = {}

does a javascript function only run a variable once per refresh?? (switch: case) -

i have script i'm writing runs function change picture when button hit. following script changes picture first time, next time same script run different variables doesn't seem take newest variable account. <div id="main_img"> <center> <button style="width:100;height:100" onclick="lastpic();"><---</button> <img id="img" src="12.jpg" height=70% width=70%> <button style="width:100;height:100" onclick="firstpic();">---></button> </div> <script> var james = document.getelementbyid("img").getattribute('src'); document.write(james); function firstpic() { switch (james) { case "12.jpg": document.getelementbyid("img").src = "13.jpg"; break; case "13.jpg": document.getelementbyid("img").src = "14.jpg"; break; default:

google maps - PHP different result when converting CID to LAT -

i have scripts converting cid lat , lac long. in localhost in production server (using same script) give me different result. result in localhost: cid = 55073 => lat = -6.254678 (true result) result in production server cid = 55073 => lat = 4288.712618 (incorrect result) here's script if(isset($lac) && isset ($cid)) { $data = "\x00\x0e" . "\x00\x00\x00\x00\x00\x00\x00\x00" . "\x00\x00" . "\x00\x00" . "\x00\x00" . "\x1b" . "\x00\x00\x00\x00" . "\x00\x00\x00\x00" . "\x00\x00\x00\x00" . "\x00\x00" . "\x00\x00\x00\x00" . "\x00\x00\x00\x00" . "\x00\x00\x00\x00" . "\x00\x00\x00\x00" . "\xff\xff\xff\xff" . "\x00\x00\x00\x00"; $is_umts_cell = ($cid > 65535);

data binding - Refresh datasource dynamically in kendo mvvm -

hi i've kendo grid country , state details. , i've toolbar add button. when click on add new button, i'm getting popup country , state dropdowns. want select country state. here want load states based on country selection. here sample code. not working. function loadstates(element) { // here want update below model statemodel.statesbycountry this. statemodel.loadstatesbycountry($(element).val(), function () { }); } <script id="popup_editor" type="text/x-kendo-template"> <div class="k-edit-label"> <label for="country">country</label> </div> <input name="cntryname" data-bind="value:cntryname" data-value-field="value" data-text-field="text" data-source= country

javascript - relative path to images in external js script -

i'm writing component in joomla , want use javascript. i got javascript part working in separat test html page, want include in joomla component. the problem relative file paths images. images stored in media folder of joomla: media/com_component/images i include external js-file command: $document->addscript(juri::root().'components/com_component/script.js'); in script need path image folder. don't want hard code absolute path in script. how can relative paths? do/can use joomla functions that? thank you i chose put file path information in css file (set image background of link). way js-script independent of image's file path.

javascript - Not rendering VU-meter Gauge chart using HighCharts in Durandal -

i trying add vu-meter gauge chart in durandal app. kept high chart js code in "viewattacthed". js code looks follows: define(['services/logger'], function (logger, highcharts) { //#region internal methods function activate() { logger.log('reports view activated', null, 'resources', true); return true; } //#endregion function viewattached(view) { $('#ufcgaugechart', view).highcharts({ chart: { type: 'gauge' }, title: null, pane: [{ startangle: -90, endangle: 90, center: ['50%', '67%'], size: 175 }], yaxis: [{ min: 0, max: 100000, minortickposition: 'inside', tickposition: 'inside', labels: { rotation: 'auto', distance: 20 }, plotbands: [{ from: 0,

cordova - Facebook plugin android phonegap -

i'm new phone gap please provide me code connect facebook through phone gap thanks.i don't know how use facebook plugin. check following github.hope helps https://github.com/davejohnson/phonegap-plugin-facebook-connect/

jquery - Firefox showing issue with video.duration in html5 -

i trying build custom video player. <video preload="metadata" id="videoplayer" style="width: 640px; height: 360px;"> </video> <script type="text/javascript"> var v = ""; var myvideo = ""; $(document).ready(function() { v = $("#videoplayer"); myvideo = v.get(0); $(".playlist").click(function() { v.attr("src","http://www.jplayer.org/video/webm/big_buck_bunny_trailer.webm"); myvideo.play(); }); myvideo.addeventlistener('loadedmetadata', function() { // in chrome working fine , shows duration 00-00-33 // in firox showing infinity. console.log(myvideo.duration); }); }); <script> in chrome video playing , shows duration 33.02 . in fireox showing infinity. not able implem

iphone - collision detection of two objects in different class -

i calling 2 different object 2 different node in rock.h @interface rock : ccnode { int screenwidth; int screenheight; float downwardspeed; } @property (nonatomic, retain) ccsprite *falling_rock; -(void) makeenemygolower; -(cgsize)contentsize_ofbugsprite; -(cgrect)boundingbox_forrock; end in rock .m -(cgrect)boundingbox_forrock { return falling_rock.boundingbox; } -(cgsize)contentsize_ofbugsprite { return falling_rock.contentsize; } -(void) runenemyanimationsequence:(cctime) delta { self.position = ccp(self.position.x, self.position.y - downwardspeed ); } similarly player class also. calling in main game class using ccnode position in nslog not coming correct.so unable check collision. please help, mistake making? i'm not sure if syntax correct since use cocos2d-x, believe issue both boundingboxes have in world space. can use converttoworldspace method position local space world space. should this: -(cgrect)boundingbox_forrock { cgpoin

need help to export table from sql server 2008 to text file -

i trying export table present in ms sql server 2008 text file on system. writing following command in sql server query window select * [adventureworks].[person].[addresstype] outfile 'c:/filename.csv' fields terminated ',' lines terminated '\n'; now whenever write command sql gives me error incorrect syntax near 'into' then tried interchanging , keywords follows select * outfile 'c:/filename.csv' fields terminated ',' lines terminated '\n' [adventureworks].[person].[addresstype] ; now gives me error incorrect syntax near 'c:/filename.csv' please me regarding this. not able remove these error , working sql there more many ways solve problem , in case here 2 solutions solution 1 right click on database name -> tasks -> export data choose table data source choose flat file destination destination choose file-name ( file name ) mark "column names in first data row" ( opitiona

c++ - Convert Address to long - variable results in value? -

can explain behaviour me pls? static short ndosomething(const char* pcmsg, ...) { va_list pvargument; long ltest; void* pvtest = null; va_start(pvargument, pcmsg); pvtest = va_arg(pvargument, void*); ltest = (long) pvtest; va_end(pvargument); return 0; } if call function in main this: int main(int argc, char* argv[]) { char actest1[20]; ndosomething("testmessage", 1234567l, actest1); return 0; } i thought address of pvtest in ltest, in fact contains 1234567 ... how possible? your code contains undefined behavior; standard requires type extracted using va_arg correspond type passed (modulo cv-qualifiers, perhaps): passed long , , read void* , compiler correct. in practice, compilers generate code no type checking. if on machine, long , void* have same size (and machine has linear addressing), end whatever passed long . if sizes of 2 different, machine little endian, , pass small enough value, might end same value wel

oracle - What does the "@" do in SQL*Plus -

i found line in sql code: @../../sql_scripts/create_tables.sql what do? know @@file.sql means file.sql run , @ used when want supply parameter values later, here have @ followed filename. know there similar question covers @ in queries. here @ not part of sql language. command sql interpreter oracle sql*plus. sql*plus has many single-character commands @ or / (which executes buffered sql), ; can puzzling when encounter them in .sql file. @ documented here in oracle 9i documentation. there see differences @@ . documentation oracle 11g release 2 , click next section @@ reference.

Bootstrap drop down menu in Joomla 3.1 -

i'm working bootstrap menu working dropdowns should in joomla 3.1. i'm there, not quite: js script use ( how make twitter bootstrap menu dropdown on hover rather click ) <script type="text/javascript"> (function($){ $(document).ready(function(){ $('.dropdown-toggle').dropdown(); // dropdown $('.parent').addclass('dropdown'); $('.parent > a').addclass('dropdown-toggle'); $('.parent > a').attr('data-toggle', 'dropdown'); $('.parent > a').attr('data-target', '#'); $('.parent > a').append('<b class="caret"></b>'); $('.parent > ul').addclass('dropdown-menu'); $('.nav-child .parent').removeclass('dropdown'); $('.nav-child .parent .caret').css('display', 'none'); $('.nav-child .parent').add

c - Sorting Array of Struct Pointers -

i trying sort array of structs using qsort() frustratingly, it's not working. have read manpage qsort() , think have comparator function syntactically looks okay, when print "sorted" array after calling qsort() , nothing sorted in array. the code: #include <stdlib.h> #include <stdio.h> #define array_sz 5 typedef struct singlechar { unsigned char character; unsigned int weight; } *singlecharptr; int compareweights(const void *a, const void *b) { const singlecharptr p1 = (singlecharptr)a; const singlecharptr p2 = (singlecharptr)b; // printf("weight1: %u\tweight2: %u\n", p1->weight, p2->weight); // return (p1->weight - p2->weight); if (p1->weight < p2->weight) return -1; else if (p1->weight > p2->weight) return 1; else return 0; } singlecharptr makechar(unsigned char c, unsigned int w) { singlecharptr scptr = malloc(sizeof(struct singlechar));

windows - mozilla npapi plugin resize issue -

when firefox resized embedded mfc application (which uses apapi plugin embeddation) unable fit in resize window (firefox). till 17.0 version issue not there, post 17.0 issue reproducible. whenever resized wm_paint (message 15 ) send application code flow (pre 18.0 firefox version embedded application): pwnd->windowproc(nmsg, wparam, lparam) cwnd::windowproc ---> if (!onwndmsg(message, wparam, lparam, &lresult)) lresult = defwindowproc(message, wparam, lparam); this in turn calls cview::onpaint() now 18.0, unable call application. let me know further clarification.

javascript - PDO: make $dbh available and maintain across all php files -

seem can't make right. basically, 3 php files used: - login.php, testconnect.php , numrows.php numrows.php main file first start played. login.php , testconnect.php good. numrows.php:- <?php global $dbh1; require_once "testconnect.php"; try { $stmt = $dbh1->prepare("select count(distinct mfg_code) test"); $stmt->execute(); } catch(pdoexception $err) { $alertmsg = $err->getmessage(); } $num = $stmt->fetch("pdo::fetch_assoc:"); $num = json_encode($num); echo $num; ?> the log error apache showed ""get /testnumcards.php http/1.1" 500 -". again error encountered while debugging "networkerror: 500 internal server error". right way do? your problem not in making $dbh available in inconsistent code , wrong syntax. @ least make file way, without useless , wrong code <?php require_once "testconnect.php"; $stmt = $dbh1->prepare("select count(

MySQL - left join or nested select for filtering non-existing rows? -

table structure catalog_product_category_bindings : `productid` integer unsigned not null `categoryid` integer unsigned not null table structure catalog_products : `id` integer unsigned not null auto_increment misc unrelated columns task: data of products not bound category (no entry in catalog_product_category_bindings ). query #1 (using left join): select cp.* catalog_products cp left join catalog_product_category_bindings cpcb on cp.id = cpcb.productid cpcb.categoryid null query #2 (using nested select): select cp.* catalog_products cp id not in (select productid catalog_product_category_bindings) both queries seem quite similar in terms of speed on tables (i don't have in there), believe second 1 worse in performance since loops on every id in catalog_products table , compares every productid catalog_product_category_bindings . not mention might not return , break query altogether (though happen if table truncated). which better? i, personally, pref

Google App Engine with Ajax: Test the returned data -

i used use following ajax code html element <a class="getcontent" href="/content">...</a> : $('.getcontent').click(function() { var url = $(this).attr('href'); $('#content').load(url); return false; }); if refresh whole page depending on value returned server: $('.getcontent').click(function() { var url = $(this).attr('href'); if (url == "success") { document.location.reload(true); }else{ $('#content').load(url); } return false; }); of course, if part hypothetical. working on google app engine python, server-side script may be: if ...: self.response.out.write('success') else: render(self, 'some_html_file.html') how how do it? thanks. try: var menuid = $("ul.nav").first().attr("id"); var request = $.ajax({ url: url, //your url here type: "post", data: {id : menuid}, datatype: "htm

serialization - Typed data over a MessageBox? -

i'm thinking writing dart based browser game. separate core game logic client render , event handling code. way can run same logic code on server dart vm side in multiplayer system. lots of games doing today (eg. quake series): have local server if play single player game. so in scenario: event handling , rendering runs on main browser thread (render loop triggered requestanimationframe ) game logic runs in separate isolate (actually webworker in browser) for communication i'm using messageboxes bit cumbersome setup , manage it's possible. can later exchanged websocket if logic runs on server. the logic isolate sends messages main thread loop game events (like game object's status being updated, map change, etc.) , main thread posts client side events (key press based player movement, commands) logic. i'm wondering what's best way manage messages on layer. documentation of messagebox: "the content of message can be: primitive values (null

javascript - How to spy on jQuery's append function Sinon -

i trying use sinon.js create spy on jquery.append function. i tried: var spy = sinon.spy($, "append"); , got following error: typeerror: attempted wrap undefined property append function . i amended to: var spy = sinon.spy($.fn, "append"); seems better, spy.called false. sinon.spy(object, "method") expects object first parameter, $ function. should spy on $.prototype this: var spy = sinon.spy($.prototype, "append"); fiddle: http://jsfiddle.net/rz825/ or can spy single object this: var spy = sinon.spy($("body"), "append"); fiddle: http://jsfiddle.net/g5j8h/

php - Cross Database in ZF2 -

how join 2 tables different databases using zf2? write following query. select db1.table1.*, db2.table2.* db1.table1 inner join db2.table2 on db2.table2.field1 = db1.table1.field1 please give example? i didn't check syntax it's this: $db = new zend_db_adapter_pdo_mysql(array( 'host' => '127.0.0.1', 'username' => 'webuser', 'password' => 'xxxxxxxx', 'dbname' => 'test' )); $select = $db->select() ->from( array( 'table1' => 'db1.table1' ), array( 'table1.*','table2.*' ) ) ->joininner( array( 'table2' => 'db2.table2' ), 'table2.field1 = table1.field1', array() ); $result = $select->query->fetchall(); var_dump($result); edit: $db definition sourced http://framework.zend.com/manual/1.12/en/zend.db.adapter.html

ruby - Got "undefined method `[]' for nil:NilClass" installing java Cookbook -

i try set vagrant vm using chef solo , berkshelf. want use maven cookbook. "maven" depends on "java" , "java_ark" (which included in "java" cookbook). of them created opscode. but everytime error: nomethoderror ------------- undefined method `[]' nil:nilclass cookbook trace: --------------- /tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/recipes/default.rb:21:in `from_file' /tmp/vagrant-chef-1/chef-solo-1/cookbooks/platform-slayer/recipes/slayer_worker.rb:2:in `from_file' relevant file content: ---------------------- /tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/recipes/default.rb: 14: # unless required applicable law or agreed in writing, software 15: # distributed under license distributed on "as is" basis, 16: # without warranties or conditions of kind, either express or implied. 17: # see license specific language governing permissions , 18: # limitations under license. 19: # 20: 21&

chat - What connection do Facebook and GMail use for messaging? -

i'm building web app needs able receive messages server (kind of instant message chat). noticed facebook , gmail have messaging in browser , not require browser plug-in that. use? i know websockets doesn't work when relying through proxy? there method?

c# - how to prevent to open in console my dynamically generated exe -

i working in c# 4.0, want generate executable file dynamically, used code dome, when executes open in console , after form displays, want generate winform executable file. how can achieve aim. code below : string code = @" using system; using system.windows.forms; namespace csbss { static class program { /// <summary> /// main entry point application. /// </summary> [stathread] static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new form1()); } } public class form1 : form { } } "; codedomprovider codeprovider = codedomprovider.createprovider("csharp"); string tempfolder = @"..\dynamicoutput"; string output = system.io.path.combine(tempfolder, @"csbss.exe"); if (!system.io.directory.exists(tempfolder)) { system.io.directory.createdirectory(tempfolder); } else { if (system.io.file.exists(output)) system.io.file.delete(output); } system.codedom.c

ios - stream a .caf audio file from server -

i working on project in recording voice , uploading server. uploaded file format .caf (core audio format) now, when try play file from server using avplayer giving error message below. error domain=avfoundationerrordomain code=-11819 "cannot complete action" userinfo=0x2f31e0 {nslocalizedrecoverysuggestion=try again later., nslocalizeddescription=cannot complete action} i have checked file on server , not corrupted. my question is: can .caf file support streaming ? if not in format need convert recorded file support streaming ? use setting in avaudiosession use .mp4 play audio both side: avaudiosession * audiosession = [avaudiosession sharedinstance]; [audiosession setcategory:avaudiosessioncategoryplayandrecord error: &error]; [audiosession setactive:yes error: &error]; nsmutabledictionary* recordsetting = [[nsmutabledictionary alloc] init]; [recordsetting setvalue :[nsnu

java - Re: parsing a svg file using batik svg parser -

i need know how parse svg file using batik svg parser. here svg file: <svg width="640" height="480" xmlns="http://www.w3.org/2000/svg"> <g> <title>layer 1</title> <line id="svg_1" y2="395" x2="449" y1="395" x1="449" opacity="0.5" stroke-linecap="round" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" stroke="#000000" fill="none"/> <path id="svg_2" d="m 200,159 c-3,53 57,-63 57,-63 c 0,0 108,-16 108,-16 c 0,0 73,79 73,79 c 0,0 -32,77 -32,77 c 0,0 -69,74 -69,74 c 0,0 -92,-18 -92,-18 c 0,0 -78,-27 -78,-27 c 0,0 -18,-85 -18,-85 c 0,0 51,-21 51,-21 z" stroke-width="2" stroke="#000000" fill="none"/> </g> </svg> now wanna read ie parse , tag value.