text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I am reading a great book called Swing: A Beginner's guide.
There is this code in the book that creates a button and a label that alerts on button's state change events :
```
//Demonstrate a change listener and the button model
package swingexample2_6;
import java.awt.*;
import javax.swing.*;
import javax.swing.even... | [
0.4052242934703827,
-0.07067175209522247,
0.6208831071853638,
-0.2898714542388916,
-0.14037694036960602,
0.0843164399266243,
0.1519278883934021,
-0.5164390206336975,
-0.2053520828485489,
-0.7312748432159424,
-0.151284322142601,
0.2591816186904907,
-0.28119099140167236,
-0.04007388278841972... | |
manager
jfrm.getContentPane().setLayout(new FlowLayout());
//Give the frame an initial size
jfrm.setSize(250, 160);
//Terminate the program when the user closes the application
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create an empty label
jlab = ... | [
-0.06225216016173363,
-0.28178828954696655,
1.0277369022369385,
-0.32517382502555847,
0.268644243478775,
0.06465733796358109,
0.4755297303199768,
-0.44361430406570435,
-0.2808389365673065,
-0.44911515712738037,
-0.45779043436050415,
0.4782150089740753,
-0.4777112603187561,
0.20238570868968... | |
Change Event Test");
//--Add change listener
jbtn.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent ce) {
ButtonModel mod = jbtn.getModel();
String what = ""; | [
0.009569327346980572,
-0.48650896549224854,
0.6606845855712891,
-0.3423251211643219,
0.30756911635398865,
0.17942525446414948,
0.5859582424163818,
-0.5126264691352844,
0.09224534034729004,
-0.5765154957771301,
-0.19610124826431274,
0.5762578248977661,
-0.4234274625778198,
0.148500487208366... | |
if (mod.isEnabled()) {
what += "Enabled<br>";
}
if (mod.isRollover()) {
what += "Rollover<br>"; | [
-0.26179417967796326,
-0.3728044331073761,
0.8552203178405762,
-0.47494322061538696,
0.46568763256073,
-0.15101617574691772,
-0.04268611595034599,
-0.40881112217903137,
-0.4404371976852417,
-0.5821194052696228,
-0.7353916168212891,
0.9238318204879761,
-0.06520495563745499,
-0.1197228282690... | |
}
if (mod.isArmed()) {
what += "Armed<br>";
}
if (mod.isPressed()) {
what += "Pressed<br>"; | [
-0.2693670094013214,
-0.34894493222236633,
0.6349983811378479,
-0.4202621281147003,
0.29292458295822144,
0.47031256556510925,
0.10948674380779266,
-0.6688005328178406,
-0.2559557557106018,
-0.4190256893634796,
-0.2588980495929718,
1.1184144020080566,
-0.08745657652616501,
-0.27946224808692... | |
}
//Notice that this label's text is HTML
jlab.setText("<html>Current stats:<br>" + what);
}
});
//Add the components to the content pane
jfrm.getContentPane().add(jbtn); | [
0.29810604453086853,
-0.2151820957660675,
0.42428886890411377,
-0.0664239302277565,
0.08917786926031113,
-0.22881318628787994,
0.4113401770591736,
-0.25623619556427,
0.019218740984797478,
-0.6188668608665466,
-0.5080887675285339,
0.5023380517959595,
-0.6026430130004883,
-0.0159399844706058... | |
jfrm.getContentPane().add(jlab);
//Display the frame
jfrm.setVisible(true);
}
public static void main(String[] args) {
//Create the frame on the event dispatching thread
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() { | [
0.493222713470459,
-0.31447771191596985,
0.5908564329147339,
-0.21177099645137787,
0.08161361515522003,
0.047759175300598145,
0.3404776453971863,
-0.45603546500205994,
-0.3860694468021393,
-0.25470346212387085,
-0.2852872312068939,
0.4749479293823242,
-0.6159048080444336,
0.148433640599250... | |
new ChangeDemo();
}
});
}
}
```
Everything is working fine except for the rollover event.
The underlying operating system is Mac OS Lion.
Should I blame Lion for this swing problem or am I doing something wrong?
Thank you.
Update 1 : My neatbeans settings picture (I hope it helps)
[![settings... | [
0.26259544491767883,
-0.09438831359148026,
0.624308705329895,
-0.1898636817932129,
0.08772250264883041,
-0.17778781056404114,
0.40901902318000793,
-0.31708988547325134,
-0.3662194013595581,
-0.6219545602798462,
-0.16309043765068054,
0.6422584652900696,
-0.4781392216682434,
0.01141821779310... | |
expected. Interestingly, the Mac UI delegate, `com.apple.laf.AquaButtonUI`, does nothing when `isRollover()` is `true`. If it's important to your application, you can take the desired action when the following predicate is `true`:
```
System.getProperty("os.name").startsWith("Mac OS X")
```
For reference, this [exam... | [
0.12257829308509827,
-0.39364728331565857,
0.7428035140037537,
-0.34791386127471924,
0.26255202293395996,
-0.1113804504275322,
0.4204602837562561,
-0.3470436632633209,
-0.17012394964694977,
-0.5641893744468689,
-0.6219608187675476,
0.6874999403953552,
-0.4297560453414917,
-0.01774709671735... | |
jlab = new JLabel("", JLabel.CENTER);
jbtn = new JButton("Press for Change Event Test");
jbtn.setRolloverEnabled(true);
jbtn.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent ce) {
ButtonModel mod = jbtn.getModel(); | [
-0.18427668511867523,
-0.5399808287620544,
0.8329975008964539,
-0.267225056886673,
0.3733990788459778,
0.30697670578956604,
0.4279174208641052,
-0.46001702547073364,
-0.17227010428905487,
-0.5794807076454163,
-0.3577395975589752,
0.5531740188598633,
-0.3579055070877075,
0.19715088605880737... | |
String what = "";
if (mod.isEnabled()) {
what += "Enabled<br>";
}
if (mod.isRollover()) {
what += | [
-0.029451798647642136,
-0.4133426249027252,
0.6809243559837341,
-0.36492660641670227,
0.2814406156539917,
-0.04974857717752457,
0.2575141489505768,
-0.5036827325820923,
-0.3382553160190582,
-0.24650374054908752,
-0.4720345735549927,
0.8915367722511292,
-0.12772999703884125,
-0.022700609639... | |
"Rollover<br>";
}
if (mod.isArmed()) {
what += "Armed<br>";
}
if (mod.isPressed()) { | [
0.03250753507018089,
-0.30328869819641113,
0.6527350544929504,
-0.28350695967674255,
0.22707438468933105,
0.29869166016578674,
0.04254602640867233,
-0.5026053786277771,
-0.4203195869922638,
-0.2666897475719452,
-0.3693617582321167,
0.9449782371520996,
-0.100190669298172,
-0.207791477441787... | |
what += "Pressed<br>";
}
//Notice that this label's text is HTML
jlab.setText("<html>Current stats:<br>" + what + "</html>");
}
});
JPanel | [
0.054231107234954834,
-0.47017762064933777,
0.6889134049415588,
-0.23012328147888184,
-0.21579863131046295,
0.10554373264312744,
0.16751261055469513,
-0.2989985942840576,
-0.11323876678943634,
-0.4096280038356781,
-0.377758651971817,
0.3757955729961395,
-0.38660794496536255,
-0.03534591943... | |
panel = new JPanel();
panel.setBorder(BorderFactory.createEmptyBorder(50, 10, 0, 10));
panel.add(jbtn);
jfrm.add(panel);
jfrm.add(jlab);
jfrm.pack();
jfrm.setLocationRelativeTo(null);
jfrm.setVisible(true);
}
public static void main(String[] args) {
... | [
0.26594793796539307,
-0.3936697244644165,
0.5737068057060242,
-0.171484112739563,
-0.14809246361255646,
0.28899458050727844,
0.3323265314102173,
-0.5741655230522156,
-0.3837338089942932,
-0.38605865836143494,
-0.505159318447113,
0.3196086585521698,
-0.6504749059677124,
-0.00196183961816132... | |
{
@Override
public void run() {
ChangeDemo changeDemo = new ChangeDemo();
}
});
}
}
``` | [
0.33423811197280884,
-0.2659588158130646,
0.4207812547683716,
-0.24627907574176788,
0.6007488369941711,
0.09203268587589264,
0.5717762112617493,
0.00044445795356296003,
-0.16738541424274445,
-0.4128400981426239,
-0.20315231382846832,
0.5746744275093079,
-0.5768941044807434,
0.5047878623008... | |
There is a typical blog application. Each user has\_many posts. Each post has\_many tags.
I'm sorting each post by updated\_at so the most recently updated post will show up on top. So for example, if I update a post's content, the post will come up to the top. However, this also happens when I just add a tag, since a... | [
0.49829599261283875,
0.09218784421682358,
0.4041917324066162,
0.3729289770126343,
-0.10178954154253006,
-0.2899470329284668,
-0.060070767998695374,
0.1591523140668869,
-0.3541313111782074,
-0.5751550793647766,
0.014242702163755894,
0.4627493619918823,
-0.41084229946136475,
0.29160425066947... | |
other way to achieve something like this? Thank you!
Two approaches spring to mind:
1. Don't use `:updated_at` for the purpose you are using it for. Instead create a new column, say `:post_updated_at`, and update it manually on each save that you want to cause the post to move to the top. Rails provides a convenient m... | [
0.2489425241947174,
-0.06652101129293442,
0.3669152557849884,
0.05583775043487549,
-0.06055633723735809,
-0.19102978706359863,
0.4360730051994324,
-0.304002046585083,
-0.32457929849624634,
-0.6900639533996582,
-0.16825029253959656,
0.5977011919021606,
-0.5475950837135315,
-0.06525707989931... | |
you will have to be clever if the column in question is a fancy `serialize` column or similar. | [
0.37708088755607605,
0.19374273717403412,
-0.113327257335186,
0.13965246081352234,
0.09191353619098663,
-0.11394677311182022,
-0.021118436008691788,
0.4923820197582245,
-0.2219291776418686,
-0.39237070083618164,
-0.04862659052014351,
0.22545719146728516,
0.09328600019216537,
-0.28485822677... | |
I'm trying to get a GUI with a UITabBar and UITableViews set up.
I've got a UITabView that is programmatically created.
One of the Tabs displays a UITableView that is also programmatically created.
This UITableView then displays other views when didSelectRowAtIndexPath is called.
Unfortunately, when a table cell is ... | [
0.4189360737800598,
-0.034568991512060165,
0.41628381609916687,
0.18501518666744232,
-0.2905097007751465,
-0.05257602408528328,
0.26438912749290466,
0.13805776834487915,
-0.1391979157924652,
-0.8269369602203369,
0.31638583540916443,
0.694998562335968,
-0.3301561772823334,
0.384122610092163... | |
to display the UITabBar rather than doing it directly.
Then use a UITableViewController as the view controller for a given tab. Though I get the impression that you want to present descendent UITableViews when a row is selected. If this is the case, you ought to use a UINavigationController as the tab bar's view contr... | [
0.1722988337278366,
-0.12759630382061005,
0.8093379735946655,
0.027201687917113304,
-0.28106990456581116,
-0.00707098376005888,
0.0641448050737381,
0.022429175674915314,
-0.2507859766483307,
-0.5684900879859924,
-0.25856122374534607,
0.7805293798446655,
-0.485535204410553,
0.03295788168907... | |
obvious issues with this code (beginning with the fact that I hacked it all together in the application delegate!); it's intended purely as a model for how your controllers should be glued together.
```
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, UITableViewDelegate, UITableVi... | [
0.07061553001403809,
-0.3386487364768982,
0.7273644208908081,
0.2961179316043854,
-0.052891504019498825,
-0.2601139545440674,
0.10293309390544891,
-0.6985151171684265,
-0.3267103135585785,
-0.6647463440895081,
-0.08980213850736618,
0.7704482078552246,
-0.4473947286605835,
0.219831585884094... | |
setDelegate:self];
[[rootTVC tableView] setDataSource:self];
[rootTVC setTitle:@"Root Table"];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:rootTVC];
[rootTVC release];
[navController setTitle:@"My Table"];
UIViewController *anotherViewCont... | [
-0.013342713005840778,
-0.4262301027774811,
0.6448482275009155,
0.02758193016052246,
-0.17201942205429077,
-0.01991441659629345,
0.4695231318473816,
-0.40381747484207153,
-0.11384768038988113,
-0.7567424774169922,
-0.6414709687232971,
0.1401357799768448,
-0.40078580379486084,
0.13241250813... | |
[self.window makeKeyAndVisible];
return YES;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexP... | [
-0.08091887086629868,
-0.08667797595262527,
0.9496831297874451,
-0.24686752259731293,
-0.2952602505683899,
0.24837931990623474,
0.44479936361312866,
-0.4713898003101349,
-0.007106978911906481,
-0.6343449354171753,
-0.16361650824546814,
0.8145006895065308,
-0.14244824647903442,
-0.014855525... | |
*newTVC = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
[newTVC setTitle:[NSString stringWithFormat:@"Table %d", [indexPath row]]];
[[newTVC tableView] setDelegate:self];
[[newTVC tableView] setDataSource:self];
[[self navController] pushViewController:newTVC animated:YES];
}
@en... | [
-0.2484630048274994,
-0.27144402265548706,
0.8009280562400818,
-0.07387363165616989,
-0.4098389446735382,
0.1409999281167984,
0.39658141136169434,
-0.2389986515045166,
-0.10361780226230621,
-0.5912465453147888,
-0.5124589204788208,
0.7474004030227661,
0.03573397174477577,
-0.04636896774172... | |
I am really only a hobbyist, who has aspirations far too grand, that said, I am trying to figure out the right way to create my database so that database changes don't require client refactoring, but also fast. Please respond in as if I wouldn't understand typical development or DBA terminology well.
**The situation:*... | [
0.16520056128501892,
0.3004275858402252,
0.6894665360450745,
0.11508391797542572,
-0.15526120364665985,
-0.10764031112194061,
0.32469505071640015,
-0.1509070098400116,
-0.37552475929260254,
-0.3722399175167084,
0.16239561140537262,
0.6116454005241394,
0.155818909406662,
0.3478389382362366,... | |
two overall ratings all in the ratings table, each in a column (guessing this is bad, but not sure). Should I instead have a ratings table (12 rows) and a book\_ratings table where each row of the ratings table is a type of rating for a user?
```
-e.g. book_ratings: id | user_id | book_id | rating_id
```
If ... | [
0.1549634486436844,
0.2392924427986145,
0.5331106185913086,
0.27682846784591675,
-0.04615040123462677,
0.19554610550403595,
0.2663533687591553,
-0.26099061965942383,
-0.15633097290992737,
-0.5507338047027588,
0.011882172897458076,
0.6207337379455566,
-0.07149120420217514,
0.384063452482223... | |
I may want to add more sub rating types in the future, which is partially why I think it might be valuable to change it, but it's a lot of work, so I wanted to check first.
Thanks!
You are correct that you're doing fewer than n2 operations. The question is how many fewer operations you are doing.
Let's think about ho... | [
0.6285075545310974,
-0.24789661169052124,
-0.19759725034236908,
0.0692346915602684,
-0.041351575404405594,
0.16919216513633728,
0.4293738305568695,
-0.5527539253234863,
-0.5963444113731384,
-0.5369412899017334,
0.22382088005542755,
0.4959142506122589,
-0.4878690242767334,
-0.04438963904976... | |
of these pairs, so the total number of pairs you generate is n2 - n, which is O(n2).
Now, what about if you eliminate duplicate pairs by saying that (1, 4) and (4, 1) are the same? In this case, note that half of the pairs you generate are going to be extraneous - you'll generate each pair twice. This means that the n... | [
0.12862028181552887,
-0.1497708261013031,
0.04346355423331261,
-0.1753380000591278,
-0.08961653709411621,
0.143728569149971,
0.3047322630882263,
-0.3262411057949066,
-0.5386928915977478,
-0.6461184024810791,
-0.13422450423240662,
0.3604707717895508,
-0.4749147891998291,
0.16303682327270508... | |
than n2 pairs, but the total number of pairs you're creating is still O(n2).
More generally - if you ever decrease the total amount of work that an algorithm does by some constant factor (say, you cut the work in half, or cut the work by a factor of 100), you have not changed the big-O runtime of the algorithm. Big-O ... | [
0.21808990836143494,
-0.0685577541589737,
0.04721280187368393,
-0.05123008042573929,
-0.011649377644062042,
0.14795397222042084,
0.3151616156101227,
-0.2937205135822296,
-0.5868327617645264,
-0.7926718592643738,
-0.10572188347578049,
0.3726026117801666,
-0.5999293923377991,
0.2010049670934... | |
I've been told that it's best to place Javascript code in a separate file to keep concerns separated, and while the idea resonates with me, I don't find it practical.
That may just be my inexperience, hence this question.
Here's a clear cut example where I found that placing the code in the View was better than placi... | [
0.33612096309661865,
0.022610800340771675,
0.6663235425949097,
-0.03507549315690994,
0.14494825899600983,
-0.02962077409029007,
0.14427652955055237,
-0.059102341532707214,
0.006623930297791958,
-0.1606273651123047,
-0.06278055161237717,
0.588630199432373,
-0.38238415122032166,
0.3965479433... | |
return $("#image-popup").dialog({
modal: true,
closeOnEscape: true,
minHeight: 384,
minWidth: 596,
resizable: false,
show: {
effect: 'slide',
duration: 500,
direction: 'up' | [
-0.00013496576866600662,
-0.24125529825687408,
0.9818093776702881,
-0.08342606574296951,
0.4103613495826721,
0.3691155016422272,
0.3393063247203827,
-0.4200087785720825,
-0.28984135389328003,
-0.2668536603450775,
-0.4224046468734741,
0.6785363554954529,
-0.28908321261405945,
-0.12450056523... | |
},
hide: {
effect: 'slide',
duration: 250,
direction: 'up'
},
title: '@Model.Product.Name'
});
});
```
Notice:
```
title: '@Model.Product.Name'
```
As you can see I have *access* to the strongly typed model if I use Javascript in my View. This is not ... | [
-0.1576017290353775,
-0.2796246409416199,
0.532378077507019,
-0.24907153844833374,
0.012804522179067135,
0.004324502311646938,
0.2943418025970459,
-0.4700608253479004,
-0.36219334602355957,
-0.21156322956085205,
-0.31070172786712646,
0.4032597839832306,
-0.1616954505443573,
-0.014492866583... | |
separate Javascript file.
Am I doing this wrong, is there something I'm not seeing?
If I were to use a separate file, how would it look like seeing as I can't access the Model properties from within the Javascript file?
Separate js file:
```
<div id="thumbs">
<img data-dialog-title="@Model.Product.Name" src="[wh... | [
0.3129386901855469,
-0.06871968507766724,
0.995371401309967,
0.002029486931860447,
0.43025022745132446,
0.008192113600671291,
0.2340151071548462,
-0.4438861310482025,
-0.27897101640701294,
-0.17627042531967163,
0.06907154619693756,
0.7262694835662842,
-0.4655930697917938,
0.140079751610755... | |
minHeight: 384,
minWidth: 596,
resizable: false,
show: {
effect: 'slide',
duration: 500,
direction: 'up'
},
hide: {
effect: 'slide', | [
-0.42720794677734375,
-0.18204858899116516,
0.4260460436344147,
0.07882444560527802,
-0.16583310067653656,
0.24747967720031738,
0.4213351011276245,
-0.3444088399410248,
-0.15413357317447662,
0.000909128924831748,
-0.39947620034217834,
0.235883891582489,
0.02993038482964039,
-0.223332881927... | |
duration: 250,
direction: 'up'
},
title: title
});
});
```
Access the model properties unobtrusively through the dom using HTML5 data-\* attributes. The javascript above will work perfectly fine as an external file. | [
0.00975792296230793,
-0.1241198182106018,
0.9061219692230225,
-0.16795805096626282,
0.16774633526802063,
-0.13632741570472717,
0.3758951425552368,
-0.4498145282268524,
-0.14443422853946686,
-0.26235753297805786,
-0.48891979455947876,
0.7888659834861755,
0.1390032321214676,
-0.0068273209035... | |
I have a form that has a group of 13 checkboxes that together make up my search criteria... except that I also added a pair of radio buttons for ALL or ANY.
I was hoping to get away with something elegant like:
```
priority_ids = request.GET.getlist("priority") # checkboxes
collection = request.GET.get("collection... | [
0.146999329328537,
-0.17639736831188202,
0.4960058927536011,
0.03356796130537987,
0.14492587745189667,
-0.08955678343772888,
0.18089112639427185,
-0.49839210510253906,
-0.22553041577339172,
-0.6601418256759644,
-0.09393277019262314,
0.7097227573394775,
-0.4195631742477417,
0.02306295745074... | |
"all" that does the equivalent of "Q(...) | Q(...) | Q(...)" or "Q(...) & Q(...) & Q(...)" for anywhere from 1 to 13 criteria.
There's nothing that Django needs to do about that. You just need to combine your `Q`-s with `&` and respectively `|`, in a simple loop or in a more compact way with `reduce`.
And regarding te... | [
0.09014188498258591,
-0.042310308665037155,
0.07344534248113632,
-0.16720688343048096,
-0.24056999385356903,
-0.17972521483898163,
-0.16089922189712524,
-0.4386940002441406,
-0.11595665663480759,
-0.4962276518344879,
-0.24578502774238586,
0.4359253942966461,
-0.6579843163490295,
0.01309354... | |
SomeModel.objects.all()
if collection == "any":
filtered_qset = base_qs.filter(reduce(operator.or_, priority_filters))
elif collection == "all":
filtered_qset = base_qs.filter(reduce(operator.and_, priority_filters))
``` | [
-0.23222510516643524,
-0.3334982097148895,
-0.020197853446006775,
-0.20950819551944733,
-0.15582586824893951,
-0.19884198904037476,
0.05128434672951698,
0.062092989683151245,
-0.15501777827739716,
-0.49954429268836975,
-0.2600128948688507,
0.25997164845466614,
-0.5392993688583374,
-0.06686... | |
Lets just put it at its simplest, a table with two fields: 'item\_id' & 'times\_seen'.
```
| item_id | times_seen |
----------+-------------
| 1001 | 48 |
| 1002 | 25 |
| 1003 | 1 |
| 1004 | 12 |
| 1005 | 96 |
| 1006 | | [
-0.027368756011128426,
0.003940341528505087,
0.45888981223106384,
0.01800648495554924,
0.06732723861932755,
0.05851234868168831,
-0.028740108013153076,
-0.07065223157405853,
-0.05278082937002182,
-0.7341851592063904,
-0.07689453661441803,
0.36278125643730164,
-0.26383012533187866,
0.320707... | |
35 |
```
I'm trying to find a way to randomly select a row, but give preference to items that haven't been selected much before.
*(obviously, a second query would be sent to increment the 'times-seen' field after it has been selected)*
Although my current "project" is a php/mysql one, I'd like language agnostic... | [
0.27445533871650696,
0.41769465804100037,
0.1826295107603073,
0.09591831266880035,
-0.0593479759991169,
0.2880672514438629,
0.03854987025260925,
0.013788844458758831,
-0.17895635962486267,
-0.4457533061504364,
0.13643507659435272,
0.4105558395385742,
-0.23422585427761078,
-0.02776470221579... | |
it.
There's nothing that Django needs to do about that. You just need to combine your `Q`-s with `&` and respectively `|`, in a simple loop or in a more compact way with `reduce`.
And regarding terminology it seems to me that you are calling `Q` a queryset, but it's not. It's a filter on a queryset.
Something like th... | [
-0.003250341396778822,
-0.26305288076400757,
0.10558618605136871,
-0.11870122700929642,
-0.16746583580970764,
-0.5040011405944824,
-0.13287797570228577,
-0.17673765122890472,
-0.06502078473567963,
-0.6521897912025452,
-0.4293328523635864,
0.33342820405960083,
-0.5542648434638977,
0.0338693... | |
I am work on HTML and PHP on my project , but I have a problem :
I have a drop down list with countries and I want a nother drop down list to appear with (cities of this country) when user choose a country
I have the countries data base and cities data base ( sql )
I try to use a java script method to do that but i... | [
0.2864437699317932,
0.012579014524817467,
0.6688228845596313,
0.2607837915420532,
-0.008579500950872898,
-0.2739163935184479,
0.0638013482093811,
0.23217827081680298,
-0.23187105357646942,
-0.7447790503501892,
0.09967955201864243,
-0.08905867487192154,
-0.16193453967571259,
0.0404574498534... | |
<?php
$Con= mysql_connect("localhost","root","");
if(!$Con) { die('Could not connect'.mysql_error());}
if(!mysql_selectdb("MyDB",$Con)){die(mysql_error());}
$sql = "SELECT * FROM countries";
$result = mysql_query($sql) or die(mysql_error());
while($row=mysql_fetch_array($result)){
echo ("<option v... | [
0.04218904301524162,
0.011904904618859291,
0.46729087829589844,
-0.18908503651618958,
0.21691110730171204,
0.055020906031131744,
0.27178114652633667,
-0.20622776448726654,
-0.32666584849357605,
-0.10245633125305176,
-0.3108811378479004,
0.07241477072238922,
-0.5680073499679565,
0.146007224... | |
$theCountry=$_GET['SelectCountry']; // get the country ID
$Con= mysql_connect("localhost","root","");
if(!$Con) { die('Could not connect'.mysql_error());}
if(!mysql_selectdb("MyDB",$Con)){die(mysql_error());}
$sql = "SELECT * FROM cities WHERE cities.Fips=(SELECT Fips FROM countries WHERE CountryID='$the... | [
0.1505863517522812,
-0.015428856946527958,
0.8427369594573975,
-0.14323833584785461,
0.22063502669334412,
0.15857455134391785,
0.20805037021636963,
-0.35317203402519226,
-0.17760758101940155,
-0.6625520586967468,
-0.6107929348945618,
0.3197043240070343,
-0.4027177095413208,
0.2596774697303... | |
");"; ?> ");
}
</script>
```
this method is to create a new dropdown list for the spicific country cities when the user change the country by using **Onchange** Event
I hope you will help me
if there any Questions or misanderstod I am ready to answer or explain
thaaaanks all :)
> ColdFusion generates `A0A8DE3A3B2A... | [
-0.053269512951374054,
-0.19220678508281708,
0.5740236043930054,
0.21288397908210754,
-0.15837597846984863,
-0.07262975722551346,
0.22751502692699432,
-0.0027562447357922792,
-0.49613556265830994,
-0.47504717111587524,
-0.24609985947608948,
-0.09745437651872635,
-0.4647725522518158,
0.0468... | |
generated result. | [
-0.0818454846739769,
-0.04418281093239784,
0.33015185594558716,
0.4421718120574951,
-0.15051086246967316,
-0.038768526166677475,
-0.10871166735887527,
-0.3146630525588989,
-0.11299501359462738,
-0.30904093384742737,
-0.12606655061244965,
0.4400760233402252,
0.35447824001312256,
-0.03455477... | |
I have been over my code numerous times and hope someone can help me see something I don't. I'm trying to pull data from Excel into a SQL table with multiple columns in VS2010 but when I try uploading the data, I get the error "Cannot Find Column 8." I see nothing wrong with column 8 nor any of the other columns. Anyon... | [
0.1288725584745407,
0.22580285370349884,
0.6690080165863037,
-0.1196737289428711,
-0.11234966665506363,
-0.08698970079421997,
0.4330579340457916,
-0.02962462417781353,
-0.30462121963500977,
-0.9592612385749817,
0.08099730312824249,
0.6728284955024719,
-0.28634923696517944,
0.28551429510116... | |
try
{
FileUpload.SaveAs(path);
System.Data.OleDb.OleDbConnection MyConnection;
System.Data.DataSet DtSet;
System.Data.OleDb.OleDbDataAdapter MyCommand; //check sheet name
MyConnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +... | [
-0.03868929296731949,
-0.029412711039185524,
0.650583803653717,
-0.04254934936761856,
0.4158235490322113,
0.1938329041004181,
0.46607863903045654,
-0.5439118146896362,
-0.06107427179813385,
-1.03024160861969,
-0.42521899938583374,
0.3289816379547119,
-0.47693705558776855,
0.044675074517726... | |
System.Data.DataSet();
MyCommand.Fill(DtSet);
SqlConnection curConnection = new SqlConnection(@"Data Source=1tc-Techcomm2;Initial Catalog=EventManagement;Integrated Security=True");
curConnection.Open();
SqlCommand curCommand;
SqlParameter param;
string str;
for ... | [
-0.21055978536605835,
-0.34529778361320496,
0.764390230178833,
0.007137456443160772,
0.11811929941177368,
0.3092978894710541,
0.3512432873249054,
-0.35278692841529846,
-0.16254892945289612,
-0.43351423740386963,
-0.47005900740623474,
0.3157905638217926,
-0.407566636800766,
0.34391349554061... | |
continue;
curCommand = curConnection.CreateCommand();
curCommand.CommandText = @"Insert into TestSP (SessionHead_Title, SessionHead_Type, SessionHead_Description, SessionHead_Confirmed, SessionHead_Presenter, SessionHead_Champion, SessionHead_Objective, SessionHead_Notes, SessionHead_Schedule, S... | [
0.18664154410362244,
0.008870971389114857,
0.5410255193710327,
-0.20785203576087952,
0.6533289551734924,
-0.012768281623721123,
0.5467011332511902,
0.026788413524627686,
-0.12177039682865143,
-0.13944953680038452,
-0.5166124105453491,
0.7185247540473938,
-0.11107455939054489,
0.06816509366... | |
param = new SqlParameter();
str = "@";
str += (char)('a' + j);
param.ParameterName = str;
param.SqlDbType = SqlDbType.VarChar;
param.Value = | [
-0.049768246710300446,
0.03158341348171234,
0.8365508913993835,
-0.19194583594799042,
-0.48442888259887695,
0.6367872953414917,
0.6268816590309143,
-0.8760896325111389,
-0.2849957346916199,
-0.14286942780017853,
0.03924701362848282,
0.04533424973487854,
-0.5008341073989868,
0.1677768528461... | |
DtSet.Tables[0].Rows[i][j];//This is where it errors out at after 8 times through
curCommand.Parameters.Add(param);
}
Label1.Text = "THE EXCEL DATE HAS SUCCESSFULLY BEEN SENT TO THE DATABASE";
int Event_Id = curCommand.ExecuteNonQuery();
}
MyConnec... | [
0.013116839341819286,
-0.17496685683727264,
0.5088644027709961,
-0.18914414942264557,
0.33173230290412903,
-0.06524833291769028,
0.33538007736206055,
-0.11954818665981293,
-0.1235198900103569,
-0.3567493259906769,
-0.26756277680397034,
0.36024484038352966,
-0.0989672988653183,
0.2662973105... | |
curConnection.Close();
}
catch (Exception ex)
{
//Response.Write(ex.ToString());
Label1.Text = ex.Message;
}
}
```
I believe the issue was that the spreadsheet column headers did not match the table headers. I read somewhere that the Column names in SQL Server table must be the same i... | [
-0.10130716115236282,
0.19250993430614471,
0.627793550491333,
-0.1525915265083313,
-0.1828605830669403,
-0.21319004893302917,
0.22392302751541138,
-0.004192993510514498,
-0.21409644186496735,
-0.30741819739341736,
-0.00544515997171402,
0.6928974986076355,
-0.38969066739082336,
0.2104375958... | |
I have an iOS 5 Tabbed Application, using Storyboards.
My Tabbar Controller points to three Navigation Controllers.
From one of them, the flow looks like this:
Start view --> Photo view (modal) --> Catalog view
On the photo screen, I have a button with the following code:
```
- (IBAction)acceptPhotoButtonPressed:(... | [
-0.2524648904800415,
-0.015210679732263088,
0.9061310291290283,
0.0468713603913784,
0.06005535274744034,
0.3042338490486145,
0.38907521963119507,
-0.1363903433084488,
-0.1883036494255066,
-0.6972169280052185,
-0.1723743975162506,
0.6095094084739685,
-0.22899900376796722,
-0.033417228609323... | |
instance 0x18d0d0'
```
So that tells me that I haven't got hold of a `UINavigationController`, but a `UITabBarController`.
Is there any way around this?
A "push" style segue can only be done from a view controller that is being managed by a `UINavigationController`. If you try to do so otherwise nothing will happen.... | [
-0.016793999820947647,
-0.1593009978532791,
0.776357114315033,
-0.09298906475305557,
-0.1339980810880661,
-0.07889775186777115,
0.4382581412792206,
-0.1656806468963623,
-0.043094757944345474,
-0.7071409225463867,
-0.2283172756433487,
0.5937761664390564,
-0.30731260776519775,
-0.02682667039... | |
do not wish for the top navigation bar to appear on your first view controller (Photo view)
you can use:
```
[self.navigationController setNavigationBarHidden:YES animated:NO]
```
This will hide top nav bar. Once you push a new view controller, if you want the nav bar to reappear on that one and any subsequent view ... | [
-0.008429614827036858,
-0.035075437277555466,
0.8364392518997192,
-0.003047458129003644,
0.18755896389484406,
0.13227853178977966,
0.1696261763572693,
0.015352104790508747,
-0.4107658267021179,
-0.5782431960105896,
-0.273607075214386,
0.8340246081352234,
-0.45834389328956604,
-0.0336742028... | |
Basically I am wondering what is the advantage / purpose of using `@import` to import stylesheets into an existing stylesheet versus just adding another ...
```
<link rel="stylesheet" type="text/css" href="" />
```
to the head of the document?
From a page speed standpoint, `@import` from a CSS file should almost nev... | [
0.4208357632160187,
-0.13373224437236786,
0.7075299024581909,
-0.10652503371238708,
-0.17176295816898346,
-0.3973822593688965,
-0.3018602430820465,
-0.2636563181877136,
-0.4047318696975708,
-0.548971951007843,
-0.14028428494930267,
0.4884853959083557,
-0.4490795433521271,
-0.01565445773303... | |
can be downloaded at the same time. If both stylesheets are always loaded together, it can also be helpful to simply combine them into a single file.
There are occasionally situations where `@import` is appropriate, but they are generally the exception, not the rule. | [
0.5157825946807861,
-0.197015181183815,
0.31666404008865356,
0.26964789628982544,
-0.04752349480986595,
-0.4120534658432007,
-0.06248515844345093,
0.015346634201705456,
-0.4461205303668976,
-0.6757950782775879,
-0.4562525451183319,
0.5127782821655273,
-0.2859141528606415,
-0.00765401683747... | |
I have a utility class that needs to work on a generic Class but must be restricted to those that are an enum and implement a particular interface.
```
// These two work
Class<? extends Enum<?>> enumClass;
Class<? extends MyInterface> interfaceClass;
// This is what I want but does not work
Class<? extends MyInterfac... | [
0.22741428017616272,
0.008382326923310757,
0.23218435049057007,
-0.13021643459796906,
-0.11350604146718979,
-0.02608787827193737,
0.13869525492191315,
-0.3243645131587982,
-0.07870940119028091,
-0.760102391242981,
0.10932453721761703,
0.5389155745506287,
-0.5256686806678772,
0.426569014787... | |
this is even possible.
So my question boils down to how can I declare a member variable with those constraints?
So Currently MyClass is a singleton then as needed the enum/interface can be updated. The return values of its operations will change depending on which enum it is given. I would like to not have the gener... | [
0.19824837148189545,
-0.0032916220370680094,
0.33104628324508667,
0.0054961033165454865,
-0.12485408037900925,
-0.20489709079265594,
0.2276943027973175,
0.01268149632960558,
-0.2430725395679474,
-0.6119924187660217,
0.24973265826702118,
0.5124185681343079,
-0.18463245034217834,
0.581809997... | |
I could only enforce the Interface requirement then check in the setter method that it is an enum throwing an exception otherwise but that is not ideal.
**Edit** (Updated question and added more detail)
I'm not sure, but maybe you forgot to require spec\_helper.
If so, just insert this in the first line of applicatio... | [
0.4462067782878876,
0.2174183428287506,
0.6372004151344299,
0.03230006620287895,
0.3132964074611664,
-0.23195239901542664,
0.3621675670146942,
-0.2456495314836502,
-0.041508905589580536,
-0.5960409045219421,
-0.13094522058963776,
0.8185356259346008,
-0.37144291400909424,
0.0130264023318886... | |
i've often had this issue where i do not really understand how to pass userform variables into classes. for example i have a button:
```
private void button1_Click(object sender, EventArgs e)
{
DoStuff();
}
```
and a method in the form class:
```
DoStuff()
{
Class123 myclass = new Class123();
}
...
...
... | [
-0.16004638373851776,
-0.11690330505371094,
0.36969828605651855,
-0.0432780459523201,
-0.02025735192000866,
-0.28332024812698364,
0.4459973871707916,
-0.1762324869632721,
-0.1545618623495102,
-0.8141452074050903,
-0.1337323933839798,
0.49220240116119385,
-0.14517898857593536,
0.24587863683... | |
do i pass for example in myotherClass whether or not my checkbox on the userform is checked? i dont want to have to pass from method to method to class to class. what is the logical/smart way of handling this?
I disagree with this approach.
Any 'smart' method, if it even exist, will break the golden rules of Object ... | [
0.19035139679908752,
0.21238230168819427,
0.09423992037773132,
0.3892754316329956,
-0.06638772040605545,
-0.3264181315898895,
0.3477380573749542,
0.04746749624609947,
-0.13813282549381256,
-0.5971108078956604,
-0.10764944553375244,
0.036982472985982895,
-0.09327313303947449,
0.056059226393... | |
receive or send messages to other objects only by calling their methods.
EDIT: To show a way to do it
```
public static class MyApp
{
public static bool MyCheckBox {get; set;}
}
```
in your doStuff
```
MyApp.MyCheckBox = this.checkBox1.Checked;
```
inside a method of your myOtherClass
```
if(MyApp.MyChe... | [
0.08156824111938477,
-0.20474135875701904,
0.3996526002883911,
-0.09653369337320328,
-0.14315195381641388,
-0.03266812860965729,
0.5949816107749939,
-0.028476441279053688,
-0.09893282502889633,
-0.6283419728279114,
-0.2283395230770111,
0.48790445923805237,
-0.5487862229347229,
0.1020664796... | |
I have recently begun working on a pre-existing PHP application, and am having a bit of trouble when it comes to exactly what I should to improve this application's scalability. I am from a C#.NET background, so the idea of separation of concerns is not new to me.
First off I want to tell you what exactly I am looking... | [
0.3647966980934143,
0.3385216295719147,
0.2687434256076813,
0.19458116590976715,
0.05292562395334244,
-0.09334923326969147,
0.09939718246459961,
0.11722735315561295,
-0.19206398725509644,
-0.7255947589874268,
0.3297037184238434,
0.20060132443904877,
0.04910420998930931,
0.13308943808078766... | |
using code akin to this:
```
$x = db->query("SELECT ID, name FROM table ORDER BY name");
if ($x->num_rows > 0) {
while ($y = $x->fetch_object()) {
foreach ($y as $key => $value)
$$key = $value;
```
Obviously, this is not great for an application that is as large as the one I am supposed to be... | [
0.06690550595521927,
0.13178975880146027,
0.21110117435455322,
-0.16043232381343842,
-0.0765678659081459,
-0.11626044660806656,
0.03682545945048332,
-0.3184184432029724,
-0.26093754172325134,
-0.5853087902069092,
-0.03405635058879852,
0.4040047824382782,
-0.3072175681591034,
0.386819899082... | |
(almost a 1 to 1 match with my database tables). They follow the form of this:
```
namespace Application
{
public class Person
{
private int _id = -1;
private string _name = "";
private bool _new = false;
public int ID
{
get{ return _id; }
}
public string Name
{
... | [
-0.15902243554592133,
0.16246896982192993,
0.0832737535238266,
0.04333610087633133,
0.07506249845027924,
0.08444704860448837,
0.23615534603595734,
-0.31182917952537537,
-0.1414261907339096,
-0.5923435091972351,
-0.34795185923576355,
0.5925348401069641,
-0.08041998744010925,
0.3126271665096... | |
set { _name = value; }
}
public Person(int id)
{
DataSet ds = SqlConn.doQuery("SELECT * FROM PERSON WHERE ID = " + id + ";");
if (ds.Tables[0].Rows.Count > 0)
{
DataRow row = ds.Tables[0].Rows[0];
_id = id; | [
-0.23522712290287018,
-0.5143482685089111,
0.35692042112350464,
0.09162667393684387,
-0.005124492570757866,
0.08198241144418716,
0.20638680458068848,
-0.36770960688591003,
0.13915224373340607,
-0.4481549561023712,
-0.3632059395313263,
0.3737425208091736,
-0.41865968704223633,
0.21807977557... | |
_name = row["Name"].ToString();
}
else
throw new ArgumentOutOfRangeException("Invalid PERSON ID passed, passed ID was " + id);
}
public Person()
{
_new = true;
}
public void save()
{ | [
-0.2961331903934479,
-0.33351555466651917,
0.11065416783094406,
-0.34826087951660156,
0.3264307379722595,
0.3231814205646515,
0.6037160158157349,
-0.20584718883037567,
-0.08631642162799835,
-0.43737536668777466,
-0.1486591398715973,
0.6044304370880127,
-0.22550968825817108,
0.2465744763612... | |
if (_new)
{
doQuery(" INSERT INTO PERSON " +
" ([Name]) " +
" VALUES " +
" ('" + Name.Replace("'", "''") + "'); ");
} | [
-0.35166922211647034,
-0.09433025866746902,
0.27868157625198364,
-0.3955192267894745,
0.49958086013793945,
0.044166937470436096,
0.11607255786657333,
-0.18796344101428986,
0.15057693421840668,
-0.4838760197162628,
-0.540470540523529,
0.5229631662368774,
-0.219148650765419,
0.19415503740310... | |
else
{
SqlConn.doNonQuery(" UPDATE PERSON " +
" SET " +
" [Name] = '" + _name.Replace("'", "''") + "' WHERE " +
" ID = " + _id); | [
-0.047994278371334076,
-0.1928839087486267,
0.3782013952732086,
-0.15683069825172424,
0.45964619517326355,
-0.19186875224113464,
0.2099030762910843,
-0.15257567167282104,
0.11840774863958359,
-0.2031444013118744,
-0.14743901789188385,
0.781987726688385,
-0.4567910432815552,
0.0236829388886... | |
}
}
```
In shorter terms, they simply have attributes that mimic the table, properties, a constructor that pulls the information, and a method called `save` that will commit any changes made to the object.
On to my actual question: first of all, is this a good way of doing things? It has always worked well for ... | [
0.3351603150367737,
0.042258936911821365,
0.07442974299192429,
-0.027160024270415306,
-0.11076315492391586,
-0.18834543228149414,
0.02457188442349434,
0.36460188031196594,
-0.21043042838573456,
-0.5947399139404297,
0.27980172634124756,
0.7147749066352844,
-0.1231486052274704,
-0.1537697166... | |
If this isn't a good practice are there any good examples of how I should adapt this project to 3 tiers? Or, possibly I should not attempt to do this for some reason.
I am sorry for the length of the question, but I have been digging on the internet for a week or so to no avail, all I seem to ever find are syntax stan... | [
0.13971486687660217,
0.1676734983921051,
0.44563913345336914,
-0.17814861238002777,
-0.35034868121147156,
-0.1293642669916153,
0.37818676233291626,
-0.019216263666749,
-0.5621221661567688,
-0.6731429696083069,
-0.107213594019413,
0.5466800332069397,
-0.28097692131996155,
0.0568556375801563... | |
patterns though, but for clarity (end length of the post I will only go into MVC). It doesn't really matter which pattern you wish to follow as long as you use the [SOLID principles](http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)).
> I am from a C#.NET background, so the idea of separation of concerns is ... | [
0.37710386514663696,
-0.08193061500787735,
0.37100180983543396,
0.1030842661857605,
-0.22639718651771545,
-0.03623585402965546,
0.36885401606559753,
-0.11471066623926163,
-0.5898107290267944,
-0.5793923139572144,
0.09358301758766174,
0.395801842212677,
-0.2870749235153198,
-0.1804847568273... | |
'all the work'
**V**iew: which takes care of the presentation
**C**ontroller: which handles requests
When requesting a page it will be handled by the Controller. If the controller needs to get some work done (e.g. getting a user) it would ask the model to do this. When the controller has all the needed info it w... | [
0.3258078992366791,
-0.24334894120693207,
0.8319676518440247,
0.10727041959762573,
-0.5299269556999207,
-0.09226465225219727,
-0.07140618562698364,
-0.17866966128349304,
-0.23308342695236206,
-0.5116461515426636,
-0.1461983621120453,
0.604993462562561,
-0.3289734721183777,
-0.0456717200577... | |
is pretty sweet (if you know what you are doing) and at the same time can suck. Remember that you can always do strict comparisons by using three `=` signs:
```
if (1 == true) // truthy
if (1 === true) // falsy
```
> also no method overloading is entirely new
PHP indeed doesn't *really* support method overloading, ... | [
0.15423156321048737,
-0.06974519044160843,
0.4949699938297272,
-0.14460916817188263,
-0.20695188641548157,
0.11734209954738617,
0.43512725830078125,
-0.31815364956855774,
0.18484878540039062,
-0.3730635643005371,
0.09611061960458755,
0.7835738062858582,
-0.12761954963207245,
-0.10923792421... | |
func_get_args();
for ($i = 0; $i < $numargs; $i++) {
echo "Argument $i is: " . $arg_list[$i] . "<br />\n";
}
}
doSomething('now I can add any number of args', array('yay!', 'woo!', false));
```
> Or, possibly I should not attempt to do this for some reason.
Of course you should attempt it. When you ... | [
0.13343597948551178,
0.06845671683549881,
0.5802631974220276,
0.17536665499210358,
-0.14313268661499023,
-0.3540262281894684,
0.338222861289978,
-0.06188541278243065,
-0.5483067631721497,
-0.2623727023601532,
-0.37632670998573303,
0.9171801209449768,
-0.09045376628637314,
-0.11861846596002... | |
I have a simple Parallel.Foreach loop that has about 1000 rows in the DataTable, each of these Rows calls a new Class, however, the memory builds up until i run out of memory. I'm wondering how to you dispose to a new Class properly in regards to a parallel. If you're saying what a newb question it's because Parallel a... | [
0.246027871966362,
0.06563866883516312,
0.40623727440834045,
0.11172392964363098,
0.13298344612121582,
0.4648551642894745,
0.03732766583561897,
-0.16337527334690094,
-0.4086045026779175,
-0.8147268891334534,
0.3346158564090729,
0.6140498518943787,
-0.28889745473861694,
0.49146926403045654,... | |
WebSiteCrawlerClass WCC = new WebSiteCrawlerClass();
if (drow.ItemArray[0].ToString().Contains("$"))
{
WCC.linkGrabberwDates(drow.ItemArray[0].ToString(), "www");
}
else
{ | [
0.027377793565392494,
-0.1548255980014801,
0.6943720579147339,
-0.18790391087532043,
-0.15853291749954224,
-0.21595197916030884,
0.5858829021453857,
-0.19603988528251648,
-0.2154412567615509,
-0.7716512084007263,
-0.22857101261615753,
0.5968219041824341,
-0.4649202525615692,
0.475067764520... | |
WCC.NoDatesCarCrawler(drow.ItemArray[0].ToString(), "www");
}
});
```
There are several patterns that one can follow. I like to use the [MVC pattern](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) myself. MVC is about [splitting user interface interaction into three distinct ro... | [
0.20081229507923126,
0.1175718754529953,
0.8842840790748596,
-0.2435000240802765,
-0.25005966424942017,
-0.18847960233688354,
0.34661638736724854,
-0.2616565525531769,
-0.36566993594169617,
-0.5797445178031921,
0.030960548669099808,
0.7100716829299927,
-0.1802583485841751,
0.26745098829269... | |
the idea of separation of concerns is not new to me.
That's great. Trying to learn PHP will only be an implementation detail at this point.
> Obviously, this is not great for an application that is as large as the one I am supposed to be working on.
Glad that we agree :-)
---
In an MVC pattern you would have:
**M... | [
0.24802474677562714,
-0.04008821025490761,
0.5821168422698975,
0.25587335228919983,
-0.09657394886016846,
0.013058180920779705,
-0.09279019385576248,
-0.3580930531024933,
-0.4196856915950775,
-0.439060240983963,
0.03203340992331505,
0.6356303691864014,
-0.21762168407440186,
-0.260904908180... | |
ask the model to do this. When the controller has all the needed info it will render a view. The view **only** renders all the info.
That person object you were talking about would be a model in the MVC pattern.
> I've noticed already that PHP's loose typing has caused me issues in the way I do things
PHP loose typi... | [
0.22078922390937805,
-0.10514405369758606,
0.39779695868492126,
0.2803671956062317,
-0.2598392963409424,
0.03817799687385559,
0.283944696187973,
-0.16072610020637512,
0.0007857714081183076,
-0.5639580488204956,
0.383816123008728,
0.7894360423088074,
-0.14184223115444183,
-0.158266350626945... | |
no method overloading is entirely new
PHP indeed doesn't *really* support method overloading, but it can be mimicked. Consider the following:
```
function doSomething($var1, $var2 = null)
{
var_dump($var1, $var2);
}
doSomething('yay!', 'woo!'); // will dump yay! and woo!
doSomething('yay!'); // will dump yay! an... | [
0.16001972556114197,
0.04618747904896736,
0.6468216776847839,
-0.21912160515785217,
-0.19459852576255798,
-0.0015646015526726842,
0.45240116119384766,
-0.7010092735290527,
-0.2136354297399521,
-0.15581949055194855,
-0.10053930431604385,
0.5864760279655457,
-0.4609034061431885,
0.0451141148... | |
array('yay!', 'woo!', false));
```
> Or, possibly I should not attempt to do this for some reason.
Of course you should attempt it. When you already have programming experience it shouldn't be too hard.
---
If you have any more questions you can can find me idling in the [PHP chat](https://chat.stackoverflow.com/r... | [
0.38532403111457825,
0.09712475538253784,
0.49760955572128296,
0.09554232656955719,
-0.15995152294635773,
-0.1721169352531433,
0.39203768968582153,
-0.17203207314014435,
-0.5152866244316101,
-0.45226573944091797,
-0.09504161030054092,
0.7634093165397644,
0.03284274414181709,
-0.12676934897... | |
I'm writing a small application to convert several multipage PDF's to multipage TIFF files. Per the other questions and answers on this site, I've tried both ghostscript and ImageMagick however both pieces of software only covert the first page when I run them. Are there any other tools I can use to accomplish this, pr... | [
0.4724990427494049,
0.0007556714699603617,
0.3972240090370178,
0.20493727922439575,
-0.18049901723861694,
-0.12000950425863266,
0.18539278209209442,
0.19941280782222748,
-0.28661802411079407,
-0.7987419366836548,
0.31505340337753296,
0.5809810161590576,
-0.3103293478488922,
0.1027061268687... | |
it may not be apparent how to advance to subsequent pages in the TIFF.
Consider the following 3 commands:
```
gs \
-o multipage-tiffg4.tif \
-sDEVICE=tiffg4 \
multipage-input.pdf
```
and
```
gs \
-o multipage-tiff24nc.tif \
-sDEVICE=tiff24nc | [
-0.22280572354793549,
0.006273885257542133,
0.8096354603767395,
-0.06981159746646881,
-0.15791501104831696,
-0.2048184722661972,
0.2206784337759018,
-0.22200243175029755,
-0.2329699546098709,
-0.6612874865531921,
-0.4654267430305481,
0.4637415409088135,
-0.29504603147506714,
0.012992067262... | |
\
multipage-input.pdf
```
and
```
gs \
-o multipage-tiff32nc.tif \
-sDEVICE=tiff32nc \
multipage-input.pdf
```
Each of these commands generates a multi-page TIFF, but with different [output devices](http://ghostscript.com/doc/current/Devices.htm):
1. The *tiffg4* one is ... | [
-0.03774675726890564,
0.009134356863796711,
0.8672471642494202,
-0.16316989064216614,
-0.23231402039527893,
0.2630329728126526,
0.20345859229564667,
-0.49068132042884827,
-0.24202944338321686,
-0.5748447775840759,
-0.13922882080078125,
0.3681388199329376,
-0.6645219326019287,
0.13651840388... | |
72dpi.
3. The *tiff32nc* one is in CMYK color (with 8 bits per color) also using a resolution of 72dpi.
There are a number of additional output devices for TIFF at the link above.
All the resolution values for the TIFF files result from Ghostscript's default settings. If you want to override these, for example becaus... | [
0.38098639249801636,
-0.09063733369112015,
0.7503136992454529,
-0.1736915558576584,
-0.45570504665374756,
0.03311624005436897,
0.2455347627401352,
-0.3185374438762665,
-0.18649393320083618,
-0.8741561770439148,
0.09252455085515976,
0.5089672207832336,
-0.6282666325569153,
-0.24053023755550... | |
each of the \*.tif files -- with each line representing 1 page of the respective \*.tif.
I suspect it may have worked all the way for you -- that you were just unable to recognize the multiple pages in your resulting TIFFs. Not all TIFF viewers are able to display these -- they display the first page only if they can'... | [
0.4150758981704712,
-0.17152370512485504,
0.36897656321525574,
0.21002599596977234,
-0.1771778017282486,
0.07199011743068695,
0.14955885708332062,
0.24860136210918427,
-0.19134248793125153,
-0.4923052489757538,
-0.03622910752892494,
0.34298697113990784,
-0.4470005929470062,
0.0682032406330... | |
I've been trying to execute this mysql query in my php file however I think there may be a problem with it as I get an error whenever it reaches the code.
Here is the query:
```
"INSERT INTO " . $my_tableName . "(mycolumn, myothercolumn)
values ('myvariable', " . $pass . ");" .
"INSERT INTO " . $my_othertableName .... | [
-0.11651935428380966,
0.22867874801158905,
0.5387622714042664,
0.15842853486537933,
0.1076146811246872,
-0.258678138256073,
0.29411181807518005,
0.08062395453453064,
-0.14747868478298187,
-0.5479430556297302,
0.1467040330171585,
0.45230716466903687,
-0.24467237293720245,
0.1063811182975769... | |
to quote your $pass value:
```
"INSERT INTO " . $my_tableName . "(mycolumn, myothercolumn)
values ('myvariable', '" . $pass . "');" .
``` | [
0.1620890498161316,
0.440140962600708,
0.5322880744934082,
0.18788449466228485,
0.19613319635391235,
-0.005713696591556072,
0.0837453156709671,
0.3456958532333374,
0.11895687878131866,
-0.5065299868583679,
-0.2080879658460617,
0.10227463394403458,
-0.08809554576873779,
0.17448687553405762,... | |
I am having a time tryng to pull ALL records out of a database. For example I have the following
```
$result = mysql_query("SELECT * FROM `plant_info` ORDER BY id LIMIT 0, 50") or die(mysql_error());
// Variables to pull from the database
// I know the line below is the culprit now, so i must change the code below co... | [
0.014377713203430176,
-0.12000136077404022,
0.6396963596343994,
-0.04552872106432915,
0.1625661551952362,
0.33455145359039307,
-0.009746856056153774,
-0.31663966178894043,
-0.15974248945713043,
-0.44012707471847534,
-0.3913753628730774,
0.40981945395469666,
-0.09910827875137329,
0.21912257... | |
echo "$num_rows Rows\n";
while ($row = mysql_fetch_array($result)) {
echo " <tr>
<td align=\"center\" bgcolor=\"#000000\">
<p><img src=\"$row[Image_Name]\" style=\"width:120px;height:auto;\"></p> | [
0.15056031942367554,
-0.10059762746095657,
0.3236769437789917,
-0.32892531156539917,
-0.14386558532714844,
0.18594121932983398,
0.37110409140586853,
-0.8903679251670837,
-0.12827514111995697,
-0.1735825389623642,
-0.04226328060030937,
0.2093769609928131,
-0.48783817887306213,
0.01318429410... | |
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Latin_Name]</p> | [
-0.1155117005109787,
0.07483188807964325,
0.2978409230709076,
-0.09077166020870209,
0.1434199959039688,
0.3442859649658203,
-0.07209250330924988,
-0.28435587882995605,
-0.1363215446472168,
-0.4344669580459595,
-0.1483214944601059,
0.24545565247535706,
-0.1971038281917572,
0.088412910699844... | |
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Common_Name]</p> | [
-0.03818674385547638,
0.11713103950023651,
0.2842685580253601,
-0.13495048880577087,
0.15818411111831665,
0.21679678559303284,
-0.14528797566890717,
-0.19158191978931427,
-0.16082227230072021,
-0.4886507987976074,
-0.07743211090564728,
0.27501872181892395,
-0.3047703802585602,
0.2905966341... | |
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Category]</p>
</td> | [
-0.04203540086746216,
-0.10381808876991272,
0.3037799298763275,
-0.05127744749188423,
-0.06847833842039108,
0.06513979285955429,
-0.14677098393440247,
-0.4082430899143219,
-0.32183191180229187,
-0.3313747048377991,
-0.21028870344161987,
0.43340662121772766,
-0.30400028824806213,
0.16534535... | |
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Type]</p>
</td> | [
0.027797451242804527,
-0.013783414848148823,
0.3590323030948639,
-0.07012514024972916,
0.013466731645166874,
0.19856154918670654,
-0.18195965886116028,
-0.5012902617454529,
-0.13978588581085205,
-0.3277055323123932,
0.013298537582159042,
0.39247313141822815,
-0.3167183995246887,
0.08462212... | |
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Flower]</p>
</td> | [
-0.009400698356330395,
-0.11857499927282333,
0.3036164939403534,
-0.16114795207977295,
-0.0445326566696167,
0.2994323670864105,
-0.13911843299865723,
-0.43433284759521484,
-0.06685999035835266,
-0.3401467800140381,
0.05549922212958336,
0.17205384373664856,
-0.4015502631664276,
0.0537300705... | |
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Comments]</p>
</td>
</td> | [
0.07601473480463028,
-0.01701793074607849,
0.29008984565734863,
-0.0049753435887396336,
0.014088793657720089,
0.1306464672088623,
-0.1917104423046112,
-0.44005075097084045,
-0.14209285378456116,
-0.4102591276168823,
-0.037229958921670914,
0.412259042263031,
-0.2780696749687195,
0.031886953... | |
<td align=\"center\" bgcolor=\"#90c084\">
<p><a href=\"editplant.php?get=$row[id]\">Edit</a></p>
<p><a href =\"print_sign_div.php?get=$row[id]\">Print</a></p> | [
0.2370901256799698,
-0.061986591666936874,
0.5644485354423523,
-0.10856602340936661,
-0.10667896270751953,
0.19394457340240479,
0.022785503417253494,
-0.7159637808799744,
-0.12496641278266907,
-0.2953287959098816,
-0.020640358328819275,
0.5575505495071411,
-0.23104190826416016,
-0.10773692... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.