Posts

Showing posts from May, 2015

Windows 8 Updating Metro App Tiles on basis of system date and time - JavaScript -

i m developing metro application windows 8 using javascript. far have done is create application whenever application executed, tile gets updated. all want update tile on basis of system date , time without executing application. how can achieved? any highly appreciated thanks sabin okay link http://dotupdate.wordpress.com/2012/04/20/updating-metro-tiles-in-the-background-periodically/ seems answer question. thanks

io redirection - redirect all output in a bash script when using set -x -

i have bash script has set -x in it. possible redirect debug prints of script , output file? ideally this: #!/bin/bash set -x (some magic command here...) > /tmp/mylog echo "test" and the + echo test test output in /tmp/mylog, not in stdout. this i've googled , remember myself using time ago... use exec redirect both standard output , standard error of commands in script: #!/bin/bash logfile=$$.log exec > $logfile 2>&1 for more redirection magic check out advanced bash scripting guide - i/o redirection . if want see output , debug on terminal in addition in log file, see redirect copy of stdout log file within bash script itself . if want handle destination of set -x trace output independently of normal stdout , stderr , see bash storing output of set -x log file .

asp.net mvc - How do I retrieve the VALUE of the object's property that is passed to my custom EditorFor from the view? -

system.web.mvc has htmlhelper contains method called editorfor renders editing control associated data type in view. im trying create own editorfor method extending asp.net mvc 2 htmlhelper. have following: public static string editorfornew<tmodel, tproperty>(this htmlhelper<tmodel> helper, expression<func<tmodel, tproperty>> item) { string value = ""; string name = item.tostring(); // corrected in comment answer below! type type = typeof(tproperty); if (type == typeof(int) || type == typeof(int?) || type == typeof(double) || type == typeof(double?) || type == typeof(decimal) || type == typeof(decimal?) || type == typeof(float) || type == typeof(float?)) { return helper.textbox(name, value, new { @class = "number" }).tostring(); } else { return helper.textbox(name, value).tostring(); } } can explain how retrieve value of ob...

internet explorer - Setting selected index not working, jquery .Val() -

i have tried of these various ways set value of select. know id/index value , not text description. none of these work in ie , except last work in firefox. i have set alerts make sure contactlist.pertype_id has value , number could please tell me i'm doing wrong. var perid = parseint(contactlist.pertype_id); $('#ddcontacttype').val(perid); $('#ddcontacttype').val(3); $('#ddcontacttype option[value=3]').attr('selected', 'selected'); $('#ddcontacttype option[value='+perid+']').attr('selected', 'selected'); //does not work in ff turns out control trying set did not exist yet in ie. moved call method before service call , control loads fine using of methods listed above , response got below. try prop : $('#ddcontacttype option[value=' + perid + ']').prop('selected', true);

java.lang.ClassCastException: android.widget.TextView -

i've layout xml, named pagina.xml: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_vertical" > <textview android:id="@+id/descrizione" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:text="large text" android:textappearance="?android:attr/textappearancelarge" /> <button android:id="@+id/scelta1" android:layout_width="wrap_content" android:layout_height="wrap_content" a...

select box posting to jquery ajax appends [] to the field name -

i have select box on page post jquery using .ajax , works great when select box can select 1 value, when change "multiple" appends [] end of field name. example listid without multiple fine, "multiple" attribute changes name listid[]. idea what's happening? <select multiple size="5" name="frmrecipientlist" id="listid"> $.ajax({ url: '/app/components/mailingsreport.cfc', //post method used type: "post", complete: function(){ $("#loader").hide(); }, //pass data data: { method: "createemailing", title: $('#title').val(), campaignid: $('#campaignid').val(), brandid: $('#brandid').val(), listid: $('#listid').val(), maxrecipients: $('#maxrecipients').val()...

java - Regex to get ALL data between > and < -

i'm looking making regex gets data following format: ">data<" returns "data" "> data <" returns " data " ">.4930894812948cm <" returns ".4930894812948cm " "> 939j@$%^^ < > << <" returns " 939j@$%^^ < > << " ">data< blah blah blah >data123< blah >data456<" returns "data", "data123" , "data456" (quotes in examples there make them easier read; should not appear in real results.) data can encoding >data< can located anywhere in text file can repeated 1 after another. data mean all, including \n , \r , . , reserved chars, etc. i tried >(.*?)< didn't work. i'm doing in java. adding example: lorem ipsum dolor sit amet, consectetur adipiscing elit. integer facilisis neque tellus, eget rhoncus sapien. pellentesque placerat purus non eros auctor ut consectetur m...

oop - OO design in python. Up across and down? -

my question how 2 objects have both been created parent class can talk each other. real use case have pyside gui application 2 widgets sitting on centralwidget need connect signal , slot. however problem more generic have silly example demonstrate problem. in particular "asksister" method in son, know parent has daughter , need connect 2 methods. however, hard linking connection, means can't run unittests without creating entire object structure. is there better way? would less lame if posted real code here (after simplifying) class parent(object): def __init__(self): self.son = son(self) self.daughter = daughter(self) self.son.dohomework() class son(object): def __init__(self, parent): self.parent = parent def dohomework(self): print 'the answer {0}'.format(self.asksister()) def asksister(self): return self.parent.daughter.answer() class daughter(object): def __init__(self, pa...

objective c - Getting the bounding box of each glyph in pdf - iOS -

i've been trying highlight text in pdf. after lot of research , experiments, seems have find bounding box of each glyphs, create overlay actual drawing happening, , highlight text filling cgrect info bounding box , fill color. now, stumped bounding box. i've been using pdfkitten search , highlight text. want use select , highlight text. don't understand how use bounding box ( other information ascent, descent, capheight, etc.) fill highlight searched word. when tried access fontdescriptor class info, displays this: 2012-06-28 16:32:20.626 er[2408:15203] x:-665, y:-325, width:2000, height:1006 2012-06-28 16:32:20.627 er[2408:15203] x:-157, y:-250, width:1126, height:952 2012-06-28 16:32:20.628 er[2408:15203] x:-628, y:-376, width:2000, height:1010 it confusing if can clarify this, appreciated. you cannot use font descriptor information bounding box glyph. pdfkitten takes care of finding width , height of each glyph using renderingstate model. you ca...

antlr3 - ANTLR Tree Walker should not output AST? -

i have made own language using antlr. grammar complete, want make tree walker verifies input. doesn't work. when (accidentally) used output=ast in tree walker compiles without error, doesn't accept input. (it says org.antlr.runtime.tree.commontree cannot cast tools.anode). think output=ast can not used in tree walker. however, won't compile then. gives internal error: /.../src/awesomechecker.g : java.lang.illegalstateexception: java.lang.nullpointerexception org.deved.antlride.runtime.antlrerrorlistener$dynamictoken.invokemethod(antlrerrorlistener.java:59) org.deved.antlride.runtime.antlrerrorlistener$dynamictoken.getline(antlrerrorlistener.java:64) org.deved.antlride.runtime.antlrerrorlistener.report(antlrerrorlistener.java:131) org.deved.antlride.runtime.antlrerrorlistener.message(antlrerrorlistener.java:115) org.deved.antlride.runtime.antlrerrorlistener.warning(antlrerrorlistener.java:99) org.antlr.tool.errormanager.grammarwarning(errormanager.java:742) org.antlr.t...

package inheritance in python -

is there way package inheritance in python i.e. package has modules mod1, mod2 , other subpackages. package b should inherit modules , subpackages such should possible import b.mod1 . i have gone through package inheritance section in following link http://peak.telecommunity.com/doc/src/peak/config/modules.html , unable import peak.api . have tried importing modules of parent package in __init__ file of child package, did not help. # package b __init__.py import mod1, mod2, modn and that's need.

javascript - Totalling checked checkboxes amidst changes -

i have page many checkboxes, each of tied product price. i'm trying use jquery give real-time readout of 1) number of products, , 2) total price of user's selections. this should easy: have done like: $(input).change( function(){ var sum = $(input:checked).length var price_total = $(input:checked).length * 1.99 }) the complication the element or elements being changed not counted in above code. seems when clicking blank checkbox check it, jquery consider current element 'not checked' rather 'checked', i.e. reflects checkbox before change. result, code gets more complicated accept changed items. is there elegant , simple way around this? not sure if code posted you're running, among other things, code missing quotes in $ selectors. however, working me: $(':checkbox').change( function(){ var sum = $(':checked').length; var price_total = sum*1.99; })​​ jsfiddle demo

php - external and internal link genration in xls file using pear -

i wanted generate xls file multiple sheets. so, took below mentioned link. http://pear.php.net/package/spreadsheet_excel_writer using tutorial documentation same able create multiple sheets in xls file. i.e, in test.xls file able create sheet1, sheet2, sheet2 , on. now, want add link in content of sheet1 sheet2 displays data. going through worksheet::writeurl method. but, failed put links in content. sample code has been given below: require_once 'spreadsheet/excel/writer.php'; $workbook = new spreadsheet_excel_writer(); $workbook->send('test.xls'); $worksheet =& $workbook->addworksheet('report'); $worksheet1 =& $workbook->addworksheet('john smith'); $sheet = "john smith"; $worksheet->write(0, 0, 'name'); $worksheet->write(0, 1, 'age'); $format =& $worksheet->writeurl(1,0 ,"internal:".$sheet."!a1", $sheet); $worksheet->write(1, 1, 30); $worksheet->wr...

sharedservicesprovider - Alternative name of Shared Service in hyperion -

i new in hyperion , studying shared services user guide. have read information shared services task of shared services , gone through . have 1 question is: what alternative name of shared services in hyperion. please reply me . there not alternative name share services. shared services series of services shared across hyperion epm suite part of foundation services module. http://www.oracle.com/technetwork/middleware/bi-foundation/shared-services-100533.html

objective c - Authenticating on php script from iOS/iphone application -

this php need authenticate: <?php $username=$_post["m_username"]; $password=$_post["m_password"]; /* $username=$_get["m_username"]; $password=$_get["m_password"]; */ ?> i using below code authenticate iphone app. not authenticating. dont know issue not working. says null parameters/values sent. nsstring *urlasstring =[nsstring stringwithformat:@"http://www.myurl.com/abc/authenticate.php"]; nsurl *url = [nsurl urlwithstring:urlasstring]; nsmutableurlrequest *urlrequest = [nsmutableurlrequest requestwithurl:url]; [urlrequest settimeoutinterval:30.0f]; [urlrequest sethttpmethod:@"post"]; [urlrequest addvalue:@"test" forhttpheaderfield:@"m_username" ]; [urlrequest addvalue:@"123" forhttpheaderfield:@"m_password" ]; [[nsurlconnection alloc] initwithrequest:urlrequest delegate:self]; nsoperationqueue *queue = [[nsoperationqueue a...

c# - Missing library to reference OLEDB connection types -

i got following piece of code ssis team blog cast oledb connection type can used acquireconnection () method. not sure why dts.connections part not working. dont know library have add make work. pretty added important ones including dts.runtimewrap. please let me know if need more information on question. connectionmanager cm = dts.connections["oledb"]; microsoft.sqlserver.dts.runtime.wrapper.idtsconnectionmanagerdatabaseparameters100 cmparams = cm.innerobject microsoft.sqlserver.dts.runtime.wrapper.idtsconnectionmanagerdatabaseparameters100; oledbconnection conn = cmparams.getconnectionforschema() oledbconnection; edit below entire code component. using system; using system.collections.generic; using system.data; using system.data.sqlclient; using microsoft.sqlserver.dts.runtime; using system.data.oledb; using system.data.common; using system.linq; using system.configuration; using system.collections; //using system.data.oledb; namespace aoc.sqlserver.dts.task...

go - Is it possible to capture a Ctrl+C signal and run a cleanup function, in a "defer" fashion? -

i want capture ctrl+c ( sigint ) signal sent console , print out partial run totals. is possible in golang? note: when first posted question confused ctrl+c being sigterm instead of sigint . you can use os/signal package handle incoming signals. ^c sigint , can use trap os.interrupt . c := make(chan os.signal, 1) signal.notify(c, os.interrupt) go func(){ sig := range c { // sig ^c, handle } }() the manner in cause program terminate , print information entirely you.

android - Is there a way to handle key pressing in the fragment? -

i have fragment gridview , textview want handle search button pressing. how can this? if bind onkeylistener fragment's layout never called. my suggestion handle on activity side , delegate fragment. need override onsearchrequested ( check docs ) , invoke method on fragment tell search requested. after fragment can update accordingly.

html - how to create image over image in javascript -

i want 2 things different images in same page, looked on , can't find answer, i'd if me. in first image want put on smaller image on side of , on hover big image small image changes , caption appears. in addition in second image want smaller image appear , if hover on big image border of image appear , the words under image appear painted in different color. thank you try set bigger z-index via javascript on hover action on element hovering. position of smaller image , text on element can made e.g. using position: absolute; , z-index (via javascript/jquery).

javascript - What is the best way to check that multiple variables are set? -

this more of general practices question. the language working javascript. have function getting object many variables (okay, 10 variables). best way make sure function getting required variables , set? i know, know, why not use if statement. that's big chunk of if statements! grow programmer, know may not best method this. i'm looking shortcut actually. how you check large sum of variables existence , non-blank values? this expression returns true, if variables variablenamelist (list of required variable names) set in object o : variablenamelist.every(function(varname){ return typeof o[varname] !== 'undefined'; }); you can use underscore _.all function instead of native every , , underscore _.isundefined instead of typeof ... .

osx - script for auto opening directories (mac os x) and creating m3u playlists -

imagine have directories containing both mp3 files , sub-directories, containing mp3 files, like: /music/band1/ /music/band2/ /music/band2/dir1/ /music/band2/dir2/ /music/band3/dir1/ /music/band3/dir2/ /music/band4/ ... i create .m3u file in every directory containing mp3 files - example: /music/band1/band1.m3u /music/band2/band2.m3u /music/band2/dir1/dir1.m3u /music/band2/dir2/dir2.m3u /music/band3/dir1/dir1.m3u /music/band3/dir2/dir2.m3u /music/band4/band4.m3u the name of .m3u file directory name in .m3u created. (this example directory structure.) i hope clear :) so far have generate m3u files *.mp3 files, in actual directory, , name directory. #!/bin/bash\ ls | grep -i mp3 > filelist.txt mv filelist.txt filelist.m3u foldername=${pwd##*/} echo $foldername mv filelist.m3u $foldername.m3u what should added have recursively every subdirectory of /music , , if there sub-sub directory, there? then, execute m3u -making script in each sub-directory? thank h...

ruby on rails - How to prevent mass assignments on associations the right way? -

let's have model warehouse , model car , , model dealer . model car like: attr_accessible :make, :year belongs_to :warehouse belongs_to :dealer controller cars like: def create car = current_dealer.find(params[:car][:warehouse_id]).cars.new(params[:car]) car.save! end the view of cars#new like: <%= semantic_form_for @car |f| %> <%= f.inputs %> <%= f.input :warehouse, :include_blank => false %> <%= f.input :make %> <%= f.input :year %> <% end %> <% end %> dealers can choose warehouse when adding car, above code protected against mass assignments (a.k.a. dealers adding cars warehouses don't own) , raises exception saying :warehouse_id cannot mass assigned, that's because it's brought parameters params[:car][:warehouse_id] . how rid of error without manually assigning attributes? , method anyways? p.s. tried params[:car].delete(:warehouse_id) doesn't right way this. sin...

ios - CALayer breaks in landscape mode -

i coding custom transition based on shutter transition tutorial. it's pretty simple, first view controller meant divide hundreds of pieces , fade 1 @ time, problem doesn't work in landscape mode. apparently "contentsrect" method of calayer (which supposed work on normalized image space) works in portrait mode. have attached file in here if needs have , please if can me. http://tinyurl.com/88669oy regards here trans code: calayer* viewlayer; - (void)transitwithimageview:(uiimageview *)imgview inview:(uiview *)view withimage:(uiimage *)img { viewlayer = [imgview layer]; [view.layer addsublayer:viewlayer]; cgsize layersize = viewlayer.bounds.size; // begining of make array of transitions nsmutablearray* alltransitionsarr = [[nsmutablearray alloc] init]; ( int = 0; < block_count; i++ ) { cabasicanimation *fade = [cabasicanimation animationwithkeypath:@"opacity"]; fade.tovalue = [nsnum...

java - Is it possible to receive URL from DataAccessException in hibernate spring? -

i use spring hibernate framework , in catch query update receive dataaccessexception for write in error log receive url of database, sql error etc. possible receive dataaccessexception type? thanks. there sources of dataaccessexception , methods defined, wrapper on exception, there nothing see. take consideration, not exception database may throw, should other exceptions, such jdbcexception . the things need can still retrieved: get sql error via ex.getmessage(); get database url hibernate session . show real query sql using hibernate .

java - Convert Class Object to Human Readable String -

is there way in can automatically convert custom class object human readable string? e.g. consider following class: class person { string name; int salary; ... } person p = new person(); p.setname("tony"); p.setsalary(1000); i need like: person: name="tony", salary=1000 importing commons lang use tostringbuilder check method reflectiontostring(java.lang.object) , create automatically representation expecting. this code: person p = new person(); p.setname("tony"); p.setsalary(1000); system.out.println(tostringbuilder.reflectiontostring(p)); results string: person@64578ceb[name=tony,salary=1000]

How to load selected list items in multiple-select-listbox in update view in yii? -

i have multiple select-list-box staff in create-service-form , used select multiple staff when creating new service. can assign multiple staff on single service. i saved staff_id field as: $model->staff_id = serialize($model->staff_id); here update-view code multiple-select-list-box: <div class="row"> <?php echo $form->labelex($model,'staff_id'); ?> <?php $data = array('1' => 'sam', '2' => 'john', '3' => 'addy'); $htmloptions = array('size' => '5', 'prompt'=>'use ctrl select multiple staff', 'multiple' => 'multiple'); echo $form->listbox($model,'staff_id', $data, $htmloptions); ?> <?php echo $form->error($model,'staff_id'); ?> </div> problem is, when load form updating service. how select staff, saved in database? i tried this dro...

vb6 - Non-blocking read of stdin? -

i need have form-based application check stdin periodically input, still perform other processing. scripting.textstream.read() , readfile() api blocking, there non-blocking method of reading stdin in vb6? with timer1 set fire every 100 ms, i've tried: private declare function allocconsole lib "kernel32" () long private declare function freeconsole lib "kernel32" () long dim sin scripting.textstream private sub form_load() allocconsole dim fso new scripting.filesystemobject set sin = fso.getstandardstream(stdin) timer1.enabled = true end sub private sub timer1_timer() dim cmd string while not sin.atendofstream cmd = sin.read(1) select case cmd ' case statements process each byte read... end select wend end sub i've tried: private declare function allocconsole lib "kernel32" () long private declare function freeconsole lib "kernel32" () long private ...

Create a global javascript or jQuery variable visible in many pages -

i have js variable many functions, , want create in 1 of them global variable visible in php file load js file. how can ? thanks help. thaks : here's edit : the variable has dynamic value , generated on event.keycode have tried in js file: window.selected_sku = null; in top of js file and in appropriate function : window.selected_sku = v; in php within javascript code, have : if(window.selected_sku!=null){ alert(window.selected_sku); } but don't alert !! help.. assign window window.variable = "this variable". when include js file can access variable in file.

remote desktop overtaking someone else's disconnected session -

we have 1 user account on remote server. when computer initiates remote session, disconnects it, , computer b initiates remote connection, computer b being connected a's session. how can make sure same device can reconnect remote session? if it's single user account don't think can. need make sure log off instead of disconnecting, can start new session right account. see here more info.

How can I put DISPLAY name in frame-title of GNU EMACS -

i use gnu emacs on multiple monitors windoze pc via vnc. (currently 5 - 4 big, 1 small monitor on tablet pc. 2 vertical 1200x1920, 2 horizontal 1920x1200, plus small.) the way doing run separate vnc on each monitor. open single emacs, , use make-frame-other-display open emacs' frames in other vnc window. to make things more complicated - run vncs on up-to-date ubuntu system, run emacs on quite out of date machine rest of build tools live. i.e. vnc displays not local same machine emacs. rather xhost+, open xterm in each of vncs, , ssh machine running emacs. creates displays of form localhost:16.0. use make-frame-on-display using these localhost displays. this gets confusing. it helps if leave "echo $display" in xterm windows. or chamnge xterm's title. i'd change emacs' frames' titles, reflect each frame things current display. doing (defvar frame-title-specific-ag "emacs" "title element frame-title-format specific pa...

c# - DataGridView Custom Sort - How to compare regardless of data type? -

i have datagridview , need use custom sorter (derived system.collections.icomparer). working fine, noticed hadn't quite gotten comparisons right because ends doing string compare on cells regardless of underlying data type. (so, 1, 10, 2) instead of (1, 2, 10). how can write compare function appropriately compare columns regardless of data type? public int compare(object x, object y) { datagridviewrow dr1 = (datagridviewrow)x; datagridviewrow dr2 = (datagridviewrow)y; object cell1 = dr1.cells["somename"].value; object cell2 = dr2.cells["somename"].value; //compare cell1 , cell 2 based on data type in //dr1.cells["somename"].valuetype. } it seems there couple of essential parts solution problem. ensure comparing types. ensure can compare instances of type. here ideas started. i've omitted error checking in interest of clarity. assume: type type1 = dr1.cells["somename"].valuetype; typ...

html - Git web development workflow, commit links to minified css and js? -

i have read implementing git hooks minify css , js source files post-commit (as minified assets shouldn't committed) best practice when committing actual links these within html pages? the options can think of are: git commit html pages links minified source files, without minified source files in repository: <link href="/assets/css/application.min.css" rel="stylesheet"> <script src="/assets/js/application.min.js"></script> git commit html pages links development source files , change minified once deployed: <link href="/assets/css/application.css" rel="stylesheet"> <script src="/assets/js/application.js"></script> i sure there simple , effective workflow achieve unaware of. many in advance! for prefer put in sample config file , commit instead. during development , deployment sample config file copied proper name , modified necessary fit requirements. way won...

Perl recursion causing "use of uninitialized value" error -

i new perl, , can't seem find answers anywhere. narrowed down problem recursive function. if comment out, works fine without errors. have: use strict; use warnings; sub generatepermutations{ my($n, $nmax, $i, $arrlength, @arr) = @_; if($n == 0){ foreach($i..$arrlength-1){ $arr[$i] = 0; ++$i; } @qarr = (); $rval = 1; for(my $p = 0; $p < @arr; $p++){ $rval *= fac($arr[$p]); for(my $q = 0; $q < $arrlength; $q++){ $qcount = 0; for(my $j = 0; $j < $arrlength; $j++){ if($arr[$j] eq $q){ ++$qcount; } } $qarr[$i] = $qcount; } } $qval = 1; for(my $qnum = 0; $qnum < @qarr; $qnum++){ $qval *= fac($qarr[$qnum]); } $maxdistval = 0; $maxdistval = (1/($arrlength**$arrlength))*(fac($arrlength)/$rval)*(fac($arrlength)/$qval); if($maxdistval > $distribution){ $distribution = $maxdistval; ...

haskell - Program design concerning ADTs -

i have type data phase = phaseone | phasetwo | phasethree deriving enum and 5 operations on each phase read write validate evalstatus update i began trying create type class. problem is, same type. i'd able like instance myclass phasethree read = ... also, need overload return type. i know type classes aren't want. i'm not sure how want. thought of gadt that's not quite right need able have each instance in separate file. i'd advice on mechanisms need investigate? have given enough information? i recommend inverting things bit. data phase = phase { read :: string -> foo, write :: foo -> io (), validate :: foo -> bool, evalstatus :: io (), update :: foo -> foo } phaseone, phasetwo, phasethree :: phase (or similar rejiggering of classes explicit records).

css3 - Multi-page django form - slider or FormWizard? -

i have long form want break multiple pages. i evaluating between 2 options presentation: present form on multiple pages using formwizard present form on slider css3 slider . the slider 1 page long using css3 give impression of slides. floats of content areas next each other, hides overflow, sets page width 500% if have 5 slides, , moves left-margin -100% show next slide. 1 page seems form being shown on sliding pages. to me advantage of slider approach there 1 form , user submits form once @ end of slides , can go , forth make changes.(this common case). versus having mini-forms formwizard , submitting them after each page. me, formwizards seems complicated if user wants change of previous page responses. need filefield on form pages , seems formwizard accepts filefield on last page. however, have not seen many folks use sliding forms (css3 or jscript one) approach. hence, newbie, wondering if there obvious pitfalls of doing this? i can write formwiza...

iphone - Creating Files And Saving Objects In Them -

why when call method (saveobject: (id)object forkey: (nsstring *) key), file not created??? when call filepath equal nil (-(void) setfilepath: (nsstring *)filename) method called... -(int) saveobject: (id)object forkey: (nsstring *) key { //save object file if(filepath == nil) { [self setfilepath:nil]; } maindict = [nsmutabledictionary dictionarywithcontentsoffile:filepath]; if(maindict == nil) { maindict = [[nsmutabledictionary alloc] init]; } [maindict setobject:object forkey:key]; if(![maindict writetofile:filepath atomically:yes]) { if(object == nil) { return 3; } if(key == nil) { return 4; } return 2; //error not write object file } else { if(shouldusecache == yes) { cachestatus = 2; //new caches need updated } return 1; //success object saved file } //return key's // *1 success object saved file //...

Strange Redis SET command behaviour -

i'm writing simple program testing redis: #include <hiredis.h> #include <cstdio> int main() { rediscontext * c = redisconnect("127.0.0.1", 6379); redisreply * reply; reply = rediscommand(c, "flushall"); freereplyobject(reply); for(long int = 0; <= 1000000; i++) { char query[64]; sprintf(query, "set %ld \"string%ld\"", i, i); reply = rediscommand(c, query); freereplyobject(reply); if( !(i % 100000) ) { reply = rediscommand(c, "dbsize"); int res = reply->integer; freereplyobject(reply); printf("%s\n", query); printf("dbsize: %d\n", res); } } redisfree(c); } it should put 1000000 keys db, output following: set 0 "string0" dbsize: 1 set 100000 "string100000" dbsize: 100001 set 200000 "string200000...

Free Amazon AWS/RDS Instance -

i have hosted server app on aws , rds relational db. though opted free account, rds being charged @ $0.0025 per hour amounting $18 month. i read documentation still not able figure out. way or there way free rds account testing purpose? thanks opentube i've started setting , realized allowing me make selections couldn't possibly free. when setting free teir instance, on left hand side of screen your current selection eligible free tier. once select "multi-az deployment" or use db instance class other "db.t2.micro" slyly change left column display: the following selections disqualify instance being eligible free tier: multi-az deployment just careful in selections , usage maintain free teir.

c - designing a algorithm for a large data -

i read 1 of question being asked job interview of software engineer. if there 1000 websites , 1000 users, write program , data-structure such can query followin @ real time: 1. given user, list of sites he/she has visited 2. given website, list of users have visited it. i think wanted sort of pseudo code or designing algorithm.. can guys give tips this? one thing - in order able answer both queries, need store pairs mean user has visited given website. propose following: you have structure: struct visitpair{ int websiteid; int userid; visitpair* nextforuser; visitpair* nextforwebsite; }; nextforuser point next pair given user or null if there no next pair given user, nextforwebsite point next pair website. user , website like: struct user { char* name; visitpair* firstpair; }; struct website { char* url; visitpair* firstpair; }; i assume both website-s , users stored in arrays, these arrays websites , users . adding new visitpair relative...