Posts

c - mmap and struct (incompatible type error struct to void *) -

i'm getting error: error: incompatible types when assigning type ‘struct sharedmem’ type ‘void *’ when trying mmap struct sharedmemory. here's i'm trying do: //struct each card typedef struct card{ char c[3]; //card char s; //suit } card; //struct player information typedef struct player{ int num; char* nickname; char* fifo_p; struct card* hand; } player; //struct sharedmemory typedef struct sharedmem{ unsigned int nplayers; unsigned int dealer; struct player *players; unsigned int roundnumber; unsigned int turn; struct card *tablecards; } sharedmem; then have function does: int createsharedmemory(char* shmname,int nplayers){ int shmfd; char shmname[100]={'\0'}; char *ps; ps=&shmname[0]; strcat(ps,"/"); strcat(ps,shmname); // name = /shmname shmfd = shm_open(shmname,o_rdwr,0755); if (shmfd<0){ if (errno==2){ //file or directory not exist (shared ...

Add item numbers to items in Magento Invoice PDF -

i trying should simple, stuck. i trying add serial numbers (1,2,3 etc) items in magento's invoice pdf under column called serial number. any clues on how this? thanks! this 2 files responsible displaying invoice pdf content app\code\core\mage\sales\model\order\pdf\items\invoice\default.php app\code\core\mage\sales\model\order\pdf\invoice.php overwrite 2 files or put in local folder now add serial number header in file app\code\core\mage\sales\model\order\pdf\invoice.php can fin _drawheader function add before products column $lines[0][] = array( 'text' => mage::helper('sales')->__('serial number'), 'feed' => 35 ); now go app\code\core\mage\sales\model\order\pdf\items\invoice\default.php file can find draw() function from $this->getitem(); can find item count , put loop here displaying serial numbers like for($j=1; $j<=count($this->getitem());$j++) { $lines[$j][] = array( ...

Java Android: How to give media player a string value to a resource -

i have function run audio public void playsound(string filename){ mediaplr = mediaplayer.create(context, r.raw.s1); mediaplr.start(); } the problem r.raw.s1 , want replace s1 filename , doesn't take string. can do??? thanks help if file stored in res/raw/ directory, can retrieve identifier through following code: public void playsound(string filename){ int sound_id = context.getresources().getidentifier(filename, "raw", context.getpackagename()); if(sound_id != 0) { mediaplr = mediaplayer.create(context, sound_id); mediaplr.start(); } } i prefer start variable names small letters, rather capital. helps distinguish static class. you can create map store id further reuse instead of retrieving identifier each time.

c# - how to store mysql connection data safely? -

this question has answer here: asp.net connectionstring in secure way 7 answers i'd begin new project , 1 of first problems i've figured out security of mysql connection data. i want know if it's possible configure software choose database server; reason it's necessary store connection informations (user, password, databasename) in kind of file (xml, bin, ...) thats not safe , viewed due lack of encryption. is there easy way protect these sensitive informations or have write own encryption mechanism ? in case have write own one, there guideline right? no, don't need write own encryption it, .net have encryption. simply use rijndael (aes) - encryption. import namespace: using system.security.cryptography; then use class: rijndael class and take @ thread: how generate rijndael key , iv using passphrase? use encryption properl...

php - Add a Title and fields in a table got from mysql -

i have function returns table generated values in database. function returns table in format: total ss fai user rate 99 12 87 example.of@mail.com 78 21 21 0 xxx.zzzzz@domain.com 12 35 35 0 unknown address 16 60 60 0 002154251 3 here's function use: function table($tab) { echo '<br /><table border ="3">'; echo '<tr>'; foreach($tab[0] $cle=>$val) { echo "<th>".$cle."</th>"; } echo '</tr>'; foreach($tab $cle1=>$line) { echo '<tr>'; foreach($line $cle2=>$val) { echo '<td>'.$val.'</td>'; } echo '</tr>'; } echo '</table><br />'; } i add column "type" , written in won't d...

ruby - Why do I get "Undefined method ::new" in simple classes? -

i writing atm-system-like socket/server solution. appreciate if tell me i'm missing. reason, following error running stub test suite: # running tests: .e finished tests in 0.002411s, 829.4384 tests/s, 414.7192 assertions/s. 1) error: test_0001_connects_to_a_host_with_a_socket(atmclient::connection): nomethoderror: undefined method `new' #<spoofserver:0x9dce2dc @clients=[], @server=#<tcpserver:fd 5>> /media/wildfyre/files/programming/kth/progp/atm/spec/client/spoofserver.rb:12:in `start' /media/wildfyre/files/programming/kth/progp/atm/spec/client/client_spec.rb:12:in `block (3 levels) in <top (required)>' 2 tests, 1 assertions, 0 failures, 1 errors, 0 skips my minispec file is: require_relative '../spec_helper.rb' require_relative '../../lib/atmclient.rb' require_relative 'spoofserver.rb' describe atmclient "can created no arguments" atmclient.new.must_be_instance_of atmclient end des...

jquery - Javascript onchange select list -

please can help? i have below select list: <td>call lead type: </td> <td> <select name="callleadtype" id="callleadtype"> <option value=""></option> <option value="lsg service warm transfer claims">lsg service warm transfer claims</option> <option value="ivr direct call">ivr direct call</option> <option value="transfer ee agent">transfer ee agent</option> <option value="dropped line">dropped line</option> <option value="test call ee">test call ee</option> </select> </td> when user selects "transfer ee agent" need 4 new input boxes appear not appear when of other options selected? so assume it's onchange code needs? i'm not sure how thanks in advance help padders you require javascript code display other...