Hi,
I'm a coding newbie, but I really wanna learn how to do multithreading and event handling.
Does anyone know of any good tutorials out there, or can they explain it to me in a nutshell?
Hi,
This question would be a bit childish, I have three tables, users, usergroups and contacts. In my system, the end user can create a contact and subsequently he\she may define the visibility of the contact by setting only for that user, or for a set of users or a set of usergroups. So I am wondering, how my database design would be, it should be many to many between users and contacts or many to many between usergroups and contacts. Definitely there is a one to many relationship between users and usergroups.
Thanks
Thurein
Hi,
I want to program an "Add"-Window to my application, much like the "Add Contact"-window in the Contacts app or the "Add City"-window in the Weather app.
My question is: how do I code the effect of sliding up that Contacts & Weather feature?
-- Ry
Suppose the following (slightly pseudo-code for brevity):
class Basic
{
String foo;
}
class SomeExtension extends Basic
{
String bar;
}
class OtherExtension extends Basic
{
String baz;
}
class BasicService
{
Basic getBasic()
{
}
}
class SomeExtensionService extends BasicService
{
SomeExtension getSomeExtension()
{
}
}
class OtherExtensionService extends BasicService
{
OtherExtension getOtherExtension()
{
}
}
What would be the most idiomatic, elegant way to implement the get-() service methods with the most possible code reuse?
Obviously you could do it like this:
class BasicService
{
Basic getBasic()
{
Basic basic = new Basic();
basic.setFoo("some kind of foo");
return basic;
}
}
class SomeExtensionService
{
SomeExtension getSomeExtension()
{
SomeExtension someExtension = new SomeExtension;
Basic basic = getBasic();
someExtension.setFoo(basic.getFoo());
someExtension.setBar("some kind of bar");
return someExtension;
}
}
But this would be ugly if Basic has a lot of properties, and also you only need one object, as SomeExtension already inherits Basic. However, BasicService can obviously not return a SomeExtension object.
You could also have the get methods not create the object themselves, but create it at the outermost level and pass it to the method for filling in the properties, but I find that too imperative.
(Please let me know if the question is confusingly formulated.)
Here's as far as I understand it:
Client & Server make connection
Client sends server data
Server interprets data, sends client data
So on, and so forth, until client sends disconnect signal.
I'm just wondering about implementation. Step 2 and 3 are confusing to me, maybe I'm over-complicating it. Is there anymore to interpreting the data than a giant switch statement?
Any good books on client/server design? Specifically talking about multithreaded servers, scalability, and message design (byte 1 = header info, byte 2 = blah blah, etc)? Specifically geared towards C++.
I have in a previous Q found out that I need an ajax-function to send an email (submit a contact form) without reloading the page.
This is for my classifieds website, where when users are viewing a classified they have the option to "tip a friend" by entering their friends email-adress and submitting the form.
But I don't want to reload the page, that would be frustrating and not so clever.
The only input in the form is a text input which will contain the email-adress to send to, and another hidden input which contains the classified_id nr, to identify which classified it is.
The website is php based btw...
Does anybody have a simple script for this?
I have no experience in Ajax at all... And would really appreciate it.
Thanks
PS: Would prefer no Jquery, due to clients own reasons...
Hi,
for school im writing an introduction to internet concepts,
what should be the first thing to explain?
Maybe client-server relation, TCP/IP protocol or something else?
Ok. I am starting out OOPS in PHP. Created a couple of classes: customer(parent) and sales(child) class that inherits from parent class. Created another testcustomer.php in which a new sales object is created however the salesprint() function defined in the sales class does not echo out customer's name though it is set to be "Jane" in the class.customer.php(parent). My thinking is that when sales class extends customer class PHP automatically includes all the code from class.customer.php to sales.customer.php and therefore the constructor in parent class set $name to "Jane".
Here is the code: class.customer.php
<?php
class customer{
private $name;
private $cust_no;
public function __construct($customerid) {
$this->name = 'Jane';
$this->cust_no = $customerid;
}
}
?>
class.sales.php
<?php
require_once('class.customer.php');
class sales extends customer{
public function salesprint($customerid) {
echo "Hello $this->name this is a print of your purchased products";
}
}
?>
testcustomer.php
require_once('class.sales.php');
$objsales = new sales(17);
$objsales->salesprint(17);
?>
The Output I get
Hello this is a print of your purchased products.
What am i doing wrong ?
thanks
romesh
I was following this tutorial : http://pronewb.com/mongodb-as-in-humongous-not-retarded. All was well until the "I feel the vibe" section. I do not know where to begin this section. Do i have to create a new php file or type it in some command line?
Hi there,
Can someone please explain what really goes on in this code ?
If I put the AND statement, the message wont show if values are less than 0 or greater than 10 ... I think I must use 1 0 logic to work this out right ?
I just need someone to briefly explain it please.
#include<stdio.h>
main(){
puts("enter number");
scanf("%d",num);
if(num<0 || num >10)
puts("yay");
}
How is that IF statement different when AND is put :
#include<stdio.h>
main(){
puts("enter number");
scanf("%d",num);
if(num<0 && num >10)
puts("yay");
}
Thanks !!
New to json data and struggling i guess the answer is real easy but been bugging me for the last hour..
Sample data
{
"data":
{
"userid": "17",
"dates": {
"timestame": "1275528578",
},
"username": "harino54",
}
}
Ok I can pull userid or username easy enough with
echo "$t->userid" or echo "$t->username "
but how do I pull data from the brackets within ? in this case timestame?
cant seem to figure it out..
any ideas?
All the tutorials and examples I've found of XSLT processing seem to assume your destination will be a significantly different format/structure to your source and that you know the structure of the source in advance. I'm struggling with finding out how to perform simple "in-place" modifications to a HTML document without knowing anything else about its existing structure.
Could somebody show me a clear example that, given an arbitrary unknown HTML source will:
1.) delete the classname 'foo' from all divs
2.) delete a node if its empty (ie <p></p>)
3.) delete a <p> node if its first child is <br>
4.) add newattr="newvalue" to all H1
5.) replace 'heading' in text nodes with 'title'
6.) wrap all <u> tags in <b> tags (ie, <u>foo</u> -> <b><u>foo</u></b>)
7.) output the transformed document without changing anything else
The above examples are the primary types of transform I wish to accomplish. Understanding how to do the above will go a long way towards helping me build more complex transforms.
To help clarify/test the examples here is a sample source and output, however I must reiterate that I want to work with arbitrary samples without rewriting the XSLT for each source:
<!doctype html>
<html>
<body>
<h1>heading</h1>
<p></p>
<p><br>line</p>
<div class="foo bar"><u>baz</u></div>
<p>untouched</p>
</body>
</html>
output:
<!doctype html>
<html>
<body>
<h1 newattr="newvalue">title</h1>
<div class="bar"><b><u>baz</u></b></div>
<p>untouched</p>
</body>
</html>
I have wanted to learn VB and VBA for a long time. My school offers a coarse, but it doesn't fit with the rest of my schedule. It will be my first programing language. I was considering using the textbook my school uses (An introduction to programing using visual basic 2008, but I wold get the 2010 version), but I was wondering if there were better resources I could use. I mainly want to lean to learn VBA so I cam create macros and other tools for MS Word. Please understand that this is the fist time I will be programming and I am teaching myself (with the books/online resources).
I am coding an external Javascript slideshow file, which i want to load and display on my HTML/CSS webpage.
How do i go about doing that?
I understand that i need to load the .js file in the header of the HTML, but what do i call inside the body's DIV that will make the javascript file understand that i want it to load at that area?
I'm extremely confused with working with Javascript here.
If anyone has any helpful links to implementing a complete slideshow on a webpage it would be appreciated as well.
I would like to write a custom OpenOffice function that runs a shell command and puts the result into the cell from which it was invoked.
I have a basic macro working, but I can't find a way to capture the command's output.
Function MyTest( c1 )
MyTest = Shell("bash -c "" echo hello "" ")
End Function
The above always returns 0. Looking at the documentation of the Shell command, I don't think it actually returns STDOUT. How would I capture the output so that I can return it in my function?
Thanks!
i've only ever created external .as files that extended a class such as sprite. now i just want to create one that doesn't extend anything and call it from a frame script.
package
{
public class Test
{
public function Test(val:Number, max:Number)
{
trace(val, max);
}
}
}
from my frame script of an .fla that is in the same folder as Test.as, i'll write this:
Test(50, 100);
this produces the following error:
1137: Incorrect number of arguments. Expected no more than 1.
I have seen people writing forms in mdoels or in forms.py? Is it the case I can actually write it anywhere say in blah.py and just import it wherever necessary?
I'm working with twitter's api, trying to get the json data from
http://search.twitter.com/trends/current.json
which looks like:
{"as_of":1268069036,"trends":{"2010-03-08 17:23:56":[{"name":"Happy Women's Day","query":"\"Happy Women's Day\" OR \"Women's Day\""},{"name":"#MusicMonday","query":"#MusicMonday"},{"name":"#MM","query":"#MM"},{"name":"Oscars","query":"Oscars OR #oscars"},{"name":"#nooffense","query":"#nooffense"},{"name":"Hurt Locker","query":"\"Hurt Locker\""},{"name":"Justin Bieber","query":"\"Justin Bieber\""},{"name":"Cmon","query":"Cmon"},{"name":"My World 2","query":"\"My World 2\""},{"name":"Sandra Bullock","query":"\"Sandra Bullock\""}]}}
My structs look like:
type trend struct {
name string
query string
}
type trends struct {
id string
arr_of_trends []trend
}
type Trending struct {
as_of string
trends_obj trends
}
and then I parse the JSON into a variable of type Trending. I'm very new to JSON so my main concern is making sure I've have the data structure correctly setup to hold the returned json data.
I'm writing this in 'Go' for a project for school. (This is not part of a particular assignment, just something I'm demo-ing for a presentation on the language)
I know little of optimization problems, so hopefully this will be didactic for me:
rotors = [1, 2, 3, 4...]
widgets = ['a', 'b', 'c', 'd' ...]
assert len(rotors) == len(widgets)
part_values = [
(1, 'a', 34),
(1, 'b', 26),
(1, 'c', 11),
(1, 'd', 8),
(2, 'a', 5),
(2, 'b', 17),
....
]
Given a fixed number of widgets and a fixed number of rotors, how can you get a series of widget-rotor pairs that maximizes the total value where each widget and rotor can only be used once?
I'm trying to write a scheme func that behaves in a way similar to a loop.
(loop min max func)
This loop should perform the func between the range min and max (integers)
-- one of an example like this
(loop 3 6 (lambda (x) (display (* x x)) (newline)))
9
16
25
36
and I define the function as
( define ( loop min max fn)
(cond
((>= max min) ( ( fn min ) ( loop (+ min 1 ) max fn) ) )
)
)
when I run the code I get the result then an error occur.
I couldn't handle this error.
(loop 3 6 (lambda (x) (display(* x x))(newline)))
9
16
25
36
Backtrace:
In standard input:
41: 0* [loop 3 6 #]
In utku1.scheme:
9: 1 (cond ((= max min) ((fn min) (loop # max fn))))
10: 2 [# ...
10: 3* [loop 4 6 #]
9: 4 (cond ((= max min) ((fn min) (loop # max fn))))
10: 5 [# ...
10: 6* [loop 5 6 #]
9: 7 (cond ((= max min) ((fn min) (loop # max fn))))
10: 8 [# ...
10: 9* [loop 6 6 #]
9: 10 (cond ((= max min) ((fn min) (loop # max fn))))
10: 11 [# #]
utku1.scheme:10:31: In expression ((fn min) (loop # max ...)):
utku1.scheme:10:31: Wrong type to apply: #<unspecified>
ABORT: (misc-error)
Do you know a framework for making presentations using only HTML5 and javascript technologies?
I'm not talking about "export" features of various presentation software (powerpoint or OOo presentation).
Some requirements for the presentations made with this "framework":
take advantage of the latest HTML5 features (audio, video, canvas?)
same with CSS3 (font support, gradient, shadows, transitions and transformations)
If there's no such thing, example of good presentations or pointers on the subject would be appreciated.