Posts

Showing posts from February, 2012

javascript - How do I pass parameter to a `chrome.tabs.executeScript` in a chrome extension? -

this question has answer here: pass parameter content script injected using chrome.tabs.executescript() 2 answers when i'm getting message popup want execute script, simply: chrome.runtime.onmessage.addlistener(function(message, sender, response) { chrome.tabs.executescript({file: "content.js"}); }); my problem: content.js needs data message . how pass it? try chrome.runtime.onmessage.addlistener(function(message, sender, response) { chrome.tabs.executescript({code: paramname=paramvalue},function() { chrome.tabs.executescript({file: "content.js"}); }); }); they both injected same isolated world, content.js can refer same variables.

jquery - form to json in specific output in javascript -

i have form like: <form> <div id="studentlist"> <div class="studentrow"> <input name="first" type="text" placeholder="first name"> <input name="last" type="text" placeholder="last name"> </div> <div class="studentrow"> <input name="first" type="text" placeholder="first name"> <input name="last" type="text" placeholder="last name"> </div> <div class="studentrow"> <input name="first" type="text" placeholder="first name"> <input name="last" type="text" placeholder="last name"> </div> </div> <input id="send" value="submit" type

php - Two IF statements and join MYSQL -

i`ve been trying make dayplanner meeting room. have 2 tables: 1) dayplanner : day split in 5 minute intervals values=00:00:00,00:05:00,00:10:00 ... 23:55:00 2) reservations : name, start , finish values=[john,12:00:00,12:30:00],[bob,14:00:00,14:45:00],etc my goal use 1 query 2 if statements can check starttime , lies in between like this: [time] [reserved] [inbetween] 12:00:00 true true 12:05:00 true true ............................ 12:35:00 false false $query = "select *, if(d.dayplanner_time = a.reservations_starttime,'true','false') reserved, if(d.dayplanner_time > a.reservations_start && d.dayplanner_time < a.reservations_finish,'true','false') inbetween dayplanner d left join reservations on d.day_time = a.reservations_start or d.dayplanner_time = a.reservations_finish d.dayplanner_time between '12:00:00' , '18:00:

gradle - Copy files over before jarring -

i can't script wait until libraries copied on 'src/main/resources/libs' before starts jar everything. files copied on jar task think not waiting until files copied over? because not added jar. unless run script again :/ how fix this? task copydependencies(type: copy) { configurations.mylib 'src/main/resources/libs' } jar.dependson 'copydependencies' jar { manifest {} } to execution order right, processresources have depend on copydependencies . however, shouldn't copy src/main/resources . instead, libraries should included directly in jar, without intermediate steps: jar { into("libs") { configurations.mylib } } this assumes there custom process or class loader in place makes use of libraries in jar's libs directory. standard jvm/class loader ignore them.

security - Python: can I safely unpickle untrusted data? -

the pickle module documentation says right @ beginning: warning : pickle module not intended secure against erroneous or maliciously constructed data. never unpickle data received untrusted or unauthenticated source. however, further down under restricting globals seems describe way make unpickling data safe using whitelist of allowed objects. does mean can safely unpickle untrusted data if use restrictedunpickler allows "elementary" types, or there additional security issues not addressed method? if there are, there way make unpickling safe (obviously @ cost of not being able unpickle every stream)? with "elementary types" mean precisely following: bool str , bytes , bytearray int , float , complex tuple , list , dict , set , frozenset i'd go far saying there no safe way use pickle handle untrusted data. even restricted globals, dynamic nature of python such determined hacker still has chance of finding way __builtin

linux - tc-sfq alternative that limits by bytes? -

is there alternative tc-sfq (stochastic fairness queueing) allows configure limit based on packet size (total bytes) instead of packet count? the reason given packet size of 50 bytes, 1 htb class (rate=1000kbit) example dequeue 25 packets per 10ms, packet size of 1500 bytes 0.83 packets per 10ms. if set tc-sfq limit 25 packets, in worst case full queue take 300ms empty. -- this on linux 3.0.101, fq_codel doesn't work afaik. maybe has patch replaces sfq packet limit byte limit (similar pfifo vs. bfifo)? here's did: backported few changes kernel tree linux 3.0 sfq. since commit ddecf0... there backlog counter maintained each slot. needed change use depth parameter ( sfq_sched_data.maxdepth ) max backlog bytes : drop packet if slot->backlog >= q->maxdepth in enqueue function. with rate of 1000kbit can set depth 3750, means slot takes max 30ms empty. 2 large packets 1500 bytes each or 25 small ones 150 bytes each.

Android avatar creation without using game engine -

what best way 2d avatar creator without using game engine (ie. unity)? the avatar images basic body , placing different images different body parts - head, body, legs, arms, etc. layer different images on top of base image. can achieved in regular android app without using sort of game engine? there libraries done? for 2d avatar creator, using game engine job seems overkill (a library might well). coding scratch simpler having deal bunch of unnecessary tools @ end of day take space. also, more efficient, code bits need. because want make app android, i'd recommed doing using official android sdk . includes eclipse (a nice ide popular) no need worry on else download. sdk requires use java (if haven't learned language yet so. it's best , language you'll need know).

repository - How do I delete a forked GitHub repo that's unavailable due to DCMA takedown? -

does know how delete forked github repo that's been subject dcma takedown? repo there (with dcma banner) can't it. i've tried clicking 'settings' tab nothing happens. you can not delete repository on own. had fork that's been subject dcma takedown. send mail @ github contact , requested delete repository. after 2 days, repository deleted. you can check github article on dcma takedown policy .

ios - How to detect if a link, inside a UITextView has been clicked, Swift -

i have implemented think function uitextviewdelegate, deals urls being tapped in uitextview, functions being called in code. this function have used delegate. func textview(textview: uitextview!, shouldinteractwithurl url: nsurl!, inrange characterrange: nsrange) -> bool { println("link selected!") } however have used breakpoints , code isn't being accessed @ runtime? correct function or there alternative? you need make sure class implementing delegate protocol set delegate uitextview . self.textview.delegate = self

"Installation of apps is prohibited by a policy on the device." error when running an Xcode 6 app on an iPad (iOS 8) -

Image
i've been developing app on iphone , today upgraded our ipad ios 8 test app on it. xcode gave me following error, though: any ideas causing error? 1)try checking restrictions in device settings. 2)check link: http://osxdaily.com/2012/02/15/disable-app-installation-ios/ regards,

cytoscape.js - Cytoscape graph builder (drag-and-drop new nodes) -

i looking use cytoscape.js build interactive web based graph builder. possible handle drop event create new node or link? if not, options, if exist interactive graph building using api? looks may able use click event or radial menu plugin i'm interested in other options. there examples out there of doing this? cytoscape.js has extension api can used create reusable components suggest. there several existing extensions can use in addition documentation examples. it seems has made a similar extension , it’s straightfoward create own using of documented api functions . we’re working streamline extension writing , submission process it’s easier share extensions others in v2.3.

java - Adding scrollbar to FlowLayout -

i adding scrollbar jpanel flowlayout impossible, don't see scrollbar. i've tried thousand different ways have not accomplished anything. new java , have yet many failures please kind. here code: //creamos el panel que contendra los botones de cada producto diferente package com.foolsrecords.tpv.tablaproductos.vista; //hacemos todas las importaciones necesarias import com.foolsrecords.tpv.modelo.producto; import com.foolsrecords.tpv.modelo.eventos.controladoreventlistener; import com.foolsrecords.tpv.modelo.eventos.productoseleccionadolistener; import com.foolsrecords.tpv.servicios.servicioitemventa; import com.foolsrecords.tpv.servicios.servicioproducto; import com.foolsrecords.tpv.vista.componentes.jproductobutton; import java.awt.color; import java.awt.image; import java.util.hashmap; import java.util.list; import java.util.map; import javax.swing.swingconstants; import javax.swing.uimanager; //creamos la clase principal public class tablaproductos extends javax

C - Is this the right way to use strtok in the following situation -

if have string contains 10x15. , want separate 10 , 15. following code correct. concerned second part of code, putting "null" there right thing do. char * stringsixrows = strtok(stringsix[0], "x"); char * stringsixcollumns = strtok(null, "null"); //i put second null there cause end of string, im not sure if right though. i'd "canonical" way obtain "pointer remaining string" is: strtok(null, "") strtok searches any of delimiters in provided string, if don't provide delimiters, cannot find , stops @ end of input string.

python - Class keeps repeating itself, despite having a 'return' statement for the next class -

this first attempt @ learning programming language... ok, i'm working on exercise 45 of learn python hard way, trying create text-based game. i've had few roadblocks far, 1 far frustrating. have borrowed (and tweaked) author's code previous exercise, allowed use of 1 function, enter(), per class, want use five. this, tried implement try/exception tree run additional functions if there, , if not, move on next classs. what happens is, first class, introscreen(), runs fine, points bedroom() fine, , bedroom repeats on , on again, though have command return kitchen(), next class. i have added #comment# in code below show think it's messing up. if know how fix this, please help; or, better, if have better way of doing fantastic. i've been told looks kinda screwy. i can provide entire code if helps; please, me out! class map(scene): scenes = { 'introscreen': introscreen(), 'bedroom': bedroom(), 'kitchen':

angularjs - Javascript: how to include a string literal into another one? -

say we've got tag follows: <div ng-init="html='<a ng-click=\'openpopover(\'#choixdeladensiterecherche\')\'>click</a>'"></div> (i need set variables html code) this doesn't work. how write escaping innermost simple quotes? ps: don't know why \" \" didn't worked either. [edit 1] lecture error: [error] error: [$parse:lexerr] lexer error: unexpected next character @ columns 12-12 [] in expression [openpopover(]. try &quot; , example : <div onclick="alert('<a ng-click=&quot;openpopover(\'#choixdeladensiterecherche\')&quot;>click</a>')">aaaaa</div>

SQL Server Express edition - read-only database? -

i'm having strange problem fresh install have of sql server 2008 express edition (yeah it's bit old now, whatever). when connect via sql server management studio, can both read , edit data (update or insert), when connect via web application's data access layer, uses sqlconnection , sqlcommand try , update , insert data in tables, no changes occur in database. strange thing code runs if no error had occurred though; no exceptions thrown, , update statement causes sqlcommand.executenonquery return 1, indicating supposedly 1 row has been updated. however, hasn't. application can, however, read data database via select statements. does have idea what's going on here? tried tracing sql server using expressprofiler , , output seemed indicate update should have occurred: exec sp_executesql n'update match set ticketssold=@ticketssold matchid=@matchid',n'@matchid int,@ticketssold int',@matchid=1,@ticketssold=1234 go yet ticketssold stays

c# - How to prevent GUI from locking up during operation? -

here code: private void runcoinflip() { togglecontrolsusability(); task task = new task(coinflippinganimation); task.start(); task.wait(); togglecontrolsusability(); flipoutcome = piccoin.image == coinsideimages[0] ? coinsides.heads : coinsides.tails; lblresult.text = userguess == flipoutcome ? "congrats won!" : "too bad lost."; } private void togglecontrolsusability() { btnheads.enabled = !btnheads.enabled; btntails.enabled = !btntails.enabled; } private void coinflippinganimation() { random rng = new random(); (int = 0; < 15; i++) { int side = rng.next(0, coinsideimages.length); piccoin.image = coinsideimages[side]; thread.sleep(100); } } basically, buttons should frozen during operation , unfrozen afterwards, , coin flipping animation flips coin. unfortunately, gui locked during animation can't move window or resize. i've been reading async , await i'm not

javascript - How to get the original native browser objects, if they have changed? -

actually whole issue. kind of anti-monkey patching. how original objects (object, array, function, string, etc) , prototypes, if have changed \ expanded \ deleted? the option see - dynamic creation of frame - pulling out of native objects - remove frame on fly. perhaps same can done web workers. ie> 9, in there no classes dom, , same way dynamic frame. example frame delete object.prototype.constructor; delete object; console.log(window.__proto__.__proto__.__proto__.constructor); // undefined // console.log(object); // undefined var frame = document.createelement('frame'); document.all[0].appendchild(frame); var object = frames[0].object; document.all[0].removechild(frame); console.log(object); this theoretical question. example, developing embedded library, , can not know when called, time invoked native browser objects can changed. need original objects, initial environment. maybe there other ways solve? thanks in advance. before posting answer,

python - UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 7: ordinal not in range(128) -

i guess error coming fact xml file in utf-8, python wants handle ascii? have parsed xml correctly when try print contents of xml error because there foreign unicode characters. can try fix code below? may encode unicode string ascii? thanks!! import xml.etree.elementtree et import sys if __name__ == '__main__': tree = et.parse('/downloads/sample.xml') root = tree.getroot() a=[] child in root.iter(): if child.tag == "author": a.append(child.text) if child.tag == "title": name in a: print "%s\t%s" % (name, child.text) a=[]

php - How to create a login module with two user levels in Yii -

i make login page 2 different user levels, doctor & parent. how can in yii.... two tables listed below....for both users email address username. create table doctor ( doctor_email varchar(50), password varchar(50), doctor_name varchar(50), doctor_phone int(10), speciality varchar(200), primary key ( doctor_email ) ); create table parent ( parent_email varchar(50), parent_name varchar(50), password varchar(20), parent_address varchar(100), parent_phone int(10), primary key ( parent_email ) ); this authenticate() function in useridentity.php public function authenticate() { $record1 = doctor::model()->findbyattributes(array('doctor_email' => $this->username)); $record2 = parents::model()->findbyattributes(array('parent_email' => $this->username)); if ($record1 !== null) { if ($record1->password == $this->password) { $this->errorcode = self::error_none;

semantic web - how to find the most specific class for an individual with pellet+owlapi -

i want perform classification ontology , pellet reasoner. pellet has function(namely realization()) find specific individual. have tried doesn't work, provide or give me examples. <class rdf:about="http://webmind.dico.unimi.it/care/locont.owl#havingdrink"> <equivalentclass> <class> <intersectionof rdf:parsetype="collection"> <rdf:description rdf:about="http://webmind.dico.unimi.it/care/locont.owl#personalactivity"/> <restriction> <onproperty rdf:resource="http://webmind.dico.unimi.it/care/locont.owl#hasactor"/> <allvaluesfrom> <class> <intersectionof rdf:parsetype="collection"> <rdf:description rdf:about="http://webmind.dico.unimi.it/care/locont.owl#person"/>

javascript - How can I open a tab next to the activeTab from a Safari extension? -

i want open tab using tabs , windows api, so... var newtab = safari.application.activebrowserwindow.opentab(); newtab.url = blahurl; ...such new tab appears next visible tab. there method this, requires index. there not seem way current tab's index. have loop through , find index value of active tab? i want sure opens new tab instead of window. if use javascript method open new tab, may open new window based on user settings, correct? to index of active tab, can use safari.application.activebrowserwindow.tabs.indexof(safari.application.activebrowserwindow.activetab) if use opentab method of safari browser window object, it's guaranteed open tab , not window.

sbt - Why does the build insist on looking for Scala 2.10 version of dependencies? -

i have root build.sbt file looks this: organization := "com.acme.foo" name := "foo-parent" version := "1.0-snapshot" scalaversion := "2.11.2" scalacoptions := seq("-unchecked", "-deprecation", "-encoding", "utf8") resolvers ++= seq( "spray repo" @ "http://repo.spray.io/" ) lazy val root = project.dependson(rest,backend) lazy val rest = project lazy val backend = project.dependson(rest).settings(mainclass in (compile, run) := some("com.acme.foo.main"), fork in run := true) run in compile <<= (run in compile in backend) in both backend , rest modules scalaversion set 2.11.2 , keep getting error when try compile root: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: unresolved dependencies :: [warn] :::::::::::::::::::::::::

sorting - iOS coredata sort descriptor using part of a date? -

in app, have table view shows person's activities on time. want sort data day, first name. problem is, need store nsdate time included other reasons. right now, have this: august 18, 2014 11:02 bill b. august 18, 2014 10:20 john d. august 18, 2014 10:05 adam s. august 11, 2014 3:47 pm debbie b. august 11, 2014 2:13 pm adam s. i sort ignore time , evaluate date. this: august 18, 2014 adam s. august 18, 2014 bill b. august 18, 2014 john d. august 11, 2014 adam s. august 11, 2014 debbie b. is possible construct sort descriptor looks @ month, day & year of core data date attribute? i use additional attribute sortdate . calculate attribute in setter of startdate (or call date attribute) of object. that's fastest way if store more few objects in core data. use transient property , calculate value in getter, has quite impact on performance. i use in 1 of apps: - (void)setstartdate:(nsdate *)startdate { [self willchangevalueforkey:@&

asynchronous - Building async web apps with playframework -

actually question not targeting play framework, general question async programming. i know in play, can use: ws.url(url).get() to make rest call async return promise/future. (i guess might supported underlying nio library netty or spray.io) so, question is: build async web application, every i/o bound operation has better async, right? otherwise, bottle neck? let's have simple web application calls jdbc , return query value browser. in case, suppose don't have async/reactive jdbc driver, play2 performs better servlet solution?

sql - when do you prefer to use non clustered index over clustered index? -

i've knowledge of using clustered index , non clustered index, i'm not sure when , on conditions helpful use non clustered index on clustered index. can explain or provide links helpful of us. pick clustered index! every "regular" data table ought have clustered index, since having clustered index indeed speed lot of operations - yes, speed up , inserts , deletes! if pick good clustered index. it's most replicated data structure in sql server database. clustering key part of each , every non-clustered index on table, too. you should use extreme care when picking clustering key - should be: narrow (4 bytes ideal) unique (it's "row pointer" after all. if don't make unique sql server in background, costing couple of bytes each entry times number of rows , number of nonclustered indices have - can costly!) static (never change - if possible) ideally ever-increasing won't end horrible index fragmentation (a guid total

linux - Unix Skipping first line if empty -

i have script running take input text file, take last column after skipping first 12 lines, output them in text file. for (( r=1; r<5; r++)); awk 'nr>12' imsi$r.txt | awk '{print $nf "\r"}' > n$x awk 'nr>12' imsi$r.txt | awk '{print $nf "\r"}' >> out x=$(($x+1)) done my problem sometimes, first line in file empty , i'll have skip it. so code become like for (( r=1; r<5; r++)); %if (line1 empty) delete line , overwrite new file awk 'nr>12' imsi$r.txt | awk '{print $nf "\r"}' > n$x awk 'nr>12' imsi$r.txt | awk '{print $nf "\r"}' >> out x=$(($x+1)) done i tried : if [ ${line:-null} = null ]; awk 'nr>1' is correct ? , how can overwrite on imsi$r.txt , without getting empty file ? thanks guys. edit: an example requested: text1.txt: 1 xxx 123 2 yyy 123 3 zzz 123 so outp

android - GPS toggle editing AOSP -

i want toggle gps without going android settings intents etc . have tried these methods none of them worked : how can enable or disable gps programmatically on android? toggle gps on root devices on android so far understood , there no way doing . asking , possible approach editing custom rom or aosp ? , if possible can or other ideas ? you can if edit aosp. don't think need go far. use settings.secure.setlocationproviderenabled(context.getcontentresolver(), provider, true); , write system app , should able it. description of how install app system app can found @ http://www.addictivetips.com/mobile/how-to-install-any-app-as-system-app-on-android/ . add write_secure_settings permission manifest , you're good.

android - Handling onOptionsItemSelected for both Navigation drawer and Action buttons -

i have navigation drawer in 1 of activities in android. have added couple of action buttons , action overflow action bar in same activity. now, problem handling select event navigation drawer items, action buttons, , action overflow menu. currently, setoptionsitemselected looks this: @override public boolean onoptionsitemselected(menuitem item) { if (mdrawertoggle.onoptionsitemselected(item)) { return true; } return super.onoptionsitemselected(item); } how can make work navigation item clicks, action button clicks, , action overflow menu clicks? appreciated. if ur xml file contains listview shown below u need findviewbyid listview in navigation drawer activity , set setitemselectlistener... don't know how have u implemented , designed ur navigation drawer ..so if doesnt please share ur code.. there no relationship , dependency between actionbar , navigationdrawer <android.support.v4.widget.drawerlayout xmlns:android="http://

java - Ant: javac cannot find class even though it's in the classpath -

our build.xml file contains following: <path id="our.classpath"> <fileset dir="${in.libs}"/> <fileset file="/home/ouruser/fortify/core/lib/sourceanalyzer.jar"/> </path> <target name="compile"> <pathconvert property="test" refid="our.classpath"/> <echo message="classpath=${test}"/> <javac debug="true" debuglevel="source,lines,vars" destdir="${out.classes}" includeantruntime="no" fork="false" source="1.7" target="1.7"> <src path="${src1.dir}"/> <src path="${src2.dir}"/> <classpath refid="our.classpath"/> <compilerarg value="-xlint:-path"/> <compilerarg line="-proc:none"/> <compilerarg line=&qu

A variable sended from Ajax dissapears when entering directly to the PHP File -

i'm sending variable php via ajax. the ajax triggered when keyup detected. once keyup detected, catch value , name txtbx of keyup. then, create request sends value , name of textbox triggered event. in onreadystatechange launch function verify if ajax on, , if status 200 function retrieves me values of variables send, getting via echo of php side. all ok till. till go directly php page , variable sended client dissapear. why, in moment of ajax mean when catch data/send/retrieve goes ok when go directly php, variable seems dissapear , pretty nice notice: undefined variable?. here i'm sending code (it's spanish): client side ajax request: window.addeventlistener("load", iniciareventos, false); clase=""; function iniciareventos(e) { var cajas = document.getelementsbyclassname(clase); (var = 0; < cajas.length; i++) { cajas[i].addeventlistener('keyup',obtenerdatos,false); } } function obtenerdatos(e) {

jquery - Can't get one div to show and the rest to hide using buttons -

Image
i have 4 buttons , able click them see div , no others. have seen lot of solutions don't seem working buttons rather links. need buttons fade affect (or @ least, that's way make fade work correctly...) here's html. parent class formatting , below buttons. want l1 go div1 , 1 basically. <div class="parent"> <div id="div1" style="display:none;">about me content</div> <div id="div2" style="display:none;">about me content</div> </div> <div class="up"> <pre> <a href="http://www.brynntweeddale.com/"><img src="http://www.brynntweeddale.com/images/logo.png" style="width: 123px; height: 60px; vertical-align: middle;" /></a><button id="l1" onclick="fade(this);">about</button><button id="l2" onclick="fade(this);">photography</button><button id=" l

php - What permissions do I need to get Facebook to display user submitted photos in a Page's feed through Graph? -

i have script checks client's facebook page user-submitted photos. working fine until last week, though noticed problem today. until then, accessing page's feed via graph include posts. now, photo posts appear ones done page admin. code has not changed in 2 weeks figure there has have been changed on over fb's side. has there been new permission should add? the posts missing if try using graph explorer. $fql_query = 'https://graph.facebook.com/' . $pageid . '/feed?limit=50&access_token=' . $access_token;

php - Not able to edit contents in magento from backend after a installing modules -

i have site build in magento 1.7 i have installed new shipping module bpost through magento connect. when installed that, raised error that, existing plugin. after when accessed site, maintenance flag active. when removed maintenance flag , checked site, seems working fine in front-end. not able add or edit contents back-end. click not detecting in existing lists of contents , when click on add new (for cms block, page etc) new section appears, no action performed while clicking save. why happening ? how can resolve issue ? i recreated site backup files new location. after removed existing plugins , installed plugins. @ time seems working fine. after have edited header.phtml file , added additional script. the script getting contents , displaying using script. after when run site , went backend again went non editable mode. not able click or edit cms contents in site of static blocks, products etc. why happening ? how can resolve issue ? in opinion, problem com

Text bleeding out of page in knitr using latex -

i using following code snippet write text data frame table. temp<-c("a white paper document describes given problem , proposes specific solution problem.", "originally used describe government policy, white papers common today in corporate settings.", "a typical white paper might list ways meet client's marketing needs, suggest use of product technical process, or identify ways streamline internal communication.") mytable<-as.data.frame(temp) mytable<-print.xtable(xtable(textdata,caption="some text data"),caption.placement="top",print.results="f", tabular.environment="tabularx", width="\\textwidth") the table border limited page, text still bleeds out. how text come within table limits?

pointers - I am unable to determine why this C program gives me this answer -

unable know why output 6? in given c program getting output 6 every time, can't printing garbage value #include<stdio.h> void main() { int const* a=2; printf("%d\n",++(a)); } i unable determine why c program gives me answer. this quite easy debug see going on here. run piece of code , @ values: #include<stdio.h> int main() { int const* a=2; printf("size of int %d\n", sizeof(int)); printf("size of int const* %d\n", sizeof(int const*)); printf("size of %d\n", sizeof(a)); printf("not incremented %d\n", a); printf("incremented %d\n",++(a)); return 0; } i output: size of int 4 size of int const* 8 size of 8 not incremented 2 incremented 6 on 64-bit machine. demonstrates when '++(a)' adding 2 size of int. why should case when declared int const* a=2; ? well, because adding 2 size of pointer type rather size of pointer. change to: lo

database - prime to prime transitivity in 3nf normal form -

i stuck in question. should answer this: the relation scheme student performance (name, courseno, rolino, grade) has following functional dependencies: name, courseno, -> grade rolino, courseno -> grade name -> rolino rolino -> name the highest normal form of relation scheme is (a) 2 nf (b) 3 nf (c) bcnf (d) 4 nf relation has 2 overlapping candidate-key dependencies in 3nf.

c# - Unified communication -

i wondering how should set interprocess unified communication in better way now. client process sends lot of messages of different sort server process. messages like... have done work[what],i started @ [time], ended at[time]. or state, progress command messages. example message: from:process1;startedat|12:12:12;endedat|12:45:56;doneunit:51 server parser split string semicolon. first part reads message sent. second , third part reads times , last how work did. when add info @ end of message ex. from:process1;startedat|12:12:12;endedat|12:45:56;doneunit:51;source:tablet have rewrite server parser well. server tries parse received message using own parse function. every message has own format. parser know how should message look. if change format on client have change on server well. not seems efficient way. for reason ask question. how should communication better or there different approach how store format client , server on 1 place? i use c# .net 3.5(must version) th

c# - Response.Redirect won't send me to next page -

i ran big problem here dont know in anymore. before added login system response.redirect worked charm. know login works fine ran debug on , files works fine , goes on should. edit 1: noticed if commentate master.userlogin(arr); out default btnlogin_click , type server.transfer(@"~\admin\side.aspx"); works again dont see why making session stop response? edit 2: okay seems has site.master.cs create session varriabler , after tries redirect page. how fix this? default.aspx.cs protected void btnlogin_click(object sender, eventargs e) { db.connopenhelpdesk(); if (db.helpdeskdblogin(txtbrugernavn.text, txtpassword.text).count() == 8) { if (db.helpdeskdblogin(txtbrugernavn.text, txtpassword.text)[7] == "2" || db.helpdeskdblogin(txtbrugernavn.text, txtpassword.text)[7] == "1") { master.userlogin(db.helpdeskdblogin(txtbrugernavn.text, txtpassword.text)); } } else { db.connclosehelpdesk

javascript - Wait for page to load when navigating back in jquery mobile -

i have single-page web app built jquery mobile. after user completes action, want programmatically bring them menu page, involves going in history , performing actions on elements of menu page. simply doing window.history.go(-1); //or $.mobile.back(); dosomethingwith(menupageelement); doesn't work, because going-back action asynchronous, i.e. need way of waiting page load before calling dosomethingwith() . i ended using window.settimeout(), i'm wondering if there's not easier way (different pattern?) in jqm. 1 other option listen pageload events, find worse code organization point of view. (edit: turns out native js promises not supported on mobile safari; need substitute 3rd-party library) //promisify window.history.go() function go(steps, targetelement) { return new promise(function(resolve, reject) { window.history.go(steps); waituntilelementvisible(targetelement); //wait until element visible on page (i.e. page has loaded)

Unix run a script with -help option -

i have below script expected work when user invokes sh <scriptname> <propertyfile> work when provide @ dollar prompt. however, having 2 issues script. if provide 1 argument, ie if - sh <scriptname> , see below error - my-llt-utvsg$ sh temp.sh usage temp.sh when -help, see below error - my-llt-utvsg$ sh tmp.sh -help -help not exist what doing wrong? can please advise? software developer needs shell scripting, please go easy on me ;) #!/bin/bash file="system.properties" file=$1 if [ ! -f $file ]; echo "$file not exist" exit fi usage () { echo "usage $0 $file" exit } if [ "$#" -ne 1 ] usage fi if [ "$1" = "-help" ] ; echo "" echo '############ properties ############ ' echo "" echo 'blah.' exit the reason if [ "$1" = "-help" ] ; check not working checks $1 or first argument. try instead: for var in "$@&q

How to use Metronic on Wordpress(bootstrap theme) -

metronic has lot of plugings in assets/global/plugins non of them wordpress plugins. how can use metronic on wordpress installation? thank help. julia simply, can't. of course, if know php/html/jquery/css, can re-work wordpress plugin.

c++ - Is holding a reference to another object as a member safe in this case? -

i have few classes, each depends on using instance of object in dependency chain. looks this: class {} ; class b { a& m_a; public: b(a& a) : m_a(a) { } }; class c { b& m_b; public: c(b& b) : m_b(b) { } }; to protect myself holding dangling references because of order of destruction, i'm holding of these in container class, this: struct data { data() : m_b(m_a), m_c(m_b) { } m_a; b m_b; c m_c; }; assuming order of members in class data matches dependency order, safe so? there pitfalls in holding these references i'm missing? it's ok. class-members initialized in order, in declared, so: m_a initialized -> m_b initialized reference m_a -> m_c initialized reference m_b .

ios - Disable swipe gesture in UIPageViewController -

i have 3 viewcontrollers in 1 viewcontroller viewpagercontroller = self -> viewcontroller , has uipageviewcontroller init programquestionviewcontroller = based viewpagercontroller questionviewcontroller = content view shown in middle of programviewcontroller this viewpagercontroller @interface viewpagercontroller () <uipageviewcontrollerdatasource, uipageviewcontrollerdelegate, uiscrollviewdelegate,uigesturerecognizerdelegate> { nsmutablearray *dataanswers; } @property uiscrollview *tabsview; @property uiview *contentview; @property uipageviewcontroller *pageviewcontroller; @property (assign) id<uiscrollviewdelegate> actualdelegate; @property (assign)bool isvalidpage; @property (assign)bool issonraki; // tab , content cache @property nsmutablearray *tabs; @property nsmutablearray *contents; // options @property (nonatomic) nsnumber *tabheight; @property (nonatomic) nsnumber *taboffset; @property (nonatomic) nsnumber *tabwidth; @property (nonatomic) nsnu