Posts

Showing posts from May, 2013

php - Limit visitors statistics to 30 days -

i trying edit great visitor statistics script (php/mysql) ghaffar khan (full script @ http://www.codeproject.com/articles/35570/site-statistics-with-php-and-mysql ) having hard time trying limit visitors shown in graph stats past 30 days. there unfortunately no instruction on how , i've been struggling far. here main script: <?php include("configuration.php"); $page = input($_get['page']) or die('error: missing page id'); mysql_select_db($database, $con); // total visits count $query='select count( * ) total '.$tablename.' section=\''.$page.'\''; $result = mysql_query($query); $row = mysql_fetch_array($result, mysql_num); $count = $row[0]; // unique visitors count $query='select count(distinct ip) '.$tablename.' section=\''.$page.'\''; $result = mysql_query($query); $row = mysql_fetch_array($result, mysql_num); $uniaqucount = $row[0]; mysql_close($con); /* graph rendering...

aggregate - Counting in R and preserving the order of occurence -

suppose have generated vector using following statement: x1 <- rep(4:1, sample(1:100,4)) now, when try count number of occurrences using following commands count(x1) x freq 1 1 40 2 2 57 3 3 3 4 4 46 or as.data.frame(table(x1)) x1 freq 1 1 40 2 2 57 3 3 3 4 4 46 in both cases, order of occurrence not preserved. want preserve order of occurrence, i.e. output should this x1 freq 1 4 46 2 3 3 3 2 57 4 1 40 what cleanest way this? also, there way coerce particular order? one way convert variable factor , specify desired order levels argument. ?table : "table uses cross-classifying factors build contingency table of counts @ each combination of factor levels"; "it best supply factors rather rely on coercion.". converting factor yourself, in charge on coercion , order set levels . x1 <- rep(factor(4:1, levels = 4:1), sample(1:100,4)) table(x1) # x1 # 4 3 2 1 # 90 72 11 16

c# - WinForms Designer - Adding control to tabPage -

i have 1 tabcontrol 4 tabpages. added appropriated controls in first 3 tabpages without problems, when try add(drag , drop toolbox) textbox tabpage4(active, highlighted element) goes tabpage1 instead. is strange designer bug or missing option ? that's weird couldn't reproduce same behaviour, visual studio sp1 installed?

java - No response after installing my own eclipse plugin -

recently have developed eclipse plugin, exported plugin method "export" > "deployable plug-ins , fragments" , after got .jar plugin , , put ~/eclipse/plugins , plugin has shown in eclipse. of workmates have no response after put ~/eclipse/plugin , of them can while can't. ones use adt-bundle install plugin have no response. have changed build jar method to: "export" > "jar file" , failed. build jar method wrong or install method jar wrong? first guess colleagues have dependency issues prevents plugin loading. easy check: "help" -> "about" -> "installation details", click on tab "configuration". see list containing entries such as; org.apache.commons.io (2.0.1.v201105210651) "apache commons io" [resolved] org.apache.commons.lang (2.6.0.v201205030909) "apache commons lang" [resolved] org.apache.commons.logging (1.1.1.v201101211721) "apache commons lo...

javascript - Error: Syntax error, unrecognized expression: a[rel= {myString} ] -

i working on small application , got stuccked on small error. firebug: error: syntax error, unrecognized expression: a[rel=!a1=0,1000,0,0,0,1,0,0.4] jquery.1.11.js (line 1471) throw new error( "syntax error, unrecognized expression: " + msg ); what app does: [not important] sends form data php processinf , retrieves , display received data. after data displayed adds link variables store data [ in case user needs send page queries other user] at page load process repeated [script sends data; php process data; send etc]. problem error in firebug. idea? this of code: after form submit , data received: function addtolink(){ /* set vars manually not important */ var tip = 0; var suma = 1000; var pai = 0; var cdm = 0; var bdm = 0; var fdb = 1; var sni = 0; var mbp = 0; var qlink = tip+','+suma+','+pai+','+cdm+','+bdm+','+fdb+','+sni+','+mbp ; window.loc...

javascript - Backbone, keep a models data even after the page was refreshed -

i building rest api. client side, use backbone. upon authentication, api sends token via ajax on backbone's session model. i place token using jquery's ajaxprefilter method, send token towards api on every request. everything works perfect, until users refreshes page. if page refreshed, token lost, model re-initializes , user has authenticate again. how can bypass this? 1. store token inside cookie (very unsafe, bad idea) - defeats rest purpose. 2. store token inside localstorage - equally bad, believe. is there else can done? thank you! you can store token both ways. if you're using ssl, token available client (and nsa, maybe) brings no problem. i rather store token using localstorage unless client doesn't supports it. you can check answer keep session across page reload in backbone js

gcc - Static local C variables are followed by a number in assembler code. Is that number random? -

i wonder if number follows local static variable name in assembler random or if there meaning. compiled sample c source gcc v. 4.7.2 in debian wheezy; assembler listing shows row containing: .comm i.1705,4,4 where 1705 come from? thank in advance. here source: int main() { static int i=0; return i; } it counter of identifiers encountered during compilation. if put declaration behind, gives me next number. if put another, non-static, object in between difference 2.

assembly - i386 Assembler Instruction Encoding -

i trying understand how instructions in programs compiled i386/x86 encoded (i use http://ref.x86asm.net/coder32.html reference), can't seem grip on issue, despite rather documentation. if explain me, i'd happy it. until have gathered instruction encoded this: prefix (1 byte) [optional] opcode (1 or 2 byte, depending on prefix) modr/m (1 byte) [optional] sib (1 byte) [optional] displacement (1-4 bytes) [optional] immediate value (1-4 bytes) [optional] the optional parameters depend on actual operation execute, resp. opcode. let's assume have following instruction, plain , simple: 6a 4d push 4dh that okay me, understand that. 6a opcode 8-byte intermediate value of 4dh. let's go further down road: 51 push ecx same deal, opcode being 50 + 1 ecx register r32 operand. but one? ff 15 f8 2a 42 00 call dword ptr ds:0x422af8 i understand first byte opcode call, second modr/m mod == 00, reg == 010 , r/m == 101, specifies displacement...

sql - Join Table by previous top (max) date -

i have following problem: have 2 tables, 1 accounts table transactions in (there can multiple transactions in sigle day), table account balances (where balance @ end of day recorded; since tranactions don't occur everyday balance table has date 'gaps' like: 2014-01-05 800 usd next row 2014-02-03 600 usd). need join tables initial balance of day (max previous date in balance table). select client_id, transaction_id, amount, date transactions balance table: select client_id, date, balance balance i need like select * transactions t inner join balance b on b.client_id = t.client_id , t.date > b.date (here should previous max date) select * transactions t inner join balance b on b.client_id = t.client_id , t.date = (select max (bl.date) balance bl t.client = bl.client_id , bl.date < t.date)

java - Handling AGC (Automatic Gain Control) VoiceRecognition? -

how can handle automatic gain control of voicerecognition code? if i'm not mistakened, source.android.com's article explains in voicerecognition agc not enabled, yet in htc, after running voicerecognition noticed agc running.

java - Preferable way of making code testable: Dependency injection vs encapsulation -

i find myself wondering best practice these problems. example: i have java program should air temperature weather web service. encapsulate in class creates httpclient , rest request weather service. writing unit test class requires stub httpclient dummy data can received in stead. there som options how implement this: dependency injection in constructor. breaks encapsulation. if switch soap web service in stead, soapconnection has injected instead of httpclient. creating setter purpose of testing. "normal" httpclient constructed default, possible change httpclient using setter. reflection. having httpclient private field set constructor (but not taking parameter), , let test use reflection change stubbed one. package private. lower field restriction make accessible in test. when trying read best practices on subject seems me general consensus dependency injection preferred way, think downside of breaking encapsulation not given enough thought. what think...

validation - parsing & validating csv data file using unix scripting -

i have basic knowledge on unix shell scripting(not expert). my requirement reading csv file using schema defined in configuration file , if condition not mached drop records. in brief: here i'm defining schema of input file in normal text file , i'm calling configuration file. configuration file looks : col1 integer nn col2 string col3 string nn also i'm having data file ( .csv file) , looks : id,name,location 1,john,fl 2,merry,, 3,taylor,ca a,george,mi so here need write unix sript such way while reading csv data file ,it should refer configuration file datatype , whether field null or not. if not satisfying condition should drop whole record , move next row validation check. here expected result : id,name,age 1,john,fl 3,taylor,ca rest of records dropped because : 2,merry,, ---> here 3rd filed null in configuration file not null(nn) a,george,mi --> here 1st field value string in conf file integer. so how achieved in unix...

ios7 - iOS remote notifications not showing outside app -

the strangest thing has been bothering me ages now. when sending push notification our sandbox environment system receives notification when app in foreground. exiting app , sending push notification doesn't show badge or alert. these steps i've taken far: re-created provisioning profile after generating ssl. made sure correct capabilities in place. verified device token registered does have idea problem here? why push notification received inside app, not outside?

xml - Evaluating if an attribute value is parseable to a xs:int -

background: i trying perform query (using xquery 3.0) on attribute value ( attrname ) might either xs:string or xs:int , lets call $a . if $a able parsed xs:int want compare against xs:int variable $v ( < , <= , = , etc.). otherwise, if xs:string want perform different comparison. xml example <root> <element attrname="1">this xs:int</element> <element attrname="a">this xs:string</element> </root> pseudo-code if $a xs:int else if $a xs:string else my issue: i not able find proper way of evaluating if $a xs:int before performing operation. you can use if ($a castable xs:int) expression1 else expression2 .

titan with es and cassandra - java.lang.IllegalArgumentException: Index is unknown or not configured: search -

i using es-cassandra. trying load default graph below error. how fix? assming have create es index? if index? curl -xput 'http://localhost:9200/what_index???/' gremlin> g = graphofthegodsfactory.create('/tmp/titan') ==>titangraph[local:/tmp/titan] gremlin> g = titanfactory.open('conf/titan-cassandra-es.properties') ==>titangraph[local:/home/ubuntu/conf/titan-cassandra-es.properties] gremlin> graphofthegodsfactory.load(g) index unknown or not configured: search display stack trace? [yn] y java.lang.illegalargumentexception: index unknown or not configured: search @ com.google.common.base.preconditions.checkargument(preconditions.java:119) @ com.thinkaurelius.titan.graphdb.database.indexserializer.supports(indexserializer.java:73) @ com.thinkaurelius.titan.graphdb.types.standardkeymaker.make(standardkeymaker.java:149) @ com.thinkaurelius.titan.example.graphofthegodsfactory.load(graphofthegodsfactory.java:52) ...

php - on click post thumb nail redirect to another site -

this code <a href="`<?php the_content(); ?>`" title="<?php the_title();?>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail('thumbnail'); }?></a> on clicking post thumbnail want redirect site have given link in content in link of content cannot figure out so, can help?? thank you!! try one <a href="<?php echo the_content(); ?>" title="<?php echo the_title();?>"> <?php if ( has_post_thumbnail() ) { echo the_post_thumbnail('thumbnail'); }?> </a>

android - SQlite Database NullPointerException when inserting data when button in dialog is clicked -

i have been working on creating , inserting data in table. have dialog box expandable list. user selects few things , clicks done; calls class creates table , insert data. the flow of program : mainactivity -> oncreate (added adapters, make dialog expandable list) -> onresume -> callasync -> doinbackground (dao instance, instance.open, dostuff, instance.close). dao constructor -> (helper instance); dao open -> (db = helper.getwritabledatabase()) helper oncreate -> execsql commands -> tables (db) constructor -> tables made s dialog -> makestuff -> onclick -> (calculate array used make table) -> tables(array) constructor -> error here showing npe. i have pushed current files github . after oncreate method of helper completed, database closed? dont see other reason database showing null pointer exception. working till last night before adding table_ncup. logcat 04-14 10:12:26.654: e/androidruntime(2560): fatal excep...

java - Define global contants in velocity -

vm_global_library.vm file used defining global macros available in templates. i tried defining variable in file hoping become available in templates: #set( $size_limit = 100) however doesn't work , $size_limit prints literal. how can define variable available in templates? there global version of org.apache.velocity.velocitycontext ?

vb.net - How to open a new windows form by clicking on a listview item -

as title said want open new specif window each item clicked in listview contents page. code have far is... private sub lvlesson_doubleclick(sender object, e eventargs) handles lvlesson.doubleclick if lvlesson.fullrowselect.tostring = "lesson 4" messagebox.show("hello") end if end sub the messagebox test. have 4 items lesson 1, 2, 3, 4 want click on 1 or 2 etc , open form 1 or 2 etc. the documentation friend. fullrowselect boolean property indicating whether full row selected or not when item clicked. you want selecteditems property. gives access items of listview selected. for example: private sub listview1_doubleclick(sender object, e eventargs) handles listview1.doubleclick 'check have selected if listview1.selecteditems.count > 0 'find out items selected , open appropriate form select case listview1.selecteditems(0).text case "lesson 1" messagebox...

c# 4.0 - Excel files and Doc files support in Windows Phone Emulator -

i using windows phone 8, visual studio 2013, here getting excel files , doc files response. these files supported in emulator? want show them in user interface. thanks!! this code: void somemethod() { uri uri = new uri("https://www.abc.com/def/xyz"); webclient wc = new webclient(); wc.downloadstringasync(uri); wc.downloadstringcompleted += wc_downloadstringcompleted; } void wc_downloadstringcompleted(object sender, downloadstringcompletedeventargs e) { string result = e.result.tostring(); messagebox.show(result); } use launcher.launchfileasync(istoragefile) open excel file using phones default excel app.

.net - Download files and folders from FTP -

i needed download files ftp using vb.net. found solution problem on here . the problem code helps me download files parent folder if there sub-folders, remain untouched. there work-around it? regards the codeproject ftp library using isnt great recursive access. check out answer here . c# answers question. can (almost) convert c# vb.net!

objective c - Using Value in Whole App and Manupulate That Value -

i want ask question app let me explain you.my app one. ok i'm giving example. @ first have super value 350 ( value should use 1 time ) when wrote 100 text field , clicked done remain score 350 - 100 = 250 while not closing app wrote text field again diffirent number 85 , clicked done remain score 250 - 85 = 165 and third of course not closing app , again wrote text field number 50 , clicked done remain score 165 - 50 = 115 this continue want create. in app İn app going this... when wrote 100 text field , clicked done remain score 350 - 100 = 250 while not closing app wrote text field again different number 85 , clicked done remain score 350 - 85 = 265 and third of course not closing app , again wrote text field number 50 , clicked done remain score 350 - 50 = 50 this continue this. wrote code. bascily int playerscore = [_txt_score.text intvalue]; int gamescore = 501; int currentscore = gamescore - playerscore; when clic...

facebook - FQL equivalent to Graph API pagination -

i know limit option of fql. need same functionality graph api returns <= number of results spcified limit parameter if there more results there links these results "paging": { "previous": "https://graph.facebook.com/chickfila/posts?limit=5&since=1298995597", "next": "https://graph.facebook.com/chickfila/posts?limit=5&until=1293899704" } can achieved using fql? in advance! with fql queries, won't "automated" pagination graph api. equivalent functionality since , until can build using relevant time-based fields of according tables in fql. you can have here introduction: https://developers.facebook.com/blog/post/478/ https://developers.facebook.com/docs/graph-api/using-graph-api/#paging

vbscript - WScript Sendkey doesn't accept Unicode Characters -

i trying send char "ä" using wscript sendkeys.seems not working . found 1 post does or can vbscript's sendkeys support unicode? my code: set sh = wscript.createobject("wscript.shell") sh.run "notepad.exe", 9 wscript.sleep 1000 'wait while load notepad app' sh.sendkeys " äää hello world!" //buggy line sh.sendkeys "{enter}" wscript.sleep 100' sh.sendkeys "^p" but unable understand solution. great if teach me in plain simple code (for solution). not @ wscript(as not area). know begging code(pz forgive me). plz understand situation. many in advance!! windows script host's sendkeys doesn't support unicode . alternatives wsh/sendkeys: use free tool autoit gui automation. can use autoit's send , controlsend or controlsettext commands automate text input. run('notepad.exe') winwaitactive("[class:notepad]", "", 10) controlsend("[class:notepad]...

javascript - No video with supported format and MIME type found in Firefox when print ( CTRL+P ) -

i have following code: <video width="320" height="240" controls> <source src="http://www.w3schools.com/html/movie.ogg" type="video/ogg"> browser not support video tag. </video> i opening html page in firefox. playing normally. trying print page using browser print (ctrl + p). in print print preview gives preview but, when print it giving " no video supported format , mime type found ". the same working fine in chrome. how print video preview in firefox? i think " no video supported format , mime type found " came default content of <video> tag. think u need store video image preview separately, call <img> dont display it. display when css @media print . well thats far know

php - I get a correct link from MYSQL but this link doesn't work in my Java code -

i got url of file, database on host, request. got string type. wrong. link doesn't want work in android app. error protocol not found: http://ksenia.url.ph/docs/krestny_otets.pdf code use class mytask extends asynctask<string, void, string> { @override protected void onpreexecute() { super.onpreexecute(); } protected string doinbackground(string... params) { try{ string link = "http://ksenia.url.ph/ksenia_login_api/include/loginget.php"; url url = new url(link); httpclient client = new defaulthttpclient(); httpget request = new httpget(); request.seturi(new uri(link)); httpresponse response = client.execute(request); bufferedreader in = new bufferedreader (new inputstreamreader(response.getentity().getcontent())); stringbuffer sb = new stringbuffer(""); string line=""; whil...

php - When parameter is not passed to controller over url -

in cakephp, i've controller should receive parameter , call model work database show result in view. pretty common mvc approach. imagine controller "insert new post" should associated specific user. so, url should be: http://mysite/inspost/(user_id). the problem is, when url http://mysite/inspost/ it show same view , insert new post if user_id has not been specified. how can control this? from 2 nd page of blog tutorial, adding layer : public function view($id = null) { if (!$id) { throw new notfoundexception(__('invalid post')); } $post = $this->post->findbyid($id); if (!$post) { throw new notfoundexception(__('invalid post')); } $this->set('post', $post); }

coffeescript - return value from a jquery get callback function -

it useful me if me fix function: textparsequery = (txtsnippet) -> queryurl = "http://localhost:8083/txtparse/#{txtsnippet}" console.log queryurl callback = (response) => parsed = $.parsejson response companies = parsed.map (obj) -> new company(obj.name, obj.addr) companies res = $.get queryurl, {}, callback console.log res i fetch results callback textparsequery function return value. the point of callback it's asynchronous, response comes in callback, need handle rest of execution callback (e.g., console.log res going execute before callback called, since it's part of same synchronous execution of ajax call). textparsequery = (txtsnippet) -> queryurl = "http://localhost:8083/txtparse/#{txtsnippet}" callback = (response) -> parsed = $.parsejson response companies = parsed.map (obj) -> new company(obj.name, obj.addr) # proceed here ...

How's the performance in php with a request sql with LIMIT in terms of RAM and time of execution -

i'm writing php script i'm facing little question, concrete difference between : $sql = "select * $table order date desc limit $limit offset $offset"; $result = mysql_query($sql) or die(mysql_error()); and : $sql = "select * $table order date desc"; $result = mysql_query($sql) or die(mysql_error()); in terms of ram , time of execution used in server ? edit: opting first sql request, precise need, have recheck amount of data php script build amount of data (smaller) cannot sql pure. (i use fetch_array in result until have amount want) want know (before wrong), solution faster client (sql + php) , solution more safier in terms of load server ? edit2 :re-paste order clause well, isn't answer obvious? if limit result set of select query, amount of data inside result set reduced. result of this, when looking @ phps memory usage depends on 1 central thing: if retrieve all of result set in single go, example using fetcha...

javascript - Auto updating an html/angular app in client side -

i'm building app using angular. app run on clients computer. when update there download zip file server , upgrade required files. i guess js , html incapable of copying , modifying files. our first idea run background application on os check updates , updates necessary. other approaches there achieve this? even if application offline, can still host it, use appcache or it. see post tutorial: http://www.sitepoint.com/creating-offline-html5-apps-with-appcache/

javascript - Reduce with higher-order callback parameter -

i have tried many ways parent parameter visible reduce's callback function must missing something... // static var y = [0, 1, 2, 3, 4, 5, 6, 7].reduce( function(arr, x){ arr.push(math.pow(2, x)); return arr},[]); console.log(y); // dynamic var lambda = function(arr, func) { return (function(f) { return arr.reduce(function(a, x) { a.push(f(x)); return a; }, [])})(func); } var y = lambda([0, 1, 2, 3, 4, 5, 6, 7],function(x){return math.pow(x);}); console.log(y); output: [1, 2, 4, 8, 16, 32, 64, 128] [nan, nan, nan, nan, nan, nan, nan, nan] demo @ jsfiddle you missing 1 of parameters math.pow . might wanna invoke lambda this var y = lambda([0, 1, 2, 3, 4, 5, 6, 7], function(x) { return math.pow(2, x); }); also, don't have complicate lambda construction iife. can simply var lambda = function(arr, func) { return arr.reduce(function(a, x) { a.push(func(x)); return a; }, []); } e...

regex - Inherited Null Pointer Exceptions (Java) -

in program writing have following code create regular expression word , retrieve words match series of different arraylists. public arraylist<string> solveword(string str) { string regex = ""; string[] strarr = str.split(""); (string temp : strarr) { if (temp.equals(" ")) { regex = regex + "[a-z]"; } else { string s = "[" + temp + "]"; regex = regex + s; } } int x = str.length(); arraylist<string> m = null; system.out.println("2ns"); switch (x) { case 1: break; case 2: m = let2; break; case 3: m = let3; break; case 4: m = let4; break; case 5: m = let5; break; case 6: m = let6; break; case 7: m = let7; break; case 8: m = let8; break; case...

java - Behaviour DataInputStream into mapping -

i had problems save file disk. path save, in environment, it's mapping (the disk in server). a - when try save datainputstream loop, reading "byte per byte", takes lot of time (~12 min / mb). b - now, read passing byte[8192] . solve problem. know b faster a but, when run same code, trying save local disk, there no difference, both take same time. why mapping takes lot of time? read byte[8192] @ time can cause problems? tks!

android - Disable loading spinner when listview content is loaded -

i have code listview: @override public void oncomplete(list<profile> friends) { // populate list list<string> values = new arraylist<string>(); (profile profile : friends) { //profile.getinstalled(); values.add(profile.getname()); } arrayadapter<string> friendslistadapter = new arrayadapter<string>(getapplicationcontext(), r.layout.list_items2, values); friendslistadapter.sort(new comparator<string>() { @override public int compare(string lhs, string rhs) { return lhs.compareto(rhs); } }); and custom spinner animation: <imageview android:id="@+id/imagespinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" andr...

jquery - Cycle2 showing previous div's background -

Image
i have problem cycle2. have 3 divs: first div has background image second div has youtube embedded video third div has nothing text no matter slide active, see first div 's background. so, problably wan't see code: <div id="slideshow"> <div class="cycle-slideshow" data-cycle-fx="scrollhorz" data-cycle-timeout="0" data-cycle-next="#next" data-cycle-prev="#prev" data-cycle-pager=".pager" data-cycle-slides="> div" data-cycle-youtube="true" data-cycle-youtube-autostart="false" data-cycle-auto-height="false"> <div class="">all content goes in divs here</div> </div> </div> a few screenshots: my little investigation told me sentinel div cycle2 creates, quick fix adding data-cycle-auto-height="false" appare...

web services - how to upload a file using multipart form data in android -

how use multipart-form data(@formdataparamdata) uploading file in android. trying upload image file android end multipart form data. here server script found @ server side: public image upload(@formdataparam("image") inputstream istream, @formdataparam("image") formdatabodypart body, @formdataparam("eventid") long eventid, @formdataparam("eventdescription") string eventdescription) throws imagewebserviceexception { // ...... } here client code tried uploading in android... client client = new client(); client.addfilter(new httpbasicauthfilter("user123", "******")); webresource webresource = client.resource(url); clientresponse response; formdatamultipart form = new formdatamultipart(); file file = new file("f:/android.png"); form.field("eventid", "1"); form.field("eventdescription", "password"); form.field("image...

To retrieve incoming notification details from whatsapp in android -

how can retrieve name, message , time incoming notification on "whatsapp". basically, want add incoming notification details in array list. please me explained code same. you trying catch 3rd party notification requires little more work. question might right track. how notified when notification notified

size - QT - Resize QToolbar -

i have concatenate toolbar. every toolbar have call: toolbar->setgeometry(x,y,width,height) but have no resize. i try call toolbar->updategeometry(); but nothing. my goal expand every toolbar size definition there chance using repositioning toolbars on init , saving @ closing. here solid way that: what need use qmainwindow savegeometry() , restoregeometry() functions , save , load byte array through qsettings interface. writesettings qsettings s; s.begingroup("mainwindow"); this->restoregeometry(s.value("geometry").tobytearray()); this->restorestate(s.value("windowstate").tobytearray()); s.endgroup(); readsettings qsettings s; s.begingroup("mainwindow"); s.setvalue("geometry", savegeometry()); s.setvalue("windowstate", savestate()); s.endgroup(); hope helps.

c++ - Vector of inherited classes -

i keep looking around fruitlessly solution this, i have number of classes inherit 1 base class: #ifndef navalvesselclass #define navalvesselclass #include <iostream> #include <string> class navalvessel { public: std::string name_; std::string type_; std::string operatingcountry_; std::string built_; std::string servicedate_; bool active_; double length_; double displacement_; double beam_; double draft_; double speed_; double range_; private: }; #endif and then, instance class inherits it: #ifndef destroyerclass #define destroyerclass #include "surfacecombatant.h" #include <string> class destroyer: public surfacecombatant { public: enum class armamentprimary { antiair, missile }; enum class armamentsecondary { torpedos, missile, antiair, antiground }; armamentprimary primaryarmament; armamentsecondary secondaryarmament; private: }; #endif now, when want stor...

varbinary - SSIS package email with attachments -

i'm building ssis package selects recordset of email data, loops through them, , emails them out through send mail tasks. have table emails, table addresses, , table attachments. right ssis package loops through emails table , each record populates variables body , subject. from there have foreach loop loops through address table , populates variables , cc properties of send mail task. from there have foreach loop loops through attachments table process address table. problem attachment data stored varbinary , cannot figure out how import ssis. there's no varbinary type , fileattachments property in ssis looking file path. there no variable data type can accept varbinary data.

c# - 'The type or namespace name 'ICloneable' could not be found' in win store app -

i developing windows store app , getting error of 'the type or namespace name 'icloneable' not found' . here code. public class discoveryitem : icloneable { private string _name = string.empty; private string _node = string.empty; private jabberid _jid; public discoveryitem() { } public discoveryitem(jabberid jid, string name, string node) { _jid = jid; _name = name; _node = node; } public object clone() { return new discoveryitem(_jid, _name, _node); } } windows store apps using own version of .net framework. there no icloneable windows store apps, see here . the recommendation of microsoft use instead is: a custom method returns appropriate type

javascript - Why is my json unable to be converted to a string? -

i have function gets remote json json believe poorly formatted can't use json.stringify method on it. think it's due apostrophe contained in of it. have no access sever. there way can parse , change json remote json pulled formatted correctly? this format now. var jsonst = {"shows":[{"show_id":6387, "shownum":6387,"title":"the protestant's dilemma","guest":"devin rose","category":"non-catholic","url":"http://www.catholic.com /radio/shows/the-protestants-dilemma-11565","audiourl":"http://www.catholic.com/sites /default/files/audio/radioshows/ca140331b.mp3","datetime":"1396317600","description":" devin rose grew militant's<\/p>","thumbnailsmall":"http://www.catholic.com/sites/default/files/imagecache/profile_square_small/images/profilepics/a109aad8daa70ad8976ffc.l._v387899120...

dropdown menu using HTML and CSS is giving me a headache -

<div class="fbtop"> <img src="https://static.solidshops.com/1441/files/logo-site.png" title="pieke wieke" alt="pieke wieke"> <h2 class="title">zelfgemaakt met liefde</h2> <ul class="dropdown"> <li> <a href="https://piekewieke-fb.solidshops.com/category/naaibenodigdheden">naaibenodigdheden</a> <ul class="sub_menu"> <li> <a href="https://piekewieke-fb.solidshops.com/category/naaibenodigdheden-allerlei">allerlei</a> </li> <li> <a href="https://piekewieke-fb.solidshops.com/category/naaibenodigdheden-spelden">spelden</a> </li> <li> <a href="https://piekewieke-fb.solidshops.com/category/naaibenodigdheden-naalden">naalden</a> </li> ...

android - Unable to start 'org.qtproject.example.testapp' -

i'm trying deploy qt5 application on android (samsung s4). compiles fine, while deploying stops on: starting debugger "qmlcppengine" abi "arm-linux-android-elf-32bit in application output got: unable start 'org.qtproject.example.testapp'. debugging has failed what can reason? while viewing logcat report found smth like: "failed dlopen(): somelib.so cannot find libqt5printsupport.so" by temporary excluding somlib.so project able run application.

cocoa - How to get the row in a NSTableView when rowAtPoint: doesn't reflect the partially visible top row? -

this result in nstableview top visible row visible: ====== rowatpoint: -> 0 rowatpoint: -> 0 ------ rowatpoint: -> 1 rowatpoint: -> 1 ------ but kind of result when nstableview in scroll position top visible row partially visible: ====== rowatpoint: -> 0 ------ rowatpoint: -> 0 should 1 rowatpoint: -> 1 ------ rowatpoint: -> 1 should 2 rowatpoint: -> 2 ------ am misunderstanding purpose of rowatpoint: ? -[nstableview rowatpoint:] works in coordinate system of table. guess you're using point relative enclosing nsclipview. use -[nsview convertpoint:fromview:] or similar method proper coordinate.

How to bring an image to the foreground in Java? -

i'm trying create pacman game in java, , far i've displayed background image (the blue , black maze), i'm having trouble showing image of pacman. when try display him in same method displayed background, doesn't appear unless manually alter size of jframe. , when appears there's small white square in bottom right corner of image. can fix this? there other way can insert pacman image in works? this code: jframe window = new jframe(); imageimplement pacman = new imageimplement(new imageicon("c:\\users\\16ayoubc\\desktop\\pacman-moving.gif").getimage()); imageimplement panel = new imageimplement(new imageicon("c:\\users\\16ayoubc\\desktop\\background.png").getimage()); pacman.setlocation(255, 255); pacman.setvisible(true); pacman.setopaque(true); window.add(pacman); window.add(panel); window.setvisible(true); window.setsize(576,655); window.setname("pacman"); window.setdefaultcloseoperation(jframe.exit_...

JavaScript if(x) vs if(x==true) -

in javascript , in cases following statements won't logically equal ? if(x){} and if(x==true){} thanks they not @ equal. if (x) checks if x truthy later checks if boolean value of x true . for example, var x = {}; if (x) { console.log("truthy"); } if (x == true) { console.log("equal true"); } not object, string (except empty string), number (except 0 (because 0 falsy) , 1 ) considered truthy, not equal true. as per ecma 5.1 standards , in if (x) , truthiness of x decided, per following table +-----------------------------------------------------------------------+ | argument type | result | |:--------------|------------------------------------------------------:| | undefined | false | |---------------|-------------------------------------------------------| | null | false ...

javascript - R web-scraping - hidden text in HTML -

i want scrape urls following page: http://www.europarl.europa.eu/meps/en/1186/seeall.html?type=cre&leg=5 there 180 urls collected page (each link speech given in parliament), running problems whenever there more 100 urls scraped, additional speeches accessible clicking on "see more" box @ bottom of page. i've tried figure out how reveal additional links think hidden "getmore" function, no luck! apologies naiveté here... my current code follows: read in page mep.speech.list.url <-"http://www.europarl.europa.eu/meps/en/1186/seeall.html?type=cre&leg=5" speech.list.data<-try(readlines(mep.speech.list.url),silent=true) find urls mep.speech.list<-speech.list.data mep.speech.lines<-grep("href",mep.speech.list) mep.speech.list<-mep.speech.list[mep.speech.lines] mep.speech.lines<-grep("target",mep.speech.list) mep.speech.list<-mep.speech.list[mep.speech.lines] mep.speech.list<-mep.speech.list...

tcl - Custom/Distributed documentation of changes with Doxygen -

i attempting following feature working doxygen. is possible, , how best this? we working existing tcl codebase came eda tool, lot of code gets 'sourced' , not organized in procedures. there numerous improvements/modifications have applied code base. example customization of form "allow feature x controlled new configuration variable y", , involves modifications made filea, fileb, , filec. i have doxygen parsing entire code base. besides standard language documentation looking extract list of customizations have made, including files modified (and approx line number), changes made in each file, capture of modified code each files, , pointer file listing , line number modification made. i expect require custom doxygen comments/tags in filea, fileb, , filec, , closest managed placing following @ each location modified in filea fileb , filec: ## # \page custom_mypage1 customization enabling control of x variable y # # test comment 1 # this allows colle...

"Unable to autoload constant" using rspec but not rails -

i've file test. app/workers/station/http.rb module worker module station class http # ... end end end this spec file. spec/workers/station/http_spec.rb describe worker::station::http "should something" end end the problem i'm getting following error when running spec file using rspec. rspec spec/workers/station/http_spec.rb /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:464:in `load_missing_constant': unable autoload constant station::http, expected app/workers/station/http.rb define (loaderror) /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:184:in `const_missing' spec/workers/station/http_spec.rb:3:in `<top (required)>' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:223:in `load' /users/linus/.rvm/gems/ruby-2.0.0-p247@gl...

redhat - Nautilus 2.16 - trash confirmation difference between filesystems -

apologies if question seems rather trivial, it's causing me frustration. i have redhat 5.3 installation, using nautilus-2.16.2-7.el5 has 2 filesystems mounted. under user1, when sending trash (pressing del) on filesystem receive confirmation dialogue box (do want etc). behaviour same on filesystem b. however, under user2, receive confirmation on del on filesystem a, not on filesystem b. i've tried renaming ~/.gconf/apps/nautilus folder , logging out/in reset nautilus settings, it's still behaving same. this leading users accidently deleting data, isn't great! any advice appreciated folks! d turns out creating new user profile , copying settings corrected problem (even though there nothing filesystem specific in gconf file). cp /home/new_username/.gconf/apps/nautilus/preferences/%gconf.xml /home/username/.gconf/apps/nautilus/preferences/

regex - Find/Match every similar words in word list in notepad++ -

i have word list in alphabetical order. it ranked column. i not use programming languages. the list in notepad format. i need match every similar words , take them on same line. i use regex can't achieve correct results. first list like: accept accepted accepts accepting calculate calculated calculates calculating fix fixed a list want: accept accepted accepts accepting calculate calculated calculates calculating fix fixed this seems work, have replace all multiple times: find (^(.+?)\s*?.*?)\r\2 , replace \1\t\2 . . matches newline should disabled. how works: it finds characters @ start of line ^(.+?) , linebreak \r , , same characters again \2 . \s*?.*? used skip unnecessary characters after multiple replace all . \s*? skips first whitespace, , .*? remaining chars on line. match replaced \1\t\2 , \1 matched in (^(.+?)\s*?.*?) , , \2 matched (.+?) . \t used insert tab character replace linebreak. how breaks: not...

asp.net mvc 4 - How to work with [Required] attribute & Model State Validation within Web Api Put -

currently facing, problem, when try call web api put method mvc api client, lets describe code structure bellow test model (web api end) public sealed class test { [required] public int id { get; set; } [required] public string name { get; set; } } web api put method public httpresponsemessage put(string token, ienumerable<test> data) { [...] return request.createresponse(httpstatuscode.ok); } web api custom filter public sealed class validatefilterattribute : actionfilterattribute { /// <summary> /// /// </summary> /// <param name="actioncontext"></param> public override void onactionexecuting(httpactioncontext actioncontext) { if (!actioncontext.modelstate.isvalid) { actioncontext.response = actioncontext.request.createerrorresponse( httpstatuscode.badrequest, ac...